INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
algorithm to draw image selection I have an image with size of M*N. Each pixel can be selected or not selected. ![image selection]( Given selection values for each pixel (selected or not), what is the most efficient algorithm to get the set of polygons which represents a selection? ![enter image description here](
Diagonals might be tricky, because of pixel-exact rounding errors, so I would go only for rectangles with horizontal and vertical lines (overlapping ones can be merges to a polygon) I would perform the following steps: 1. connect selected neighbours of selected pixels to horizontal lines 2. connect horizontal lines to rectangles 3. connect overlapping/touching rectangles to a polygon
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "algorithm, image processing" }
Calculating the buoyant force of a rising bubble I am solving the problem: > A gas bubble rising from the ocean floor is 1 inch in diameter at a depth of 50 feet. Given that specific gravity of seawater is 1.03, the buoyant force in lbs being exerted on the bubble at this instant is nearest to: The given answer is 0.020 lbs. I start from the equation for buoyancy: $$F_b=(P_{fluid}-P_{bubble})Vg$$ $g=32.2\:\mathrm{ft/s^2}$ $V=(4/3)\pi(1\:\mathrm{in}/2)^3 * (1 \:\mathrm{ft}/12 \:\mathrm{in})^3=3.03*10^{-4}\:\mathrm{ft^3}$ $P_{fluid}=sp.gr(saltwater)*densityH_2O=1.03*62.4=64.272\:\mathrm{lb_m/ft^3}$ P_gas: Pressure, $P=62.4*50\:\mathrm{ft}=3120\:\mathrm{lb/ft^2}$ $PV=mRT$ $P_{bubble}=m/V=P/RT=3120/53.34*492R (STP)=0.11889\:\mathrm{lb_m/ft^3}$ When I substitute all of the values I only get 0.607 lbs. What am I doing wrong?
The buoyant force is equivalent to the weight of the fluid that the bubble displaces, not the difference of the fluid's and body's weight. $F_b = \rho V g$ $V = \frac{4}{3} \pi (1/2)^3 = \frac{1}{6} \pi\:\mathrm{in^3}$ $V = 3,03 \cdot 10^{-4}\:\mathrm{ft^3}$ $\rho = 1.03 \cdot \rho_{water} = 64.272\:\mathrm{\frac{lbs}{ft^3}}$ And now you simply multiply $\rho$ with $V$ and get $ \sim 0.02$. ~~As a matter of fact the information about the depth is irrelevant as the force is independent of the depth.~~ As per comments: Generally speaking the depth is not relevant for the force as long as the object immersed is incompressible. In the case of a bubble, which is compressible, the volume will decrease with increasing depth. Hence the buoyant force will decrease. Also the object needs to be fully immersed for the first statement to be true.
stackexchange-engineering
{ "answer_score": 4, "question_score": 3, "tags": "fluid mechanics, thermodynamics" }
What is the Codeigniter equivilent to PHP multi_query Whith PHP - I write a multi_query something like this: $MySQL_string .= "UPDATE `table` SET `name` = 'joe' WHERE `ID` = '1'"; $MySQL_string .= "UPDATE `table` SET `name` = 'Jane' WHERE `ID` = '2'"; if($DB->mysqli->multi_query($MySQL_string) === TRUE){ echo"Query executed successfully<BR>"; }else{ echo"Error executing query: ".$DB->mysqli->error; die(); } What is the equivalent to PHP's multi_query() in Codeigniter? If there is no equivilent - how would I use multi_query() in Codeigniter?
You can use Codeigniter function `$this->db->update_batch()`, to which you can pass either an array or object. To complete your example it could look like this: $data = array( array( 'name' => 'Joe' , 'ID' => '1' ), array( 'name' => 'Jane' , 'ID' => '2' ) ); and then use: $this->db->update_batch('mytable', $data, 'ID'); more info here:
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "php, codeigniter, multi query" }
get latest(date) row of groups my problem is, that I stuck with this I guess simple problem. Now 2 evenings Grrr... I created a small example to keep it simple: The source table looks like that: Some obj with some random status. These statuses can be changed/updated by insert a new row. Id | obj| status | date ---+----+--------+----- 1 | 1 | green | 2013 2 | 1 | green | 2014 3 | 1 | yellow | 2015 4 | 1 | orange | 2016 <- Last status of 1 5 | 2 | green | 2013 6 | 2 | green | 2014 <- Last status of 2 7 | 3 | green | 2010 8 | 3 | red | 2012 <- Last status of 3 I would need to get an output like that: obj| status | date ---+--------+----- 1 | orange | 2016 2 | green | 2014 3 | red | 2012 text: The output shows the latest status of ech obj. I hope somebody can help me..
A simple correlated subquery in the `where` clause does the trick: select obj, status, date from t where t.date = (select max(t2.date) from t t2 where t2.status = t.status);
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "mysql, sql" }
What is your session management strategy for NHibernate in desktop applications? I find it much more difficult to manage your session in a desktop application, because you cannot take advantage of such a clear bondary like HttpContext. So how do you manage your session lifetime to take advantage of lazy loading but without having one session open for the entire application?
I think it boils down to the design of your objects. Because lazy-loading can be enforced in the per-object level, you can take advantage of that fact when you think about session management. For example, I have a bunch of objects which are data-rich and lazy loaded, and I have a grid/summary view, and a details view for them. In the grid-summary view, I do not use the lazy-loaded version of the object. I use a surrogate object to present that data, and that surrogate object is not lazy loaded. On the other hand, once a user selects that record for viewing/editing, and you enter a multi-paged details view of the object, that's when we apply lazy-loading to the specific object. Data is now lazy loaded depending on which details are viewed only on demand. That way, the scope of my session being open for lazy loading only lasts as long as the details view is being used.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 12, "tags": ".net, nhibernate, desktop application" }
How to Filter Cells in AQGridView with UISearchBar i'm going crazy on this problem: I'm using AQGridView for show some image from an array that i retrieve from SQLite but i'm not able to filter the Grid with a UISearchBar that i put in the TitleView of a Detail zone in a SplitViewController. Can u help me with some logic passage or with an example? Thanks!
SOLVED! Recalculated the array _icons after removed all objects.. [_icons removeAllObjects]; searching = YES; NSInteger numeroElem = [subcatList getSize]; for ( NSUInteger i = 0; i < numeroElem; i++ ) { NSDictionary *itemAtIndex = (NSDictionary *)[subcatList objectAtIndex:i]; NSString *titolo_cat = [itemAtIndex objectForKey:@"titolo"]; NSComparisonResult result = [titolo_cat compare:searchText options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])]; if (result == NSOrderedSame) { ETC ETC....... [_icons addObject: image]; } };
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "iphone, ios, xcode, uisearchbar, aqgridview" }
Different elasticsearch nodes for different use cases Our Elasticsearch cluster is used to provide search results for a frontend. Most of the traffic is pretty negligible and the cluster can handle the load just fine. At a scheduled time each week, however, several hundred thousands of newsletters are generated, each containing user-specific content, resulting in a ES query for each of them. During that time the overall response time of our cluster is degrading significantly. We are looking for ways to mitigate this behavior and came up with the idea of having separate ES nodes for separate query concerns. So node A would be accessed for normal traffic, while node B would be accessed for newsletter queries exclusively. That way node B would only cause a slowdown for newsletter queries, which is fine. Is a cluster setup like this possible/viable/advisable? Are there better alternatives?
Is the data used by the frontend the same as used by the weekly newsletter job? If it is split into different indices, you could use Shard Allocation Filtering to make sure certain indices end up on specific hosts. Alternatively, you could make sure that a number of nodes are dedicated to the frontend, and a number are dedicated to the weekly job. You'd use the "rack_id" trick to make sure the primary/replica shards are split properly between the two groups.
stackexchange-serverfault
{ "answer_score": 0, "question_score": 0, "tags": "elasticsearch" }
Nutritional difference between Sweet and Regular potatoes. I've been wondering about this for some time now. A LOT of diets include sweet potatoes as a source of complex carbs, which would be just fine, if I lived in US. Since I don't there aren't any available to me ( and no, it's not the price, you just CAN'T buy them). Therefore, could the sweet potatoes be substitued with regular potatoes?
On the surface (by nutrient breakdown), they look pretty similar except that a sweet potato has massively more vitamin A. According to Dr. Mirkin: > 7-ounce white potato with skin: 220 calories, 5g protein, 51g carbs, 20mg calcium, 115mg phosphorus, 2.8mg iron, 16mg sodium, 844mg potassium, 4g fiber, .22mg thiamin, .07mg riboflavin, 3.3mg niacin, 16mg vitamin C > > 7-ounce sweet potato: 208 calories, 3.5g protein, 49g carbs, 56mg calcium, 110mg phosphorus, 1mg iron, 20mg sodium, 693mg potassium, 5g fiber, 4350 RE vitamin A, .14mg thiamin, .13mg riboflavin, 1.2mg niacin, 49mg vitamin C. One difference not captured in that breakdown is that the glycemic index is quite different at 85 (high) for white potato and 54 (medium) for sweet potato.
stackexchange-fitness
{ "answer_score": 7, "question_score": 3, "tags": "diet, carbohydrate" }
Can the Biot-Savart law be derived from QED? It's important that a new theory of physics contains the equations and results of previous related ones. Maxwell theory and QED both have explanations for electromagnetic phenomena so I'm wondering if the Biot-Savart law can be derived in QED.
We can obtain Coulomb's law in the non-relativistic limit of the tree-level QED interaction, cf. this question. The Biot-Savart law is a consequence of Maxwell's equations, cf. this question. And Coulomb's law together with special relativity is sufficient to derive Maxwell's equation, cf. this question. So, altogether, yes, we might say that we can derive the Biot-Savart law from QED.
stackexchange-physics
{ "answer_score": 4, "question_score": 3, "tags": "electromagnetism, quantum electrodynamics" }
Vector of triangle !Question Please explain how to get answer. Regards!
Taking vectors with origin O, we have that P is the point $\frac{1}{2}(\mathbf{a}+\mathbf{b})$ since it is the midpoint of AB. Hence Q is the point $\frac{3}{8}(\mathbf{a}+\mathbf{b})$. R is the point $k\mathbf{b}$ and A is obviously the point $\mathbf{a}$. The general point on the line through A and R is $\lambda\mathbf{a}+(1-\lambda)k\mathbf{b}$. So to get Q we must take $\lambda=\frac{3}{8}$, so we need $\frac{3}{8}=k(1-\lambda)=k\frac{5}{8}$, and hence $k=\frac{3}{5}$.
stackexchange-math
{ "answer_score": 1, "question_score": -4, "tags": "vectors" }
extend linq to entities to recognize custom methods As discussed here and in countless more: I'd like to know if there is ANY way to inherit/extend/... Entity Framework 4.1 to translate a custom method to SQL.
No. But you if you are using EDMX, you can either use model defined function or custom SQL / mapped SQL function exposed as .NET method available in Linq-to-Entities query. None of these techniques is available with code-first.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 7, "tags": "c#, .net, linq, entity framework, entity framework 4.1" }
Find a string in a table then copy the next cell to that value into another row I have been experimenting with some code but cant seem to get it to work. Thanks! Sub c() Dim srchrng As Variant Dim cells As Variant Dim i As Integer For Each cells In srchrng If cells.Value = "Moisture Content" Then cells.Offset(0, 1).Select Selection.Copy Active.cell ("Q20") i = i + 1 End If Next cells End Sub !1
Try this: Dim cells As Variant For Each cells In [G2:G8] If cells = "Moisture Content" Then [Q20] = cells.Offset(0, 1) Exit For End If Next cells There's no need for `i`, the `For Each` loop manages the iteration for you.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "excel" }
How can I get the coordinates of any given address using CoreLocation framework and not google Maps API? I'm interested in finding out the coordinates of "any" given address and not just the current location using only CoreLocation.Framework. I do not wish to use google maps API or yahoo maps or any other third Party maps API. Is it possible? How can I get the coordinates of any address? Thanks
EDIT - Thanks to a comment, I realized my original answer is dreadfully out of date. At the time, in late 2009, it was a massive pain to geocode - reverse geocoding was possible via Core Location APIs, but forward geocoding was not possible until iOS 5. But in iOS 6.1 MapKit introduced an even better API, the MKLocalSearch class. It's very easy to perform search queries for an address and then inspect the properties of the returned objects.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "iphone, gps, coordinates, google maps, core location" }
Probabilistic Independent Events Example A given a random experiment, A and B are two **independent** events such that: ℙ (A) = 1/5 ℙ (B) = 1/9 How can we calculate ℙ [A | (A ∪ B)] ?
**Hint:** Write that $\mathbb{P}(A | (A \cup B)) = \frac{\mathbb{P}(A\cap(A\cup B))}{\mathbb{P}(A\cup B)} = \frac{\mathbb{P}(A)}{\mathbb{P}(A\cup B)}$ and conclude by using independence to compute both numerator and denominator.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "probability" }
What is the maximum size of deep learning model input size I have a data to train and test using Fully-connected Deep neural network FC-DNN; The size of the input data I should train is almost 3000, first hidden layer should be up to 4096, third layer 4096 and finally the output layer should be 3000. My question is the size of deep neural network is reasonable and acceptable? What is the maximum reasonable size of deep neural network?
There is no maximum reasonable size (neither for neurons per layer nor for number of layers). After a specific point (which is really dependent on the problem you try to solve), you have diminishing returns when applying multiple `Dense` layers . In fact, it can lead to overfitting which should be avoided. At the same time, in absence of residual connections, stacking multiple `Dense` layers (making the network super-deep) could also lead to the vanishing gradient problem. You should manually try to add a few layers and only if you see that your network does not perform well (low accuracy/other metric in your problem which is a sign of underfitting) should you add more layers. Also, for the last layer I do not think that your problem requires 3000 neurons. If it is regression one neuron with linear activation will suffice. 3000 neurons are only needed if you have 3000 different classes (here we talk only about regression and classification).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "tensorflow, machine learning, deep learning, neural network" }
sum up json values I'm trying to sum up all the values in the json that contain the string "Example". But I have no idea how to do it. I'm using the "Newtonsoft.Json" framework. { "Example1344": 13, "Example925": 16, "Example454Example": 24, "Nothing": 51, "Other9235": 45 } So that the result would be 53
Something along these lines might work for you: Imports Newtonsoft.Json.Linq Module Module1 Sub Main() Dim json As String = $"{{ ""Example1344"": 13, ""Example925"": 16, ""Example454Example"": 24, ""Nothing"": 51, ""Other9235"": 45 }}" Dim model As JObject = JObject.Parse(json) Dim value As Int16 = 0 value = model.Properties _ .Where(Function(m) m.Name.Contains("Example")) _ .Sum(Function(m) m.Value) Console.WriteLine($"Sum: {value}") Console.WriteLine("PRESS ANY KEY TO EXIT") Console.ReadKey(True) End Sub End Module
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": -3, "tags": "json, vb.net" }
Debug app emulando no celular Estou com um problema em que uma conversão `string para double`, em que no `emulador o APP está funcionando` perfeitamente, mas `no celular ele trava` e fecha. Gostaria de saber como fazer para `debugar se quando executo o app no celular`, ele `não tem o debug no logcat`.
Existe sim a possibilidade de visualizar o log do dispositivo pelo LogCat basta selecionar o nome do dispositivo na aba do LogCat. Veja a imagem. ![inserir a descrição da imagem aqui]( Tente ver também nas opções de desenvolvedor do seu celular se a opção depuração usb está habilidata.
stackexchange-pt_stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "android, android studio" }
Pattern Rules and Multiple Directories in Makefiles I am having trouble with using pattern rules and applying them across dependencies and targets in multiple directories. Here is an example to illustrate my problem. Consider the following directory structure |- dir 1 | - file1.A |- dir 2 | - file2.A |- dir 3 | - dir 4 | - file4.A I want to be able to specify a pattern rule, that can be applied to all *.A files. %.B: %.A myscript $< What is the best way to specify this? I tried the following, as a hack, but it gives me an error that I am mixing implicit and static rules. */%.B: */%.A: myscript $< */*/%B: */%.A: myscript $< Any help would be appreciated.
A_FILES := $(shell find . -type f -name '*.A') B_FILES := $(patsubst %.A,%.B,$(A_FILES)) all: $(B_FILES) %.B: %.A myscript $< On some platforms this will work: A_FILES := $(wildcard **/*.A)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "makefile, gnu make" }
Deriving the age of the universe I am trying to work out the solution to exercise 8.4 from An Introduction to Modern Cosmology by Andrew Liddle. I could derive the Friedmann equation as below, $$\dot{a}^2 = H_0^2 \left[\Omega_0a^{-1} + (1 - \Omega_0)a^2\right]$$ How to I derive either of the equation below from the equation above? $$H_0t_0 = \frac{2}{3}\frac{1}{\sqrt{1-\Omega_0}}\ln\left[\frac{1+\sqrt{1-\Omega_0}}{\sqrt{\Omega_0}}\right]$$ or $$H_0t_0 = \frac{2}{3}\frac{1}{\sqrt{1-\Omega_0}}\sinh^{-1}\left[\sqrt{\frac{1-\Omega_0}{\Omega_0}}\right]$$
While doing these types of calculations always use integral calculator site (< There’s a trick that always works while taking these kind of integrals. 1. Write down the Friedman equation in terms of scale factor 2. If there are 2 parameters, you need to eliminate on of the parameters by taking outside the square root. In this case the denominator becomes $$\sqrt{1-\Omega_0}\sqrt{\frac{\Omega_0}{1-\Omega_0}a^{-1}+a^{2}}$$ 3. set $k=\sqrt{\frac{\Omega_0}{1-\Omega_0}}$ (just naming this as a constant) 4. In the integral calculator, type the integral as $$\int \frac{da}{\sqrt{ka^{-1}+a^2}}$$ The answer should be $$\frac{2\ln(\sqrt{a^3+k}+a^{3/2})}{3}+C$$ Now we have $$H_0t_0 = \frac{1}{\sqrt{1-\Omega_0}}[\frac{2\ln(\sqrt{1+k}+1^{3/2})}{3} - \frac{2\ln(\sqrt{k})}{3}] $$ I guess you can do the rest.
stackexchange-physics
{ "answer_score": 0, "question_score": 3, "tags": "cosmology, time, space expansion, universe, big bang" }
Traduction de « clueless / cluelessness » _Clueless_ (informal, adj.) / _cluelessness_ (n). Il s'agit en partie de _ne rien connaître_ ( _Collins_), c'est parfois péjoratif et intense ( _Larousse_), et on a cette idée de _ne pas avoir d'indice_ , d'être (pris au) dépourvu, de naïveté etc. On peut imaginer en contexte : > You can't make him/her the new [title], (s)he's clueless. And such cluelessness casts a shadow on the [office/business]. On connaît l'adjectif _ignorant_ et le nom _ignorance_ dans les deux langues. Comment rendrait-on l'adjectif _clueless_ (plus usuellement et succinctement _que personne qui n'y connaît rien_ ) et l'état de _cluelessness_ qui s'y rattache ?
Dans un contexte professionnel, par rapport à l'exemple donné, je proposerais: * Il n'est pas assez avisé, averti, expérimenté ; * Il manque de pratique, d'expérience; * Il est trop novice, bleu, inexpérimenté. Et * Une telle inexpérience, naïveté, candeur ; * Un tel manque de maturité, maîtrise, métier, savoir-faire. À combiner _ad libitum_...
stackexchange-french
{ "answer_score": 2, "question_score": 7, "tags": "traduction, anglais, registre familier" }
React native text like span I tried to follow the solution in Simulate display: inline in React Native but it's not work. I would like to do the same thing just like in HTML First line is short so seems like no problem, but second line content is too long and it's expected to fill all the space before go to next line. But my output is look like... ![output]( <View style={styles.contentView}> <Text style={styles.username}>{s_username}</Text> <Text style={styles.content}>{s_content}</Text> </View> contentView: { paddingLeft: 10, flex: 1, flexDirection:'row', flexWrap:'wrap' }, username: { fontWeight: 'bold' }, content: { },
React Native supports _nested_ `Text` _components_ , and you must use this to get your desired result. For example, you should have your second text component nested within your second, like so: <View style={styles.contentView}> <Text> <Text style={styles.username} onPress={() => {/*SOME FUNCTION*/} > {s_username} </Text> <Text style={styles.content}>{s_content}</Text> </Text> </View>
stackexchange-stackoverflow
{ "answer_score": 80, "question_score": 41, "tags": "react native" }
How to add variable to a href I want to do something like this var myname = req.session.name; <------- dynamic <a href="/upload?name=" + myname class="btn btn-info btn-md"> But this does not work. So how do I properly pass in a dynamic variable to href? `<a href="/upload?name=" + req.session.name class="btn btn-info btn-md">` does not work either
Actually there's no way to add a js variable strictly inside DOM. I would suggest you to apply an `id` attribute to that `a` element, refer to it and apply given variable as a new `href` attribute. var elem = document.getElementById('a'), myname = 'req.session.name'; //used it as a string, just for test cases elem.href += myname; console.log(elem.href); <a id='a' href="/upload?name=" class="btn btn-info btn-md">Link</a>
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": -1, "tags": "javascript, html, rest" }
simple property of expectation? I'm trying to see what conditions are necessary such that the following holds for a general random variable $X$: $$\mathrm{Pr}[X\ge E[X]] \ge \frac{1}{2}.$$ This seems to be intuitively true if the range of $X$ is somewhat "uniform". Is there anything more specific known for this condition to hold?
> One would ask that the distribution of $X$ is symmetric with respect to its mean, that is, that ($X$ is integrable and that) there exists $m$ such that $m-X$ and $X$ are equidistributed. Then the only possible value of $m$ (when $X$ is integrable) is $m=2\mathbb E(X)$ and the inequality $\mathbb P(X\geqslant \mathbb E(X))\geqslant\frac12$ follows from the remark that $\mathbb P(X\geqslant \mathbb E(X))=\mathbb P(A)+\mathbb P(B)$ where $A=[X\gt E(X)]$, $B=[X=E(X)]$, $C=[X\lt E(X)]$, and from the identities $\mathbb P(A)+\mathbb P(B)+\mathbb P(C)=1$ (always true) and $\mathbb P(A)=\mathbb P(C)$ (due to the symmetry). In the absence of symmetry, such a bound cannot hold in general. For a simple counterexample, consider $X$ such that $\mathbb P(X=-1)=x/(1+x)$ and $\mathbb P(X=x)=1/(1+x)$ for some $x\gt0$. Then $\mathbb E(X)=0$ and $\mathbb P(X\geqslant0)=1/(1+x)$ can take every value in $(0,1)$.
stackexchange-math
{ "answer_score": 4, "question_score": 1, "tags": "probability theory" }
How do you start a simulation with a random initial state in Cirq? How do you create a random initial state by modifying the $2^{n}$ vector amplitudes instead of starting every simulation at $|0000...000\rangle$?
If you want a random computational basis state, set the input state to the integer `random.randint(0, 2**qubits-1)`. If you want a random superposition sampled from the Haar measure, there is a method `cirq.testing.random_superposition(dim=2**qubits)`. Once you have created your initial state, you pass it into the simulator like `cirq.Simulator().simulate(circuit, initial_state=...)`. Note that `run` methods do not support an initial state, because they are supposed to more closely mimic the hardware.
stackexchange-quantumcomputing
{ "answer_score": 2, "question_score": 1, "tags": "programming, cirq" }
C language unknown & syntax I've found this in code, but I never encountered such thing as `&`, only `&&` if ((code & 1) == 1){ Can you tell me what is it?
It's the bitwise and operator: /* binary: 0100, 0010 and 0111*/ int x = 4, y = 2, z = 7; /* then: */ printf("x & y = %d\n", x&y); printf("x & z = %d\n", x&z); printf("y & z = %d\n", y&z); Output: x & y = 0 x & z = 4 y & z = 2 You have the same for the or operation: /* then: */ printf("x | y = %d\n", x&y); printf("x | z = %d\n", x&z); printf("y | z = %d\n", y&z); Output: x | y = 6 x | z = 7 y | z = 7 So in your case, the `if ((code & 1) == 1)` is a test to know if less significant bit is raised in `code`
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c" }
Css Site display correctly at firefox and chrome and Doesn't Display Correctly in IE11 Css Site display correctly at Firefox and chrome and Css Doesn't Display Correctly with IE11,the breadcrumb that i have in the header does not display correctly at ie11 i don't know why . www.myhotels24.eu/fibe.aspx
You need to used the css that work for all browsers. linear-gradient property is only for very few browser that support but not all. background: your-color; background: -webkit-linear-gradient(bottom, your-color, white); /* For Safari 5.1 to 6.0 */ background: -moz-linear-gradient(top, white, your-color); /* For Firefox 3.6 to 15 */ background: -o-linear-gradient(white, your-color); /* For Opera 11.1 to 12.0 */ background: linear-gradient(top, your-color, white); /* Standard syntax */ background: linear-gradient(to bottom, your-color, your-color); /* IE ? */ background: -ms-linear-gradient(top, your-color, your-color); /* IE 11 */ if you use these background property than it will work for all browser. Mean compatible property will auto work nature browser.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "css, asp.net, internet explorer 11" }
What did Cameron see in the Painting? In _Ferris Bueller's day off_ in the museum scene: we see Cameron staring intently at a certain painting, I was wondering what the meaning behind this is.
# He sees himself. John Hughes explained that whilst looking closer at this painting Cameron keeps seeing less and less of the child, he also thinks that the child _**is**_ him, and if you looked close at him (Cameron) you would see nothing. Here's the video where he explains this.
stackexchange-movies
{ "answer_score": 4, "question_score": 5, "tags": "ferris buellers day off" }
How to save array element names to the database? I have following code in my model: public function getData($property) { $data = array( 'a_4_1' => array( 'RUB', 'USD', 'JPY', ), ); return $data[$property]; } And in my view: <?= $form->labelEx($model, 'a_4_1', array('class' => 'col-xs-12 col-sm-2 control-label')) ?> <div class="col-xs-12 col-sm-3"> <?= $form->dropDownList($model, 'a_4_1',$model->getData('d_4_1'), array('class' => 'form-control')) ?> <?= $form->error($model, 'a_4_1') ?> </div> When I save it to the database, it saves data in the integer format (e.g 1,2,..) I need to save array elements' names to the database(e.g RUB, USD)(not integer numbers). How can I do it?
use `array_combine()` to change key value of your array like below: > array_combine($model->getData('d_4_1'),$model->getData('d_4_1')) <?= $form->labelEx($model, 'a_4_1', array('class' => 'col-xs-12 col-sm-2 control-label')) ?> <div class="col-xs-12 col-sm-3"> <?= $form->dropDownList($model, 'a_4_1',array_combine($model->getData('d_4_1'),$model->getData('d_4_1')), array('class' => 'form-control')) ?> <?= $form->error($model, 'a_4_1') ?> </div>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, yii, yii1.x" }
how to catch the MultipleObjectsReturned error in django Is it possible to catch the `MultipleObjectsReturned` error in Django? I do a searchquery and if there are more than one objects I want that the first in the list will be taken so I tried this: try: Location.objects.get(name='Paul') except MultipleObjectsReturned: Location.objects.get(name='Paul')[0] However, it exists in the doc though > global variable MultipleObjectsReturned does not exist
This isn't the best practice. You can technically do this without using exceptions. Did you intend to use `Location` and `Car` in this example? You can do this: Location.objects.filter(name='Paul').order_by('id').first() I strongly suggest you read the Django QuerySet API reference. < To answer your question about where the exception exists -- you can always access these QuerySet exceptions on the model itself. E.g. `Location.DoesNotExist` and `Location.MultipleObjectsReturned`. You don't need to import them if you already have the model imported.
stackexchange-stackoverflow
{ "answer_score": 13, "question_score": 35, "tags": "python, django, exception" }
jQuery: Expected an assignment or function call an instead saw an expression for an ifelse shortstatement? In my Komodo IDE i get a warning message "Expected an assignment or function call an instead saw an expression" for this line: data.aktiv == '1' ? $('#aktiv').attr('checked', 'checked') : $('#aktiv').attr('checked', false); and for this line $('#aktiv').isCheck() ? aktiv = 1 : aktiv = 0; What is here the problem?
It's warning you that you're abusing the conditional operator as a replacement for `if`/`else`. To use the conditional operator properly, change it to: $('#aktiv').attr('checked', data.aktiv == '1' ? 'checked' : false); and aktiv = $('#aktiv').isCheck() ? 1 : 0; For the general case, if you can't use a shortcut like the above, and you have code like condition ? statement1 : statement2 you can fix the linting error by using if (condition) { // statement1 } else { // statement2 }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "jquery, if statement, checkbox, expression, warnings" }
Exalted - Sidereal Dice Cap Sidereal Exalted, in 2nd edition **Exalted** , don't appear to have a clear cap on the number of dice they can add to their pools with charms. The section on Excellencies is only moderately clear -- they can add their Essence in dice, their Essence in successes, and spend motes to reduce dice pool penalties seemingly without limit. However, there is no explicit cap on dice pool adders anywhere in the 2nd ed **Sidereals** text. 1st ed **Sidereals** is explicit about the cap being the Sidereal Exalt's Essence score, except for Martial Arts. I'm inclined to use the 1st ed rules here, but I'm worried that I'm missing some subtlety of the 2nd edition rules.
Major Rewrite Following: **It's supposed to be Essence.** Every other Exalt has their Dice cap rules outlined before the actual charms begin (I checked Solars, Dragon Blooded, and Lunars, but I'm sure the others have them too), but this is missing from the Sidereal book, which leads to the unfortunate: **Excellencies are the only things RAW that are explicitly capped, which I'm pretty sure is an omission**. `Secrets of Future Strife` does indeed double your unmodifier Join Battle roll, which makes the cap for that roll a 20, which bypasses the cap (like several of the charms seem to do). Additionally `Blade of the Battle Maiden` lifts the ban for just that charm, on just martial arts (but it was errata'd so to be less awesome). If you're interested in a review which mentions the frustration you're having: < That said, there's no reason you can't house rule it. **Double Edit** Did some more digging through my books and have come up with the conclusions above.
stackexchange-rpg
{ "answer_score": 4, "question_score": 6, "tags": "exalted" }
Azure VM disk expansion online Can we expand the disks in Azure VM without stopping the VM itself. (online) We are looking for an online method to expand the disk which we are not able to crack. We have certain apps moving to IAAS which at times require disk expansion.
I believe the answer is you cannot. I tried doing so but you get below message on Azure portal which rules out the possibility > Disks can be resized or account type changed only when they are unattached or the owner VM is de-allocated. ![enter image description here]( So you have to either stop the VM or detach the disk, change its size and attach it again. With VM being online it is not possible.
stackexchange-dba
{ "answer_score": 2, "question_score": 0, "tags": "azure vm" }
How do I install collectd write_atsd plugin on RHEL 6? I am using Axibase Time Series Database and I would like to install the collectd write_atsd plugin on RHEL 6? Is there an rpm I can use?
Use the guide provided on the Axibase website to install the write_atsd collectd plugin on RedHat Enterprise Linux 6.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "rhel, rhel6, collectd, axibase" }
PowerShell, Exception-Handling: Create custom logfile from Set-ADUser I'm trying to log errors in a custom logfile while making modifications to users from Active Directory. Here's the code: Get-ADUser -LDAPFilter "(objectCategory=user)" -SearchScope Subtree -SearchBase $searchBase | Set-ADUser -PasswordNeverExpires 0 Is it possible to check, whether the Set-ADUser command was successful for every single user and to write a custom string into a custom logfile, when the command encounteres an error? (e.g. insufficient access rights). Since those errors seem to be non-terminating, I have no idea how to solve this with try/catch.
`enter code here` You could try using the `$error` variable to check if an error happens during each `PasswordNeverExpires` set. $log = "C:\LogFile.txt" Get-ADUser -LDAPFilter "(objectCategory=user)" -SearchScope Subtree -SearchBase $searchBase ` | %{ $error[0] = $null Set-ADUser -PasswordNeverExpires 0 If($error[0] -eq $null){ "User:[" + $_.Name + "] PasswordNeverExpires was set successfully" >> $log } Else{ "User:[" + $_.Name + "] PasswordNeverExpires Failed to be set, Error:" >> $log $error[0] >> $log } }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "powershell, exception, active directory" }
Preconditioning symmetric Schur complement Consider a $2\times 2$ block matrix and a linear system of equations associated to it: \begin{equation} \begin{pmatrix} - A & B \\\ B^t & C \end{pmatrix} \begin{pmatrix} x \\\ y \end{pmatrix} = \begin{pmatrix} \phi \\\ \psi \end{pmatrix} \end{equation} Assume that $A$ and $C$ are symmetric, and symmetric positive semi-definite, and that $A$ is even invertible. One can construct the Schur complement system $(C + B^t A^{-1} B ) y = \psi - B^t A^{-1} \phi$ where $S = C + B^t A^{-1} B$ is symmetric positive-definite, by assumption. How do you precondition such a system in general? I have noted that preconditioners for $S$ are derived from block matrix preconditioners for the original block matrix. Is there a general consensus how such a block matrix preconditioner looks like?
You won't find any black-box scalable solutions because $S$ is typically dense and thus cannot be formed. If your problem comes from a mature research area, there might be experience in the literature demonstrating how to approximate Schur complements. One common technique is to use approximate commutator arguments. There are a quite a few papers on this topic by Elman and others for incompressible flow. You can also see Benzi, Golub, and Liesen, _Numerical Solution of Saddle Point Problems_ (2005) for a (slightly dated) broader review.
stackexchange-scicomp
{ "answer_score": 5, "question_score": 5, "tags": "preconditioning, block decomposition" }
Inject class in custom Field I created a backend configuration for my custom plugin > /app/code/Sostanza/LiveHelp/etc/adminhtml/system.xml < > /app/code/Sostanza/LiveHelp/Block/Button.php < I need to get the value of a saved option and I already have a Helper class where I can read the value I need. I have my helper in > /app/code/Sostanza/LiveHelp/Helper/Data.php < (Max 2 links with my reputation) But if in the Button.php I add Sostanza\LiveHelp\Helper\Data $data The config section doesn't get rendered anymore I tried also to inject other stuff, but it doesn't work. Of course I ran "magento setup:upgrade" and deleted cache/generation folders. Thank you so much
Make your code look like this: protected $_helper; public function __construct( Context $context, \Sostanza\LiveHelp\Helper\Data $helper, array $data = [] ) { $this->_helper = $helper; parent::__construct($context, $data); } And then you can use functions in your helper class like this: $this->_helper->someRandomFunction(); So in general: you need to pass your helper into __construct() method, then you can use it.
stackexchange-magento
{ "answer_score": 0, "question_score": 0, "tags": "magento2, extensions, dependency injection, custom field" }
How many partials need to be continuous to imply differentiability? Let $f:\mathbb{R}^n \to \mathbb{R}$. Let $x_0 \in \mathbb{R}^n$. Assume $n-1$ partials exist in some open ball containing $x_0$ and are continuous at $x_0$, and the remaining $1$ partial is assumed only to exist at $x_0$. A well known result states that this implies $f$ is differentiable at $x_0$. My question is whether or not this can be strengthened. Can we replace "$n-1"$ in the above theorem with some function $g(n)$ "smaller" than $n-1$, and replace "remaining $1$ partial" with "remaining $n-g(n)$ partials"? Feel free to play with assumptions slightly. For instance, you can replace "continuous at $x_0$" with "continuous at $x_0$ and in some open ball containing $x_0$".
For $n = 2$ it is not sufficient to assume that the 2 partial derivatives merely exist. This generalizes to abitrary $n$. Assume we could take $g(n) = n-2$. Consider any function $f : \mathbb{R}^2 \to \mathbb{R}$ and define $F : \mathbb{R}^n \to \mathbb{R}, F(x_1,\ldots,x_n) = f(x_1,x_2)$. We have $\frac{\partial F}{\partial x_i}(\xi^0) = 0$ for $i= 3,\ldots,n$ and could therefore conclude that $F$ is differentiable at $\xi^0$ if the first two partials exist at $\xi^0$. But this would imply that $f$ is differentiable at $(\xi_1^0,\xi_2^0)$ which is not true in general.
stackexchange-math
{ "answer_score": 6, "question_score": 4, "tags": "real analysis, multivariable calculus, partial derivative" }
Why is this not a Lattice? I am having some trouble understanding lattices. The following is defined as **not** being a lattice: $$S = \\{ \\{\\}, \\{y\\}, \\{x\\}, \\{x,y,z\\}, \\{a,x,y,z\\}, \\{b,x,y,z\\} \\}$$ I understand that a lattice is a poset for each exists a unique largest element and a unique smallest element (least upper bound and greatest lower bound). Therefore, is the above not a lattice because we have: $\\{a,x,y,z\\}$ and $\\{b,x,y,z\\}$?
In a lattice, for any $\alpha ,\beta$, $\sup (\alpha ,\beta )$ exists. If your set were to be a lattice, what would be $\sup (\\{a,x,y,z\\},\\{b,x,y,z\\})$? If $\sup (\\{a,x,y,z\\},\\{b,x,y,z\\})$ existed in $S$, then there would exist upperbounds for $\\{\\{a,x,y,z\\},\\{b,x,y,z\\}\\}$, but none exist. Therefore $\sup (\\{a,x,y,z\\},\\{b,x,y,z\\})$ doesn't exist. Hence $(S,\subseteq )$ is not a lattice. It is true that $\varnothing$ is the greatest lower bound for $S$ because it is the _only_ lower bound for $S$.
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "lattice orders" }
Name variable via a loop R I'm currently working on a function that will return distance between a point and p clusters. which_cluster<-function(coord){ cluster<-get_cluster(data) # return a matrix nbr_clusters=nrow(cluster) nbr_dim=ncol(cluster) liste<-c() for(i in 1:nbr_clusters){ dist_c_i=0 for (j in nbr_dim){ paste('vec_', i, sep = '') dim_j_c_i=cluster[i,j] dist_c_i<-dist_c_i+ (dim_j_c_i-coord[i])^2 } dist_c_i<-sqrt(dist_c_i) liste<-liste[,dist_c_i] } return(liste) } I want the "i" and "j" in the variable name to be recognize as the i and j of the for loop. Thank you for your help. Go easy on me, I'm a beginner ;)
Use `assign()` after `paste0()`: assign(paste0("dim_", j, "_c_", i), cluster[i,j])
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 0, "tags": "r, loops, variables, rstudio, cluster analysis" }
Find out when a Google document was shared In Google Docs, is there any way to find out exactly when a document was shared with somebody that I created and shared? This would be useful, at least for me, in finding out exactly when a document was turned in.
If you are trying to find out when you shared a document with other people, AND you notified the recipient by email, then you can search Gmail for your message. In Gmail, search `From:me <title of document>` and it should pull back the email that was sent to the recipient. Body of the message starts with "I've shared an item with you" If you shared a document with someone but **suppressed** the email notification, then I don't think there is a way to determine when it was sent.
stackexchange-webapps
{ "answer_score": 5, "question_score": 8, "tags": "google drive" }
Why 100GB disks getting created when I create cluster When I run `gcloud container clusters create cassandra-cluster` command, I see that three `100GB` disks are getting created when I create the cluster. I suppose these disks are used by `K8s` and `GCP`. For what purposes are these disks used? Isn't 100GB too big? Could/should be changed to optimise cost? gke-cassandra-cluster-default-pool-8ae97f65-4sts Standard persistent disk 100 GB europe-west4-a gke-cassandra-cluster-default-pool-8ae97f65-4sts None gke-cassandra-cluster-default-pool-8ae97f65-hwd3 Standard persistent disk 100 GB europe-west4-a gke-cassandra-cluster-default-pool-8ae97f65-hwd3 None gke-cassandra-cluster-default-pool-8ae97f65-s5lw Standard persistent disk 100 GB europe-west4-a gke-cassandra-cluster-default-pool-8ae97f65-s5lw None
These machines will be used for Kubernetes nodes, 100 GB is the default value as I remembered. Nodes store container logs, docker images, etc. GCP probably take safe size for default because image sizes are high depending on the variety. You could set disk properties while creating. Also, you could create and change your node pool with a proper disk.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "kubernetes" }
デフォルトのキーをマクロで変更するマクロは可能でしょうか? EmEditor < EmEditor1 EmEditor """"1 1 IMEIME2()F5 editor.ExecuteCommandByID(4199); // shell.SendKeys( "~" ); shell.SendKeys( "~" );F51 F5 IMEF5F5
IMEEmEditor
stackexchange-ja_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "emeditor" }
nhibernate, 2 datasources I have been reading about using nHibernate and multiple datasources and I get the multiple session factory piece and making multiple calls to the db. I need to know if I can maintain the "has-a / has-many" relationships in the model if the data resides in different data sources. Is there a way to cascade saves and such? I apologize if this has been covered or if this is ridiculous, just starting to get up and going with this stuff and it would be alot easier if I weren't using a model first approach.
Paco is right on, just can't do it.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "nhibernate" }
Infimum length of curves Let the unit disc $\\{(x,y): r^2=x^2+y^2<1\\}\subset\mathbb R^2$ be equipped with the Riemannian metric $dx^2 +dy^2\over 1-(x^2+y^2)$. Why does it follow that the shortest/infimum length of curves are diameters? I remember doing an optimization course some time ago, but unfortunately all that was learnt has been unlearnt. Or perhaps there is a simpler way?
This can be done with some variational calculus. So, given the metric $$ds^2=\frac{dx^2+dy^2}{1-x^2-y^2}$$ the length of a curve will be given by $$l=\int ds=\int\sqrt{\frac{dx^2+dy^2}{1-x^2-y^2}}.$$ Now, let us parametrize our curve with a parameter $t$ so to have $x=x(t)$ and $y=y(t)$. We will have $$l=\int ds=\int\sqrt{\frac{\dot x^2+\dot y^2}{1-x^2-y^2}}dt$$ being dot a derivative with respect to time. Now, we can do variational calculus and we take the shortest paths as those having $\delta l=0$. This gives the following Lagrange equations $$\frac{d}{dt}\left[\frac{1}{\sqrt{1-x^2-y^2}}\frac{\dot x}{\sqrt{\dot x^2+\dot y^2}}\right]=\frac{x\sqrt{\dot x^2+\dot y^2}}{(1-x^2-y^2)^\frac{3}{2}}$$ $$\frac{d}{dt}\left[\frac{1}{\sqrt{1-x^2-y^2}}\frac{\dot y}{\sqrt{\dot x^2+\dot y^2}}\right]=\frac{y\sqrt{\dot x^2+\dot y^2}}{(1-x^2-y^2)^\frac{3}{2}}.$$ The solution of these equations are straight lines $y=x$.
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "geometry, calculus of variations" }
How to run classic ASP scripts under IIS 5.1 (WinXP Pro) alongside .NET & CF? I'm running into a problem setting up my development environment. I've been working on ColdFusion and .NET applications up until recently I haven't needed to touch IIS. Now, I have to set up a classic ASP application for some one-off work. I added a virtual directory in IIS and pointed it at the actual codebase on my local machine. I then set the security to low (for ISAPI extensions, i.e. ASP) and allowed for script execution. For some reason though, if I hit any .asp page it says the page cannot be found. However, HTML and static files load up just fine. EDIT: URLScan fix seems to have done it. Fired up the app in another browser (i.e. not IE6), and I'm getting better error reporting. Looks like we're missing some includes, but it is executing the scripts. Thanks!
Take a look at your URL scan settings and see if .asp is an allowed file extension On my XP machine the relevant file is located at C:\WINDOWS\system32\inetsrv\urlscan\urlscan.ini
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "iis, asp classic, isapi extension" }
Alternate spelling for ありがたい, or typo? I looked up `` in my dictionaries within OSX (looking at this question), and one of the dictionaries (can't tell which) has the entry listed like this: > ** ** You'll notice that the kanji in the second representation have swapped order. Is/was this an accepted spelling for ``, or is this likely just a typo in this dictionary?
Shogakukan does list the combination with a reading of in one place, in the title of a kabuki play: . Poking around online suggests that this is read as . The reversed kanji order would match Chinese syntax better than Japanese, making me wonder if this is simply a _kanbun_ style of spelling. EDIT: Googling a bit more brought up this OKWave Q&A wherein the "best answer" claims that this is originally the spelling for , changing in meaning over time to be and then used with that reading. However, the etymology for does not seem to have anything to do with , at least according to Shogakukan, and using for seems far too much of a stretch. This goo thread seems to confirm my suspicion, that is simply the _kanbun + kun'yomi_ spelling of , as suggested by their _kanbun_ example of a different word using where the kanji comes first in the spelling, but the reading comes second in the pronunciation.
stackexchange-japanese
{ "answer_score": 7, "question_score": 6, "tags": "kanji, spelling, i adjectives" }
How to run .NET Core console application from the command line I have a .NET Core console application and have run `dotnet publish`. However, I can't figure out how to run the application from the command line. Any hints?
If it's a framework-dependent application (the default), you run it by `dotnet yourapp.dll`. If it's a self-contained application, you run it using `yourapp.exe` on Windows and `./yourapp` on Unix. For more information about the differences between the two app types, see the .NET Core Application Deployment article on .NET documentation.
stackexchange-stackoverflow
{ "answer_score": 335, "question_score": 264, "tags": ".net core, command line, console application" }
calculating average without min value, array I have this array hw_grades=array([[ 57, 77, 81, 99, 100], [ 56, 57, 70, 77, 91], [ 62, 74, 89, 99, 100], [ 21, 42, 53, 61, 65], [ 37, 40, 60, 65, 81], [ 75, 88, 92, 95, 100]]) I want to be able to return the average of each row without the lowest value (I already used `sort()` and so basically I wanna get rid of the first element of each row and then do the average def hw_grade_best(_array): _array.sort() _array[::][1:] result = np.average(_array, axis=1) return result not really much of a code and the `_array[::][1:]` isn't really doing anything cause I can assume by far I am using it wrong input `hw_grade_best(hw_grades)` output I want > array([ 89.25, 73.75, 90.5 , 55.25, 61.5 , 93.75])
You need to slice the array to remove the value, then you can apply the mean function across the axis: `hw_grades[:, 1:].mean(axis=1)` `# array([ 89.25, 73.75, 90.5 , 55.25, 61.5 , 93.75])`
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "python, arrays" }
Removing Java 7 from Mountain Lion Anyone know how to remove Java 7 from Mountain Lion? Installed it, didn't work properly so installed Java 6 and now everything works fine. Want to now get rid of Java 7.
Done it, I kept searching for mountain lion, searched for remove java 7 from mac and it was the same as doing it on mountain lion anyway: < that solved it.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "java, macos, osx mountain lion" }
How to make it difficult to download a video except with player I'm creating a video sharing website like YouTube. I want to make it so that it is difficult to download the videos to your hard drive. I want them to still be able to download the videos into F4Player just like any other video. I am going to make it so that when somneone requests a video using the ID, a PHP script uses the ID to find the real filepath to the video. The PHP script then passes the video, that way no one will find where the video is actually stored. I also have htaccess set up so that no one can hotlink to my images or videos. What else can I do? EDIT: If it was the only way to get what I need I'd be wiling to make my own player in Java instead of using F4layer, but I strongly prefer using F4Player.
Write your own client side browser plugins, that would handle your proprietary encrypted connection to the video stream.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, video, hotlinking" }
Disable windows sbs2008 updates via GPO I have a windows sbs2008 server and i would like to stop widnows updates from being downloaded via a group policy i have managed to fidn the policy then when i clicked update it took me to a different window called gpo management editor and i cannot seem to find the option in there to disable it.
Look under `[Computer/Administrative templates/windows components/Windows Update]`
stackexchange-serverfault
{ "answer_score": 1, "question_score": 0, "tags": "group policy, windows sbs 2008, windows update" }
Add a facebook page in the "via application" link I've developed an android mobile application, which post on Facebook wall. So after giving the post, it shows **"via MyAppName"** under the post. And it shows as a link. If I click it, it shows **The page you requested was not found**. Now I want to add a Facebook page with this link, suppose a publicity page for my app. Or may be a URL of my application link on the Play store. How can I do that? Will my app have any negative effect if I do that! Currently only selected option is **"Native Android App"** under **"Select how your app integrates with Facebook"** on the Facebook developers' site for this app. I've searched a lot, but can't find anything......... Please help....
This usually links to the Canvas URL (dev settings). If you did not set one, you get the error message. So, if you want the link to lead somewhere, just use a canvas URL and redirect to a page. Keep in mind that you need a server with SSL for that, btw.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "facebook, facebook apps" }
Understanding CTAN versions, release dates and announcements I am looking at < where I see that the package version is 1.18 but the most recent announcement in the right sidebar is that of v1.17. I am trying to understand how these things in CTAN work. Was it the case that a new release 1.18 was made but a corresponding announcement was not made and that's why this discrepancy exists? If that's the case, how do I find out the release date of version 1.18?
CTAN do not impose any particular requirements on uploaders. In particular, there is no _requirement_ for an announcement to go with an upload. Thus the latest announcement of a release and the latest release may be different: this is down to the package author. The date you (probably) want is that given by the package author in their release, with will almost certainly match that picked up by LaTeX's `\@ifpackagelater`. This is typically given in the documentation, if the author uses a date at all.
stackexchange-tex
{ "answer_score": 9, "question_score": 7, "tags": "ctan, versions" }
Cumulative values of a column for each group (R) I have a data frame that looks like this : > year<-c(2014,2014,2014,2015,2015,2015,2016,2016,2016) > group<-c("A","B","C","A","B","C","A","B","C") > n<-c(1,1,1,1,2,0,2,1,1) > df<-data.frame(year=year,group=group,n=n) > df year group n 2014 A 1 2014 B 1 2014 C 1 2015 A 1 2015 B 2 2015 C 0 2016 A 2 2016 B 1 2016 C 1 I want to create a column that contains the cumulated values of n for each group to have something like this : year group n sum 2014 A 1 1 2014 B 1 1 2014 C 1 1 2015 A 1 2 2015 B 2 3 2015 C 0 1 2016 A 2 4 2016 B 1 4 2016 C 1 2
We can use one of the group by functions. With `data.table`, convert the 'data.frame' to 'data.table' (`setDT(df1)`, group by 'group', we assign (`:=`) the `cumsum(n)` as the "Sum" column. library(data.table) setDT(df1)[, Sum:= cumsum(n),group] Or with `base R`, we can do this with `ave`. df1$Sum <- with(df1, ave(n, group, FUN=cumsum))
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "r" }
How could I use a module to pass in a react component? so my code is like this.. import { brand, pageAttributes } from './config'; let render = () => { import('../../../../assets/css/themes/dark.scss').then(x => { require('../../AppRenderer'); }); }; render(); basically AppRenderer is a react js file that uses brand, pageAttributes. the trick is I cannot just import my dependencies in AppRenderer since I am dynamically loading the appRenderer file.
Why not import the styles inside `AppRenderer`: import "assets/css/themes/dark.scss" and then use `Suspense`: <Suspense fallback={<div>Loading...</div>}> <AppRenderer /> </Suspense> Unless you are server-side rendering...
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, reactjs" }
Why are consecutive vowels skipped? I have the following JS function that removes vowels from a string and outputs it to console. For input string "quickbrownfox" the function skips consecutive u and i vowels can someone point out the error in logic. function vowels(s) { var arr = [...s]; for (var i = 0; i < arr.length; i++) { var x = arr[i]; switch (x) { case 'a': case 'e': case 'i': case 'o': case 'u': var out = arr.splice(i, 1); console.log(out[0]); } } } vowels("quickbrownfox")
Two characters are all you need to fix this function Change this: var out = arr.splice(i, 1); to this: var out = arr.splice(i--, 1);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, arrays, switch statement" }
Mini Voice Recorder for Arduino I am trying to find a small voice recorder that I can use with my Arduino Micro, and I found this. It is exactly what I am looking for, but it is now a retired product. I googled `ISD1932`, but many other sites are out of stock or not selling it anymore. Is there something of this size that does the same things, and why is it retired?
ISD 1820 voice recorder module for arduino. Or ISD series or ISD 1700 series voice recorder module. Which I think you can still buy these. Will work with 8bit CPU. Or can be interfaced to 8 bit CPU. You could use multiple modules to increase recording times. I can give you more of an answer if you tell me more about your problem. ISD4004 IC can record for 8 minutes.
stackexchange-arduino
{ "answer_score": 1, "question_score": 4, "tags": "sensors, arduino micro, audio, sound" }
Willmore minimizers for genus $\geq 2$ For an immersed closed surface $f: \Sigma \rightarrow \mathbb R^3$ the Willmore functional is defined as $$ \cal W(f) = \int _{\Sigma} \frac{1}{4} |\vec H|^2 d \mu_g, $$ where $\vec H$ is the mean curvature vector in $\mathbb R^3$and $g$ is the induced metric. If $\Sigma$ is closed we have the estimate $$ \cal W(f) \geq 4 \pi $$ with equality only for $f$ parametrizing a round sphere. Recently, the Willmore conjecture was proved (the paper can be found on arxiv), which states that for closed surfaces $\Sigma$ of genus $g \geq 1$ this estimate can be improved: $$ \cal W(f) \geq 2 \pi^2 $$ with equality only for the Cilfford torus. Are there any conjectures about the minimizers in the case of genus $g \geq 2$? And what happens if we consider surfaces immersed in some $\mathbb R^n$ instead of $\mathbb R ^3$?
First of all, by a result of Bauer and Kuwert, there exists a smooth minimizer of the Willmore functional in the class of compact surfaces with fixed genus g, for any g. They have Willmore functional below $8\pi$ and by a result of Kuwert, Li and Schaetzle, the Willmore functional of the minimzers for genus $g$ tends to $8\pi$ when $g$ goes to infinity. Not much more is known about higher genus surfaces, but there is a vague conjecture, that the minimzers are the so called Lawson surface $\xi_{g,1}.$
stackexchange-mathoverflow_net_7z
{ "answer_score": 10, "question_score": 7, "tags": "ap.analysis of pdes, calculus of variations, dg.differential geometry" }
Enabling wildcard subdomains for all domains on cPanel I've hired a new VPS and have root access. Now i want to configure this VPS to my likelings. I know how to enable wildcard subdomains for one host, but i want to do this for **ALL domains** at once on the server. Any idea's? Could something like this work: <VirtualHost *> ServerAlias *.* </VirtualHost> DNS is allready set up.
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/var/www/ ServerName dummy-host.localhost ServerAlias www.dummy-host.localhost ErrorLog "logs/dummy-host.localhost-error.log" CustomLog "logs/dummy-host.localhost-access.log" combined </VirtualHost> This is apache default virtual host. It means **all** requests to server that have not been configured yet, will use this as virtual host. So you need to copy what I wrote. just edit values according to your server config.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "apache, cpanel, httpd.conf" }
How to get branch name in a Github Action Shell script I'm trying to create an output to use later in the job. However, for some reason, the `BRANCH` env variable which I'm getting to be the `GITHUB_REF_NAME` is an empty string, which according to the docs, should be the branch. Also using the variable directly produces the same result. - name: Set Terraform Environment Variable id: set_tf_env env: BRANCH: ${{env.GITHUB_REF_NAME}} run: | if [ "$BRANCH" == "dev" ]; then run: echo "::set-output name=TF_ENV::dev" elif [ "$BRANCH" == "prod" ]; then run: echo "::set-output name=TF_ENV::prod" else echo "Branch has no environment" exit 1 fi
So after a bit of more research and thanks to the comments, I discovered the reason why it wasn't working. It was because I was triggering a GitHub action in a Pull Request, something I failed to mention. So what I ended up using was: github.event.pull_request.head.ref
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "yaml, github actions" }
How to display search results in groups like whatsapp does I have a viewpager with some tabs. I always use the same fragment with a listview to load some String data into the listview. So far, so good. I now want to implement a searchview. And, I want to group the search results like whatsapp does. So the found listview items should be grouped by the tabs they were found in. My question is: Which view does whatsapp use and how can I do so ? Can I keep my simple listview or do I need some other stuff ? I thought about an expandable Listview, could this be a solution ? Unfortunately, SO doesn't allow me to post an WA screenshot at this moment. But I think you know what I mean.
At the end of this day, I can say that my desired Grouping of Searchresults is definitely possible with an Expandable Listview. You can hide the Group indicator and disable collapse so it looks like in whatsapp.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "search, whatsapp" }
convert text with utf8 encoding to SQL SERVER using SSIS I'm trying to find the best way to load a source table from MySQL (with the following column definition: text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL) into SQL SERVER using SSIS. SSIS automatically recommend "Image" data type. However it doesn't suit. Furthermore, in the "preview" dialog i get this data: "System.Byte[]". What's the best way to convert this column in to something more usable utilizing only SQL and MySQL transformations?
Convert to UTF-16 on MySQL. SQL Server NCHAR is UTF-16 so that should work straight away.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql, sql server, ssis" }
DataTables: Automatic width on start-up I am using DataTables for jQuery (< to create a table. I am using JavaScript to populate the table. When it is initially created, the columnn with has some adjustment (some columns are wider than others), but it is not perfect, for example there is a two line row as in the first picture below. After resizing and maximizing again, the table is readjusted to the optimal state, with plenty of room for the row with a long name. How to I get this adjustment directly after I load the table? !enter image description here !enter image description here
Try `columns.adjust()` here you can see how.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, jquery, datatables" }
How should I inherit from a built-in? I want to give a class I made all of the methods that a string has (`replace`, `isupper`, etc.) Below is some example code: >>> class MyClass(str): ... def __init__(self, string): ... self.string = string ... def __str__(self): ... return self.string ... >>> MyClass("aaa").replace("a", "$") '$$$' >>> This works exactly as I want it to. However, I am a little confused on how I should inherit from `str`. I can do as I did above, or: class MyClass(__builtins__.str): ... or even: import types class MyClass(types.__builtins__["str"]): Summed up, my question is: what is the best way to inherit from `str` (or any other built-in for that matter)? Did I give it or is there an even better way I'm not thinking of. Thanks.
**Never touch`__builtins__`.** It is an implementation detail. Quoting the docs for the confusingly similarly-named `__builtin__` module: > CPython implementation detail: Most modules have the name `__builtins__` (note the 's') made available as part of their globals. The value of `__builtins__` is normally either this module or the value of this modules’s **dict** attribute. Since this is an implementation detail, it may not be used by alternate implementations of Python. Just inherit from `str`. There's no reason not to; it's not faster or clearer or anything to use some other name for it.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, class, inheritance, built in" }
Gamma of a Lookback Option From this book, < it states that > The gamma profile of a Max lookback option becomes intuitive when viewing it as a ladder option. Indeed, as long as the stock goes up there will be gamma on the lookback option and the gamma will decrease quickly when the stock goes down, as the options below have already knocked out and therefore have no gamma on them any more. I just cannot see how this is intuitive nor why there will be gamma on the lookback option as long as the stock goes up. What I am missing here? I cant picture how this gamma would change with spot and time, moreover I could not be sure through this explanation above the curves would even be continuous.
In the book of De Weert he approximates the price with a strip of knock-outs. For example the lookback call with fixed strike pays the (max(S) - K)+, is approximated by a strip of knockout calls with a rebate. So whenever the stock sets a new high, another call knocks out and you receive your rebate. In his example the rebates are 1 cent apart. So if the stock moves from $\$45$ to $\$50$, you will have collected $\$5$ in rebates. Anyways: * do you agree that a knock-out call while it is a live is long gamma? * do you agree that a barrier option that is knocked out has no gamma? * do you agree that a barrier option has more gamma when spot is closer to the strike? Assuming you agree with the 3 bullets above. you can see that once the stock goes up and knocks out a few barrier options. and then spot drops, the strip of barriers will have less gamma.
stackexchange-quant
{ "answer_score": 1, "question_score": 2, "tags": "options, volatility, greeks, exotics, gamma" }
MySQL - Hash an entire queryset Let's say I have a query that is run all 15min. I just need to know if the resulting data have been modified since the last fetch. So I though to get a hash from the result to be able to compare. I know how to hash a single record, but I have no idea to do it for multiple records. * Is it a best practice to hash an entire queryset ? * How can I do it ?
TRIGGERs seem to be the closest solution
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "mysql, hash" }
Why don't different output weights break symmetry? My deep learning lecturer told us that if a hidden node has identical input weights to another, then the weights will remain the same over the training/there will be no separation. This is confusing to me, because my expectation was that you should only need the input or output weights to be different. Even if the input nodes are identical, the output weights would affect the backpropagated gradient at the hidden nodes and create divergence. Why isn't this the case?
It is fine if a hidden node has identical initial weights with nodes in a _different_ layer, which is what I assume you mean by output weights. The problem with weight-symmetry arises when nodes within the _same_ layer that are connected to the same inputs with the same activation function are initialized identically. To see this, the output of a node $i$ within a hidden layer is given by $$\alpha_i = \sigma(W_i^{T}x + b) $$ where $\sigma$ is the activation function, $W$ is the weight matrix, $x$ is input, $b$ is bias. If the weights $W_{i}=W_{j}$ are identical for nodes $i,j$ (note that bias is typically initialized to 0), then $\alpha_i = \alpha_j$ and the backpropagation pass will update both nodes identically.
stackexchange-datascience
{ "answer_score": 1, "question_score": 0, "tags": "weight initialization" }
how i can customize the search button in blognegine.net i implemented last time blogengine.net 2.0 many place and they work fine. now when i make a new theme in blogengine.net 2.0 then a problem is come that < how i can customize the search button if i want to make them work.
This post explains it in details.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "search, content management system, blogs, blogengine.net" }
Diluting oil based undercoat I have erected false walls using osb boards on the face of plastered brick wall to accommodate some photo frames and decorative items. Total surface area is 8'×8'. My intention is to paint the osb board using high gloss white paint. This paint requires primer to be painted first. Since osb naturally have tiny holes and voids, i think the primer must be diluted for easy flowing into those voids and gaps. To keep the cost low, can i use petrol (gasoline) for thinning the primer? The paint thinner cost 6 times higher than the petrol in Malaysia. Pls advice.
You should use mineral spirits or mythle-hydride to dilute oil based paints. I don't really think that diluting the primer is the best solution though. It would be best to lay it on thick with a heavily padded roller and then back roll it out. Primers job is to seal and adhere. Thinning it will only prevent it from doing its job.
stackexchange-diy
{ "answer_score": 2, "question_score": 1, "tags": "painting, board" }
how to export app object in express? I init my app object in app.js: var app = express(); var reg = require('./routes/reg'); app.use('/reg',reg); ... ... module.exports = app; and I call app.get() in reg.js: var app = require("../app.js"); ... ... app.get("jwtTokenSecret"); my files are like this in the project: ---app.js ---routes ---reg.js but I found that app is {} in reg.js and the app.get() is not a function, so how to solve it? thanks a lot
You can use `request` object: // inside reg.js: console.log( req.app );
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 5, "tags": "javascript, node.js, express" }
What is the most important properties of programming languages for you? For me it is : **strong type** Wikipedia: > "strong typing" implies that the programming language places severe restrictions on the intermixing that is permitted to occur, preventing the compiling or running of source code which uses data in what is considered to be an invalid way Why it is important? Because **I love compile error much more than runtime error**. I guess it is better to supply some information and some reasons why it is important.
Expressiveness. That is, it makes it easy to express the design and ideas and does not require technical workarounds to make a design work.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 6, "tags": "language agnostic, programming languages" }
What's up with this room being gallery again? > This room is for discussions about Android. This is now a Gallery room, request write permissions and you'll be permanently granted with write permissions as long as you play by the rules. For rules, read pinned messages. So ... what? I'm confused. Does this violate the concepts of the Gallery room, to make it a public club that only certain people can talk in there? <
It is like that because of a certain reason. The reason is quality issues. People constantly jump in and ping everyone in the room with the ever same question. Most of the times they don't even post their question on SO. This issue has been discussed here on meta a few months ago with the result to try the gallery room feature. If you want to know more about that just read my question about it here on meta.
stackexchange-meta
{ "answer_score": 4, "question_score": 3, "tags": "discussion, chat" }
Probability question related with exponential distributed random variable In an infection under treatment with antibiotics, a certain bacterium’s lifetime in hours is described by an exponentially distributed random variable with parameter 0.15. a) What is the probability the bacterium won't survive for 3 hours? b) If the bacterium survives 12 hours, what is the probability the bacterium last 1 hour longer? * * * For part a I know that the density of exponential distribution is $λ\cdot\exp(-λ\cdot x)$. So I should integrate $λ\cdot\exp(-\lambda\cdot x)$ with the lower bound of 0 and upper bound of 3. The calculation ended up being 0.36237.
Sure you _can_ integrate, and you did so correctly, but did you also know what is the _cumulative distribution function_ for an exponential distribution? For $X\sim\mathcal{Exp}(\lambda)$ :$$\mathsf P(0<X\leqslant x) ~=~ 1-\exp(-\lambda x)$$ So for $\lambda=0.15$, $~\mathsf P(0<X\leqslant 3) ~=~ 1-\exp(-0.15\cdot 3) ~\approxeq~0.36237184837822670685625656168778$ So that's the answer to (a), which you got the hard way. The answer to (b) is now a simple application of the definition of conditional probability. (Although, again there is an easier method. Are you aware of the "memoryless" property and what it means?)
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "probability" }
Implementing Concurrency in udp servers Is there any easy way to implement concurrency in udp servers. In TCP we have a connection which can be used to distinguish clients which is not the case in UDP. So is there any other way in which a client can be uniquely identified from another which is trying to connect to the server so that the server can fork a process for each new datagram which is from a new client. Or is there any alternative implementation without using forks
Keep a list of already "connected" clients, and when a new datagram is received then check against this list.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c, udp" }
How come this represents the height of a trapezoid? Why does this formula $$h= \frac{\sqrt{(-a+b+c+d)(a-b+c+d)(a-b+c-d)(a-b-c+d)}}{2|b-a|}$$ represent the height of a trapezoid? Source: < Thanks!
Draw a trapezoid with bases $a$ and $c$, so that the other two sides are $b$ and $d$. Divide your trapezoid into two right triangles (each of which has a side being $h$) and a rectangle by dropping perpendiculars from $a$ to $c$ in appropriate places. Now place the triangles side by side so they share the side $h$. The base of this triangle is $a-c$ and its other two sides are $b$ and $d$. Now write down the area of this triangle in two different ways. First $A=\frac{1}{2}(a-c)h$, and second using Heron's formula. This gives the desired relationship between $a,b,c,d$ and $h$.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "geometry" }
New Navigation z-index issue Please have a look at the following image of SO captured. Browser is Google Chrome. !alt Search bar and new nav down arrow with a dropdown menu is overlapping everything. It should have a low z-index I guess. !alt Have a look at an another snippet. !alt Below are the steps to reproduce the issue: 1. First click on achievements or inbox. !alt 2. Now click on little down arrow. !alt 3. Now write java tag in filter box. !alt
Given this is caused by a Chrome plugin, we are not in a position to fix it.
stackexchange-meta_stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "bug, status declined, new nav" }
If $X$ is a Banach space what is $X^*$? I came across this notation today and I was wondering if the notation $X^*$ means that it is the dual space of $X$ where $X$ is a Banach space. I know that $^*$ is used for dual spaces of vector spaces but I do not know if the same is meant for Banach spaces without any other special properties. Thanks
As Hellen pointed out in the comments, $X^*$ consists of continuous or equivalently bounded linear functionals on $X$ with the induced norm: $$ \lVert f \rVert = \sup_{\lVert x \rVert \le 1} |f(x)|. $$ $X^*$ is again a Banach space (i.e. complete).
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "notation, banach spaces" }
Angular Image Path This question is from the open source project. All images are stored in assets folder and the file is located in app/customer folder from where the code to load images is specified. The code is - <img src="assets//images/{{customer.gender | lowercase}}.png" class="details-image" alt=""> The folder structure is - -app -customer -fileLocation -assets -images -image1.png The images load properly. My question is - 'How the images are loading even the files are located at different levels? I cannot see the settings anywhere.
if you are using angular6 you are customize your assets in angular.json file for angular4/5 you can .angular-cli.json ![enter image description here]( In the screenshot you can see the path hierarchy for assets. * * * Also when you build your project `ng build`, then from the generated `dist` folder you can see the assets folder path relation to `index.html` file ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "angular, path, assets" }
Meaning of 'sentirsi' in this context I'm reading Italo Calvino's _Fiabe italiane_. First story is about the fearless Giovannino. Giovannino goes out travelling the world, comes to an inn and asks for lodging. > "Qui posto non ce n'è", disse il padrone, "ma se non hai paura, ti mando in un palazzo". > > "Perché dovrei aver paura?" > > "Perché ci si sente, e nessuno ne è potuto uscire altro che morto." Now, 'sentirsi' here must mean 'to be haunted', because that's what the whole story is about. But then, why does neither Collins nor Oxford dictionaries list this as a meaning?
The meaning is the one you guessed, as documented by Charo. Consider that it's definitely not a common usage at the point that it in many editions of this story you'll find it in italic. Just one correction: I wouldn't consider this a voice of _sentirsi_ , but rather of _sentirci_ (to hear _there_ [spirits?]) with a _si impersonale_.
stackexchange-italian
{ "answer_score": 5, "question_score": 4, "tags": "word meaning" }
Difference between 武器 and 兵器 Can someone explain me the difference in nuance of these words? Both of them mean "weapon", but while I was reading the manga where I got these words from, most of the characters used and then there's just one character that used . I also want to mention that the furigana for was and not . I found a similar question on a Japanese site but I couldn't understand very well...
means generally "weapons which are as little as you can hold like swords or guns. means generally "weapons for war which are big like tanks or fighter aircrafts" and is used for generic name of weapons of war like (chemical weapon). We call adding different furigana for a kanji . In this case, the author willfully made this . We commonly don't read . I am not sure about the author's intention but he might describe it as between and .
stackexchange-japanese
{ "answer_score": 4, "question_score": 2, "tags": "word choice" }
GWT code-splitting not triggering AJAX request I am trying to find out how code-splitting works in GWT. For this, I am following the example they have provided at < It works as expected, in the 2nd case with the `RunAsyncCallback`, the string **Hello, AJAX** is not visible in the `cache.html` files. But when running in development mode, when I click the button, I don't see any Ajax request being fired in Firebug even though the alert shows just fine. So it means that the content is present somewhere around (perhaps in the `cache.js` files), it is _not_ fetched from the server on the fly. If so, then what is the point of code-splitting?
The requests are only fired in compiled mode. In development mode, the GWT browser plugin takes over, and forwards the calls to the code server. In compiled mode, it's all there as you would expect it. Just have a look at the directory war/ _mymodulename_ /deferredjs/
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "java, ajax, gwt" }
idiom - come to a rumbling halt I would like ask you foe help with meaning for "come to rumbling halt". Is the same meaning as "to come to a grinding halt"? The context is that the pumps stopped working - and the full sentence is - Pumps came to a rumbling halt. Thank you very much
'Come to rumbling halt' means to stop suddenly with a deep resonant sound. For sample reference, in 'The Alchemy of Murder' by Carol Mcleary uses the same words as : "The snoring comes to a rumbling halt and the man's eyes flutter open." Reference: It doesn't sound like an idiom. Thank you friend for the question.
stackexchange-english
{ "answer_score": 0, "question_score": 0, "tags": "idioms, idiom meaning" }
Getting Table Lock (MyIsam) using Nhibernate Using Nhibernate how can I get "TABLE LOCKS" What I'd like to do is somwthing like this: TABLE LOCKS table1; update counter= 1 + counter from table1 where id=1; select counter from table1 where id=1; UNLOCK TABLES;
Just run this before your query: var command = session.Connection.CreateCommand(); command.CommandText = "TABLE LOCKS table1"; command.ExecuteNonQuery(); And the corresponding UNLOCK afterwards.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, mysql, nhibernate" }
How do I add behaviour to my Azure API (e.g. connect it to my back-end)? I created an API in Azure portal, and it has a "product", whatever that means... Now how do I connect it to a back-end to add functionality? I've seen many videos and tutorials (Channel 9 and others), and they all explain how to manage the API and so on. I couldn't find any tutorial/explanation how to add actual functionality, so I suspect that I may not grasp this whole subject correctly...
You connect your own API to the Azure API in the "add API" dialog in Azure. See < => Create an API There is an input field "Web service URL". This is the url to your real api. Azure API is only a wrapper which adds additional functionality to your API.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "azure, azure api management" }
How can I get an array of the indexes from another array that has been sorted? I want to sort an array by its objets and then get the indexes like so: NSMutableArray *myArray = [[NSMutableArray alloc] initWithObjects: @"3", @"2", @"1", @"0", @"1", @"2", nil]; I want the indexes of the objects in ascending order. Here, because the lowest value has an index of 3, the indexes would be would be: 3, 2, 4, 1, 5, 0 or something like that. Any ideas? Thanks!
Here's what I ended up doing: //Create a mutable array of the indexes in the myArray (just a list from 0...n) NSMutableArray *indexes = [[NSMutableArray alloc] init]; for (int i = 0; i < myArray.count; i++){ [indexes addObject: [NSNumber numberWithInteger:i]]; } //Create a dictionary with myArray as the objects and the indexes as the keys NSDictionary *tempDictionary = [NSDictionary dictionaryWithObjects:myArray forKeys:indexes]; //Create an array of myArray's keys, in the order they would be in if they were sorted by the values NSArray *sorted = [tempDictionary keysSortedByValueUsingSelector: @selector(compare:)];
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "iphone, objective c, nsarray" }
Beer fermenting too cold? My first brew is currently fermenting on its 6th day. I just checked the temperature and it was quite a bit lower than what I initially thought. The temperature in the room is 12'C (54'F) and the brew had almost the same temperature. I just did a test with my hydrometer and it measured to 1020, which translates to around 1019 with temperature adjustments. I have used the White Labs WLP001 California Ale Yeast. Is this brew spilled or can I do anything to save it?
You should try to raise the temperature of the beer back up to around 68F/20C, and give it a gentle shake to try to get the yeast resuspended. Note that you will see airlock activity - this doesn't necessarily mean fermentation has started, but that the higher temperature is causing the gas in the headspace to expand and exit the airlock. Leave it for another 3-5 days and then check the gravity to see if fermentation started. With any luck, it should be complete and you hit FG.
stackexchange-homebrew
{ "answer_score": 1, "question_score": 0, "tags": "fermentation, fermentation temperature" }
flink evictors and eager window functions i am confused about the relation between flink evictors and eagerly evaluated window functions such as `AggregateFunction` and `ReduceFunction`, From the flink doc: (< > The evictor has the ability to remove elements from a window after the trigger fires and before and/or after the window function is applied sounds like the evictor is NOT eager, then what's the behavior of using an evictor with an `AggregateFunction`? Is there a moment in time when all the elements are assigned in the window in RAM? Thanks
> Attention Specifying an evictor prevents any pre-aggregation, as all the elements of a window have to be passed to the evictor before applying the computation. i missed this line of flink .
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "apache flink, flink streaming" }
Drawing a D3.js cluster with the smallest possible height Is there a way to dynamically set the height of a D3.js cluster so that it will have the smallest height possible (i.e. the smallest height before the edges of the dendrogram begin to get cut off or nodes start overlapping)?
This thread on the D3.js Google Group finally answered the question for me. I also changed my cluster to a tree. Hope this helps someone else with the same problem!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "d3.js, hierarchy, dendrogram" }
SO tags not appending to URL when clicking on it I was checking the **Unanswered section** in SO. Then I clicked **java** tag to get Java related questions. The url was **< Then I clicked on **javascript** tag. The URL became ** This happened today only. Yesterday and all when I click another tag, the URL would append the tag. ie, ** Why its happening? Earlier was easy. Now for more tags, we need to type URL, instead of clicking each tag?
Thanks for pointing it out. Fixed in build 2013.8.21.1365 (meta) and 2013.8.21.959 (sites).
stackexchange-meta
{ "answer_score": 2, "question_score": 3, "tags": "bug, status completed, stack overflow, tags" }
Google Cloud SQL Instance Error IP Address I am currently trying to Assign another IP Adress to my Google Cloud SQL Instance, in order to remotely connect to my database. However I keep getting the error "Your changes could not be saved". I attempted to add the IP Adress from both the Edit option as well as the Access Control tab.
A big Thank You goes out to the Google Cloud team for helping us find our error. Someone on our team had put an improperly formatted IP address in the Authorized Network settings. This caused the instance settings to freeze up on us, which kept the instance from being edited within the Developer Console. By removing it, it solved our problem.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "google cloud storage, google cloud platform" }
Mouseover on dropdown showing tooltip of the selected text I have 5 dropdown lists and I want to have a tooltip on each of them such that when a user hovers their mouse over any dropdown list, there is a tooltip that appears to show the selected text. <select name="dropdn" class="mydpdn"> <option>Loading...</option> </select> I am trying to use `jquery.dimensions.js` and `jquery.tooltip.js`. Can anyone give me an example please.
Something like this might work: $("select").tooltip({ left: 25, bodyHandler: function(){ return $('.mydpdn').attr('title'); } }); $('.mydpdn').bind('change', function(e){ var newTitle=''; $(".mydpdn option:selected").each(function () { newTitle+= $(this).text() + " "; }); $(this).attr('title', newTitle); }); $('.mydpdn').trigger('change'); Hope it helps
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "jquery" }
What "ladder sub {...}" means in perl? I'm reading tweetylicious source from github to study Mojolicious framework: However I'm confused by below piece of code `ladder sub ...`. What does it mean in Perl? It looks like not a regular Perl grammar. Btw, I'm with Strawberry Perl 5. # The rest of the routes are specific to logged in users, so we # add a ladder to make sure (instead of making sure inside each route) ladder sub { my $self = shift; return 1 if $self->session('name'); $self->redirect_to('/login') and return; };
It is a call to a subroutine called `ladder` that expects a code reference as its first argument. It is equivalent to $tmpfunc = sub { my $self = shift; return 1 if $self->session('name'); $self->redirect_to('/login') and return; }; ladder($tmpfunc);
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 7, "tags": "perl, mojolicious" }
Nodejs alternatives to PHP's DOM and XPath Is there good alternatives to PHP's DOM and XPath in Node? I had a look around and it seems DOM and XPath is there and can be installed via NPM package manager but wasn't sure if they are correct ones to be used for parsing HTML and XML?
About XPath I'm not sure, but for HTML, you can surely use cheerio: var cheerio = require("cheerio"); var $ = cheerio.load(theHTML); if ($(".my-class").is("#my-id")) { console.log("Yay, this element was found!"); } It has the same syntax as jQuery - so, if you do already know how to jQuery, you'll know how to use cheerio. As a bonus, cheerio works on Windows. JSDOM, which is the base for a lot of others HTML/XML parsers, doesn't.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, node.js, dom, xpath" }
Something wrong with Chat room? Recently just got one chat room invite < when i go inside nothing in. I don't know what's wrong. It's just show me room info and one message and also i can't send message in chat room. what's wrong here? ![enter image description here](
You're looking at a transcript. Click the `join this room` button under the calendar icon. This will redirect you to the actual room: <
stackexchange-meta_stackoverflow
{ "answer_score": 6, "question_score": -5, "tags": "discussion, chat" }
Stopping Distance (frictionless) Assuming I have a body travelling in space at a rate of $1000~\text{m/s}$. Let's also assume my maximum deceleration speed is $10~\text{m/s}^2$. How can I calculate the minimum stopping distance of the body? All the formulas I can find seem to require either time or distance, but not one or the other.
If the speed is $1000 m/s$ and the deceleration is $10 m/s^2$, it will take $100 s$ to stop. The average speed in that time is $500 m/s$, so the distance traveled is $$500m/s*100s = 5*10^4m$$ Working through the same logic with an initial speed $v$ and a deceleration $a$, the final distance $d$ traveled before stopping is $$d = v_{avg}*t = (v/2)*(v/a) = \frac{v^2}{2a}$$ This formula becomes more interesting when you learn a bit more physics because it's simple example of the work-energy theorem).
stackexchange-physics
{ "answer_score": 14, "question_score": 4, "tags": "kinematics, acceleration" }
How to convert manualy hexadecimal to decimal with Two's Complement I cant seem to find answer about how to convert hexadecimal to decimal with Two's Complement example AD100002 i already know how to do the calculation for unsigned but not for signed 2's complement. Any help will do or exampe) (thank's for your time) (Sorry for bad english). {unsigned} ->(AD100002 = (10 × 16⁷) + (13 × 16⁶) + (1 × 16⁵) + (0 × 16⁴) + (0 × 16³) + (0 × 16²) + (0 × 16¹) + (2 × 16⁰) = 2903506946).
The basic explanation of two's complement on a binary/hex value is to flip every digit and then add 1. For example, say we had the following value: 0xA5 The first thing to do is convert the value to a binary number: 0xA5 -> 10100101 To perform two's complement, flip all the bits: 10100101 || \/ 01011010 and then add 1: 01011011 Converting this binary number to a decimal number yields 91. Therefore, the two's compliment of the hex value "0xA5" is -91. (If you're treating the hex value as a signed bit representation of an integer, only perform the two's complement if the most-significant bit in the binary representation is 1. If it's 0, treat the rest of the bits as normal.)
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "hex, decimal" }
Reading BSD500 groundTruth with scipy I am trying to load using scipy `loadmat` a ground truth file, it return numpy ndarray of type object (`dtype='O'`). From that object I arrive to access to each element that are also ndarrays but I am struggling from that point to access to either the segmentation or the boundaries image. I would like a to transform this a list of list of ndarray of numerical types how can I do that ? Thanks in advance for any help
I found a way to fix my issue. I do not think it is optimal but it works. def load_bsd_gt(filename): gt = loadmat(filename) gt = gt['groundTruth'] cols = gt.shape[1] what = ['Segmentation','Boundaries'] ret = list() for i in range(cols): j=0 tmp = list() for w in what: tmp.append(gt[0][j][w][0][0][:]) j+=1 ret.append(tmp) return ret If someone have a better way to do it please feel free to add a comment or an answer.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, numpy, file io, scipy" }
why the RES memory is changed for same code when different JVM XMX be setted I use the datastax driver to create NIO connections with Cassandra without do any other thing but just keep connection. What's more, when I set the XMX to 1G, the RES(from top -p [java pid]) will occupied about 400M memory, but when I set the XMX to 512M, the RES will only occupied about 200M memory, How to understand it? from my opinion, my code do the same thing, why occupied different memory? Cluster build = Cluster.builder().addContactPoint("10.224.57.163").withAuthProvider(new PlainTextAuthProvider("fujian","pass")).withLoadBalancingPolicy(new DCAwareRoundRobinPolicy("DC1")).build(); Session connect = build.connect("demo");
There are two factors in play 1. java does not release managed heap memory eagerly. If you give it more room it may use that to run GCs less often (saves CPU cycles) 2. NIO might be using off-heap memory (`DirectByteBuffer`) which is not released until the Buffers holding onto the memory are GCed. Thus GCs running less frequently might not only occupy more of the managed heap but also release off-heap memory later and thus incur additional garbage. You can try `-XX:MaxHeapFreeRatio=30 -XX:MinHeapFreeRatio=20` to constrain the actual heap size closer to the actual occupancy, i.e. to release memory sooner.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "java, memory, jvm" }
how to link to detail page(single.php?) in a wp_loop I have made wp_query like below. This is some part of them. And it works. $args = .....; $query = new WP_Query($args); while($query->have_posts() ) : $query->the_post(); ?> <div class="each"> <h4><?php the_title(); ?> </h4> </div> <?php endwhile; wp_reset_query(); ?> This shows like this. <div>title 1</div> <div>title 2</div> <div>title 3</div> ... At this point, when I click one of the titles, it needs to link to the details of the clicked post. But I don''t know how to link to the detail page. I think it should be linked to 'single.php'. is this right? and how to link to that detail page(maybe singles.php)? thank you.
Replace with below code : <?php $args = .....; $query = new WP_Query($args); while($query->have_posts() ) : $query->the_post(); ?> <div class="each"> <h4><a href="<?php the_permalink();?>" title="<?php the_title_attribute();?>"><?php the_title();?></a></h4> </div> <?php endwhile; wp_reset_query(); ?>
stackexchange-wordpress
{ "answer_score": 1, "question_score": 1, "tags": "wp query" }
How to wrap _app.js within multiple providers? I was wondering if it's possible and how to wrap my top level page `_app.js` within Redux provider considered I already wrapped it with Next-auth provider like: import React from "react" import { Provider } from 'next-auth/client' import '../public/global.scss' export default function App ({ Component, pageProps }) { return ( <Provider options={{ clientMaxAge: 0, keepAlive: 5 * 60 }} session={pageProps.session} > <Component {...pageProps} /> </Provider> ) } The issue is that when I try to add also Redux `<Provider ..` it says `Provider` is already defined.
You can rename the redux provider named import using `as`. import React from "react" import { Provider as NextAuthProvider } from 'next-auth/client' import { Provider as ReduxProvider } from 'react-redux' import '../public/global.scss' export default function App ({ Component, pageProps }) { return ( <ReduxProvider> <NextAuthProvider options={{ clientMaxAge: 0, keepAlive: 5 * 60 }} session={pageProps.session} > <Component {...pageProps} /> </NextAuthProvider> </ReduxProvider> ) }
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 3, "tags": "javascript, reactjs, redux, next.js, next auth" }