INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Frog jumping on leaves $N$ leaves are arranged round a circle. A frog is sitting on first leaf and starts jumping every $K$ leaves. How many leaves can be reached by a frog?
A couple of hints to get you started: recall Bezout's identity and think about the greatest common divisor of $N$ and $K$. Full solution: Let $d$ be the greatest common factor of $N$ and $K$. Label the vertices $0,1,2\dots N-1$. Then the from starts at position $0$ and then jumps $K$ spaces to reach the position congruent to $K\bmod N$ and then it reaches the position congruent to $2K\bmod N$ and so on. So the frog can reach the posistions of the form $sK\bmod N$. So every position it can reach is a multiple of the greatest common factor of $N$ and $K$. because of bezout's identity there exists $s$ and $t$ so that $sK+tN=d$ in other words $sK\equiv d\bmod N$ and so after $s$ steps we reach position $d$, from here it is clear we can reach position $2d$ after $2s$ steps, $3d$ after $3s$ steps and so on up to position $N-d$ and finally position $0$. So we can reach $\frac{N}{d}$ positions.
stackexchange-math
{ "answer_score": 5, "question_score": 2, "tags": "number theory" }
Selenium test if CSS class is present I am selecting this item in Selenium like so: filter_panel = self.browser.find_element_by_class_name('panel-filters') filter_onair = filter_panel.find_element_by_css_selector("div.form-group.mod-toggle.js-onair[data-toggle='tooltip'][data-placement='top']") But How do I test in Selenium if this item has the class `disabled`?
You can try assert 'disabled' in filter_onair.get_attribute('class').split() or you can try to extend CSS selector with `.disabled`: filter_onair = filter_panel.find_element_by_css_selector("div.form-group.mod-toggle.js-onair.disabled[data-toggle='tooltip'][data-placement='top']") If you get `NoSuchElementException` then there is no element by required selector that contain `"disabled"` class name
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "python, selenium, testing, selenium webdriver, css selectors" }
Mathematica wrong about discontinuity? This question is about whether the following function $$F(a):=\int_{\mathbb{R}} e^{-\frac{(x-a)^2}{2}} \log(\left\lvert x \right\rvert ) dx$$ is continuous? My guess was that this function should be everywhere continuous by the dominated convergence theorem, that is: If $a_n \rightarrow a$ then also $F(a_n )\rightarrow F(a).$ However, Mathematica seems to show that there is a discontiuity roughly at -59. How is that possible? ![see the Mathematica plot below]( To create this plot, I used the command Plot[NIntegrate[E^(-(x - a)^2/2)*Log[Abs[x]], {x, -\[Infinity], \[Infinity]}], {a, -60, -57}]
Split your integral into $\int_{-\infty}^0+\int_0^\infty$ and substitute $x:=-x'$ in the first integral. You then obtain $$F(a)=2e^{-a^2/2}\int_0^\infty \cosh(ax)\>e^{-x^2/2}\>\log x\>dx\ ,$$ whereby the resulting integral has a mild singularity at $x=0$. Writing $\cosh(ax)=1+2\sin^2{ax\over2}$ you can move this singularity into a first integral which does not depend on $a$: $$F(a)=2e^{-a^2/2}\left(\int_0^\infty e^{-x^2/2}\>\log x\>dx+2\int_0^\infty\bigl(\sinh^2{ax\over2}\log x\bigr)\>e^{-x^2/2}\>dx\right)\ .$$ The function $F$ turns out to be an even function of $a$ which is as smooth as you like.
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "real analysis, integration, analysis, measure theory" }
view cant become a first responder I have a view controller. It is pushed by another's `UINavigationController`. In ViewController.m: - (BOOL)canBecomeFirstResponder { return YES; } - (void)viewDidAppear:(BOOL)animated { [self.view becomeFirstResponder]; NSLog(@"%d", [self.view isFirstResponder]); [super viewDidAppear:animated]; } It's always 0. Why?
Your view has to accept first responder status. This is implemented in your _view's_ subclass code, you have to override `canBecomeFirstResponder`and return YES: - (BOOL)canBecomeFirstResponder { return YES; }
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "ios, first responder" }
Month view calendar iphone app control for iOS I am on the lookout for calendar control for my iPad app that behaves and looks like the calendar iPhone app when its in month view. Is anyone aware of any controls that are available?
Tapku has a nice calendar control
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 13, "tags": "iphone, objective c, cocoa touch" }
How to check if member has role discord.py I want to make a "warn" command and I want to check if member has role. My code: async def пред(ctx, member: discord.Member = None, *, reason=None): р.Персонал=discord.utils.find(lambda r: r.id == '701381413215141948', ctx.message.server.roles) if р.Персонал not in member.roles: print("You don't have role") return else: print('Success') Error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Att ributeError: 'Message' object has no attribute 'server'
The issue as `InsertChessyLine` it should be `ctx.guild.roles` instead of `ctx.message.server.roles` async def пред(ctx, member: discord.Member = None, *, reason=None): р.Персонал=discord.utils.find(lambda r: r.id == '701381413215141948', ctx.guild.roles) if р.Персонал not in member.roles: print("You don't have role") return else: print('Success')
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, discord.py" }
NGX countdown timer not counting down accurately for 'leftTime' parameter is greater than 24 hrs For the below `leftTime` configuration, if i pass value greater than `864000`, timer value is not starting from a value greater than 24 hrs. <countdown [config]="{leftTime: `864000`}"></countdown> Ex: 1. If leftTime: `864000`, Timer counts down from `24:00:00` 2. If leftTime: `900000`, Timer counts down from `10:00:00` What should i do obtain accurate timer start hrs if i pass seconds value greater than `864000` to `leftTime` parameter?
Try the below statement :- <countdown [config]="{ leftTime: 864000, format: 'd:HH:m:s' }"></countdown>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, angular, npm, countdown" }
Tomcat 6 in Windows 7 I am having problem with Tomcat 6.0 in Windows 7. I installed it to work with EasyEclipse Server Java and changed it's configuration to Manual. But now when I try to Configure Tomcat, I get " Access is denied Unable to open the service 'Tomcat6' ". Also now when I start and stop Tomcat within EasyEclipse I get the following error: > C:\Program Files\Apache Software Foundation\Tomcat 6.0\work\Catalina\localhost_\SESSIONS.ser (Access is denied) Please help me with this Thanks
You don't have write permissions on `C:\Program Files\Apache Software Foundation\Tomcat 6.0\` Change the permissions on that directory, or install Tomcat somewhere else, where you do have permissions.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 10, "tags": "windows 7, tomcat6" }
What are some differences between the French spoken in l'Afrique Noire and the French spoken in France? I am a Spanish speaker, and last week I traveled abroad to a summer camp where I met people of different nationalities, among them several hispanophones. There were several words specific to each of our countries, and I was wondering (because I am interested in French) what are some words that countries like Senegal or Côte d'Ivoire use that are not used in France?
J'ai passé deux ans au Cameroun et ils ont beaucoup d'expressions (plutôt que des mots) qui sont peu comprises en France. J'en ai citée quelques'unes ci-dessous : > **C'est comment** ? = Comment ça va ? > > Mon téléphone est **gâté**. = Mon téléphone est en panne. > > **Assiah** ! = Je suis désolé pour toi. > > **On est ensemble**. = Au revoir. > > Je t'attends **dePUIS** ! = Ca fait longtemps que je t'attends ! > > On a mangé **jusqu'ààààà** ! = On a beaucoup mangé ! > > **C'est que même quoi ça ? / C'est quoi même** ? = Qu'est-ce que c'est que ça ? > > **Mouf** !!! (très vulgaire)= Va t'en / Casse-toi !!! > > Pardon, **massa** ! = Pardon, monsieur ! Au République du Congo, où j'ai aussi vécu, il existe moins d'expressions et de mots uniques (du moins en français) à leur pays puisque la plupart des gens se parlent (hors l'école) en une autre langue: le kikongo, lingala, ou lari, par exemple.
stackexchange-french
{ "answer_score": 5, "question_score": 1, "tags": "régionalismes, afrique" }
Propensity Score for observations in RCT study In theory what would the $e_i$ (propensity scores) be, for $n_i$ observations already randomized into various treatment groups ? I know $e_i$ (propensity scores) are calculated for $n_i$ observations in observation studies and RCT studies are assumed to be already randomized. However I like to know what would be the hypothetical $e_i$ (propensity scores) values for observations in studies that already randomize patients into various treatment groups ? Could the propensity score values for everybody in an already randomized study would be 1 ?
"Propensity may be defined as an individual's probability of being treated with the intervention of interest given the complete set of all information about that individual." According to this definition, the propensity is the probability that patient being randomized to the treatment patient received, and generally it is 1/k, where k is # of treatment arms in that RCT.
stackexchange-stats
{ "answer_score": 1, "question_score": 0, "tags": "propensity scores, clinical trials" }
Is there any API to support creating a new question on stackoverflow? I know there is api for stackoverflow. It looks like the APIs are read-only, supporting the Get/Search operation. Is there any API to support creating a new question on stackoverflow?
No, the official APIs do not contain support for asking new questions. They do not currently contain support for anything write related (ie, edits, answers, tagging, users, etc) at all.
stackexchange-stackapps
{ "answer_score": 2, "question_score": 0, "tags": "support, api v2" }
Entity Framework And Business Objects I have never used the entity framework before and i would like to try some personal projects implementing it to get my feet wet. I see that entities can be exposed to the presentation layer. But i don't want certain fields exposed, fields like modified dates and created dates and various other database fields. how could i implement Business objects and just expose the properties i need but still keep the objects serializable? Also what advantages does this have over LinqToSql?
When you define an entity in the EDMX model you can specify the visibility of each property's setter and getter, so if you don't want the ModifiedDate to be visible in other layers, you can simply specify it as internal. !enter image description here If your requirements are more complicated like the ModifiedDate should be accessible in the entities assembly and the business logic assembly but not in the UI assembly, then you need to create another object which will be exchanged between the business logic and the UI logic layers.
stackexchange-stackoverflow
{ "answer_score": 22, "question_score": 10, "tags": "c#, entity framework, business logic layer" }
How do I configure the Chain ID of a new EOS Chain? I'm trying to create two EOS chains - I am under the impression that each chain should have a unique `chain_id`, but when I start them, they both come up with the same `chain_id` (checked via `cleos get info`) I checked the config.ini and didn't see anything that indicated how to do it. How do I set the Chain ID to something else?
`chain_id` is a hash of the fields in `genesis.json`. Change any field to get a different id.
stackexchange-eosio
{ "answer_score": 4, "question_score": 2, "tags": "nodeos" }
Replace part of email body from combo-box I want to replace a just part of body from an email with a value selected from a drop-list. Any help is welcomed. Private Sub UserForm_Initialize() With ComboBox1 .AddItem "Subject 1" .AddItem "Subject 2" .AddItem "Subject 3" End With End Sub Private Sub CommandButton1_Click() lstNo = ComboBox1.ListIndex Unload Me End Sub
If you have the mail open this replaces "Test" in the body. Private Sub CommandButton1_Click() Dim curritem As mailItem Set curritem = ActiveInspector.currentItem curritem.Body = Replace(curritem.Body, "Test", ComboBox1.Value) ' or ' curritem.HTMLBody = Replace(curritem.HTMLBody, "Test", ComboBox1.Value) Set curritem = Nothing Unload Me End Sub
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "vba, outlook, combobox" }
How do Remote Procedure Calls relate to Web Services? So here is the question how are Remote Procedure Calls (RPC) related to Web Services? Cheers, J
They both allow for interprocess communication. XML-RPC is a kind of RPC that is even closer to web services as it allows for interoperable communication between disparate environments over the HTTP protocol.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "web services, terminology, rpc" }
Stagnation Point around Sharp Corner I am trying to design a water-channel that travels through a metal block shaped like a square to cool it down (so it is a 2D problem). One consideration is the wetted surface area, which allows more of the water to be in contact with the metal, thus increasing the cooling effect. One way to do that is to start at one corner of the square, then form multiple S-shapes on the block to maximize the surface area. However, there will be some sharp U-turns. I am trying to avoid stagnation points, which slows down the cooling since less fluid travels. So I did some reading on sharp turns and the term **Kutta Condition** keeps appearing when describing fluids at sharp points, where there will be a stagnation point at the edge. So I'm wondering, if I understand it correctly, that is, I should not have any sharp bends or else there will be a stagnation point near(or at) the edge?
Yes, sharp bends cause stagnation points, which would reduce heat transfer. More importantly they would increase the resistance to flow, requiring either more pressure to drive the flow or reducing the flow, and thereby reducing the overall heat transfer. If the pump could handle the additional pressure, then it would be better utilized by reducing the channel size which would decrease boundary layer thickness, increasing heat transfer.
stackexchange-physics
{ "answer_score": 2, "question_score": 1, "tags": "newtonian mechanics, fluid dynamics" }
Changing C to MIPS and bitwise or b = 25 | a; Assume that a corresponds to register $t0 and b corresponds to register $t1.? Can anyone explain how to approach this and can give me the final answer so I can compare with mine after I do it?
I suppose you mean `ori $t1, $t0, 25`? That would be the equivalent. You can find tons of references about MIPS with a Google search. A good example would be this MIPS instruction reference.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -7, "tags": "c, mips" }
How do I mock parameters and tagdata when using testee? I've gotten as far as getting a tag to run with it's default parameters, but I have no clue on how to fake the passing of parameters and tagdata. I've checked the documentation for testee and munged a bit through it's own tests. I realize it is an unsupported addon as the author has moved away from ExpressionEngine, but that is why I am asking here. Here's a working test so far: public function test__returns_zero_with_default_attributes() { $result = $this->_subject->modulo(); $this->assertEqual($result, 0); }
Turns out it works this way: $this->_subject->EE->TMPL->returns('fetch_param', 11, array('numerator', '1')); This says when the mock EE object receives a call to fetch_param with the arguments 'numerator' and '1' (`$this->EE->fetch_param('numerator', '1')` in the plugin code) return the value 11. Similar can be done for the tagdata property: $this->_subject->EE->tagdata = 'This is text simulating the contents of a tag pair'; Voila! Now you can test module and plugin tags.
stackexchange-expressionengine
{ "answer_score": 1, "question_score": 2, "tags": "ee2, add on development" }
Cancelling requestAnimationFrame after set amount of time I have the following JavaScript: function animate() { // call other function offset += 3; if (offset > 15) offset = 0; /// make the animation loop loop var request = requestAnimationFrame(animate); } And then in my HTML: <body onload="animate()" > This all works fine, and it keeps the animation continuously looping, which is great. But I want to figure out how to make this animation run for say 4 seconds and then stop. The "call other function" is just a line that moves down and then resets itself to give the impression of moving down a stretch of road. It is all done in Canvas at the moment. Any help would be much appreciated!
You can use `requestAnimationFrame`'s argument which is elapsed time in milliseconds - this will give you a very accurate time: function loop(elapsedTime) { if (elapsedTime >= 4000) return; /// break loop after 4 seconds requestAnimationFrame(loop); /// provides elapsed time as arg. to loop } /// start loop with rAF to get a valid argument first time: requestAnimationFrame(loop); # Online demo here From the documentation at MDN: > The callback method is passed a single argument, a DOMHighResTimeStamp, which indicates the time, in milliseconds but with a minimal precision of 10 µs, at which the repaint is scheduled to occur.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "javascript, animation, canvas, setinterval, requestanimationframe" }
Is it more performant to use specific selectors? I'm working in a stylesheet that has a pattern like this: .the-widget { foo: bar; } .the-widget .some-thing { foo: bar; } .the-widget .some-thing .some-other-thing { foo: bar; } Which can make it easier to keep track of styles but it doesn't seem to scale well. I would prefer to just do: .the-widget .some-other-thing { foo: bar } and cut out the middle man. I know there are a lot of different opinions on how to architect a stylesheet so I'm asking if there are any objective advantages to using detailed selectors.
It depends on whether or not you want to share a "sub-style" across the application. If you don't foresee that being a need for your particular case your desire to cut out the middle man is sensible and strongly defining the selector would result in less potential naming errors. It's really a matter of preference. Some folks stick to less is best methods. Again review your application and take the best route that makes sense to your needs.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "css" }
How to access elemens in Row RDD in SCALA My row RDD looks like this: Array[org.apache.spark.sql.Row] = Array([1,[example1,WrappedArray([**Standford,Organisation,NNP], [is,O,VP], [good,LOCATION,ADP**])]]) I have got this from converting dataframe to rdd, dataframe schema was : root |-- article_id: long (nullable = true) |-- sentence: struct (nullable = true) | |-- sentence: string (nullable = true) | |-- attributes: array (nullable = true) | | |-- element: struct (containsNull = true) | | | |-- tokens: string (nullable = true) | | | |-- ner: string (nullable = true) | | | |-- pos: string (nullable = true) Now how do access elements in row rdd, in dataframe I can use df.select("sentence"). I am looking forward to access elements like stanford/other nested elements.
As @SarveshKumarSingh wrote in a comment you can access a the rows in a `RDD[Row]` like you would access any other element in an RDD. Accessing the elements in the row can be done in a couple of ways. Either simply call `get` like this: rowRDD.map(row => row.get(2).asInstanceOf[MyType]) or if it is a build in type, you can avoid the type cast: rowRDD.map(row => row.getList(4)) or you might want to simply use pattern matching, like: rowRDD.map{case Row(field1: Long, field2: MyType) => field2} I hope this helps :)
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 5, "tags": "scala, apache spark" }
Sortino ratio lower than sharpe ratio? Under what circumstances is a sortino ratio lower than a sharpe ratio? What does it mean about the distribution?
Whereas the _Sharpe ratio_ divides the risk premium (mean excess return) by the volatility, the _Sortino ratio_ instead divides by semideviation: the standard deviation computed using only negative returns. For perfectly symmetric return distributions, these should not differ much. However, if a return distribution has skewness, then the Sortino ratio may be very different. In this case, a smaller Sortino ratio means a larger semideviation -- so a negatively-skewed return distribution. When we look at log-returns for individual stocks, such negative skewness is not unusual for a number of economic reasons.
stackexchange-quant
{ "answer_score": 3, "question_score": 1, "tags": "sharpe ratio" }
Behavior of async package What would the following code using the `async` package do: action <- async $ mapM_ someFunc someList wait action Will this merely spawn a single thread in which `mapM_` occurs? (Implying that this has no benefit over just `mapM_ someFunc someList`) Or will it perform the `mapM_` action asynchronously (or is `mapConcurrently` the only way to get such behavior)?
> Will this merely spawn a single thread in which mapM_ occurs? Yes, it will fork a thread and immediately block waiting for the mapM_ to finish and return a `()` (or to throw an exception). The `async` package is very simple; you might like to look at the source to see how it all works together and learn more about the underlying haskell concurrency primitives.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "haskell, asynchronous" }
Why is the md5 checksum of a symbolic link is equal to the original file I have been looking for a while, and I cannot fathom why the md5 checksum of a symbolic link equals to the file it points to. In my understanding a symbolic link is still a file. Given that it is empty I would expect a symlink to have an md5 of d41d8cd98f00b204e9800998ecf8427e. (see here) However testing in practice: echo Hello World > test ln -s test test_symlink Then running: md5deep test test_symlink Yields: e59ff97941044f85df5297e1c302d260 /tmp/test e59ff97941044f85df5297e1c302d260 /tmp/test_symlink Does anyone know what I am missing here?
A symbolic link is transparent to _almost all_ filesystem operations; that's the point of it. When you `open` a symlink, it actually opens the target file, and it's the contents of the target file that get MD5'd. Only `readlink` and `lstat` (and the much more rarely used `lchown`, `lutimes`, and `open(..., O_PATH|O_NOFOLLOW)`) are able to "see" a symlink instead of the file behind it.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "linux, md5sum" }
Can the Jacquard loom be considered stateless? Can the Jacquard loom, pictured below complete with its chains of paper cards !Jacquard loom be considered stateless? As far as I can tell I can tell, each operation is not dependant on the previous. Or did it have any concept of branching and/or looping?
Well, the loom is stateful in that it knows what the current card is. (So it keeps track of line # according to the analogies from comments.) The program, however, is stateless, because each card just weaves a line with no knowledge of what came before or after. So loom: No. "Program": Yes. :) Moreover, the loom is mutable, because it's always changing the state of "current card" rather than spawning a brand new loom where the next card is in front. Moreover, both the loom and cards have side-effects, because they result in a new line of weaving in the rug or tapestry or whatever they're making. I would say the loom is Object-Oriented, because it receives a message in the form of a chain of cards, and then iterates through that message to produce side-effects. So there. :P
stackexchange-softwareengineering
{ "answer_score": 6, "question_score": 2, "tags": "history, state" }
What Is Motor Amps Just saw something on an electric dryer that said 230 volts 7.8 amps 7 motor amps Does motor amps have to do with VA and Power Factor? To clarify, the dryer was one that dries your hands in bathrooms and I am in the US, which I thought it was strange to run on 230v. It was operational though.
An electric clothes dryer has two main components - the heating element and the motor. The spec label tells you the total current drawn by the dryer and they also tell you how much of that current is for the motor. Also note that (usually) the motor current comes from one phase only (at least, in North America). That is: the motor is connected between one phase and Neutral (120 Vac).
stackexchange-electronics
{ "answer_score": 1, "question_score": 3, "tags": "power, motor" }
Matrix determinant lemma I know that if $A,B$ are two positive semidefinite matrices of size $(N \times N)$ we have that: $$\det(A+B) \geq \det(A) + \det(B)$$ My question is can anything similar be said, with $A$ and $B$ as defined above, for the relationship between $\det(A-B)$ and $\det(A)$ and $\det(B)$. For example, could the below be true and why? $$\det(A-B) \leq \det(A) - \det(B)$$
Here is a counterexample ; with the symmetric positive definite matrices : $$A=\begin{pmatrix}10&3\\\3&1\end{pmatrix}, \ \ B=\begin{pmatrix}13&7\\\7&5\end{pmatrix},$$ we have : $$\det(A-B) > \det(A)-\det(B)$$
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "matrices, inequality, determinant" }
What's the prettiest way to compare one value against multiple values? Whats the _prettiest_ way to compare one value against multiples options? I know there are loads of ways of doing this, but I'm looking for the neatest. i ask because i'd hoped this was workable (it isn't, quite obviously when you look at it): if (foobar == (foo||bar) ) { //do something }
Don't try to be too sneaky, especially when it needlessly affects performance. If you really have a whole heap of comparisons to do, just format it nicely. if (foobar === foo || foobar === bar || foobar === baz || foobar === pew) { //do something }
stackexchange-stackoverflow
{ "answer_score": 154, "question_score": 93, "tags": "javascript, comparison" }
My G Suite Gmail personal emails to people are being sent to spam I was one of the early adopters of the free G Suite (formerly Google Apps) package from Google. So I set up a little custom domain and email for my family. It's limited to 50 users but that's way more than I need or use. Just in the past few weeks, many of the emails I send out by myself (eg, not replies) get sent to my recipient's spam folders. Ironically, even a family member who is on the same custom domain name that I'm on! All the people where this has happened have happened to be on Gmail but those are just the people I'm aware of. I have no problem receiving other people's emails. I am not a marketer and I only use the email for personal purposes -- nothing automated has access to my account. I have never had this problem until just recently. What can I do? Update: as per the first response below, I had not ever set up SPF, DKIM, and DMARC. I have now done so. After a few days, the problem stopped.
Seeing that you are managing your own G Suite domain instead of using Gmail. You will need to ensure that you have SPF, DKIM and potentially DMARC configured against your domain to ensure delivery is optimal. Authorise email senders with SPF Authenticate email with DKIM Add a DMARC record Additionally, you have the ability to configure how email coming into your organisation is handled by going to Apps > G Suite > Gmail > Safety and configuring reviewing your enhanced email protection settings.
stackexchange-webapps
{ "answer_score": 2, "question_score": 1, "tags": "gmail, google workspace for business, dns" }
Tool for tracking BPs performance Is there any tool tracking BPs performance? Like outages, transactions per block, etc... If it dose not exist yet - i will make it. And would love to hear what metrics you want to see.
There are now some tools for this: * Made by OP: EOS BP Stats * AlohaEOS's EOS Block Producer Benchmarks (data from EOS Mechanics) * controllinghand's EOS Value Add Matrix * BlockchainKid's Mereo * EOSTitan's performance tool (data from EOS Mechanics) * KEOS.io Top30 Benchmarked BPs
stackexchange-eosio
{ "answer_score": 1, "question_score": 2, "tags": "block producer" }
Unzip file while reading it on iOS I am looking for a way to unzip a file while reading it. Reason I need to do this is I need to unzip large files (over 1 gig) and other `unzip` libraries just load the whole file into memory which causes a crash. Is there a way to do this while reading the .zip file?
ZipArchive provides this feature and worked for us to keep the memory footprint very low.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "ios, objective c, zip, unzip" }
Ajax submit form security? Suppose I have a form and I wanna prevent the user from submiting the form before validating, so that I use the event.preventDefault() in onsubmit : // In my validation.js $('#myForm').bind('submit', function(event){ event.preventDefault(); // I do the client-side validation here }); You can see here, the user can edit the validaiton code after preventDefault() line. And they pass the validation (only client side) What is the more secure way to make a form 'ajax' with client-side validation? I have the server-side validation too, but I just wanna ask how to make the client-side one harder to crack and more secure?
It's never "more reliable" or "more secure". JS can be disallowed and there would be no validation on client-side.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 4, "tags": "jquery, ajax, security" }
How to update column in one table from another if both tables have a text field in common I have two tables Token and distinctToken. Following is the description of the two tables. **Token** (id int, text varchar(100), utokenid int) **distinctToken** (id int, text varchar(100)) The text field in both tables have same data with one exception, that is text field in Token table contains repeated entries. I wanted to update the Token table such that the utokenid it becomes a foreign key. To be more specific i want to set the value of **Token.utokenid = distinctToken.id** where **Token.text is the same as distinctToken.text**. Is it possible using update or should i write a stored procedure to do so.
UPDATE Token t, distinctToken dt SET t.utokenid = dt.id WHERE t.text = dt.text; Am I missing something?
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "mysql" }
Relação entre entidades retorna null Estou tendo dificuldade para verificar um parametro em uma relação entre as entiades Historico e Login. public class Historico { public int ID { get; set; } public virtual Login login{ get; set; } public DateTime inicio { get; set; } public DateTime final { get; set; } } public abstract class Login { public int ID { get; set; } [Required] public string Nome { get; set; } private string Senha { get; set; } } Pois sempre que faço consulta no banco de dados, no campo Login retorna nulo. Queria saber qual a modificação tem que ser para que eu consiga retorna o login ao fazer acesso com o banco de dados.
Por ser um parametro virtual e a classe abstrata pode está afetando o seu resultado. 1. Retirar o abstract da classe. 2. Quando tem o virtual, se vc estiver trabalhando com entity, poderá usar o FluentApi(< ai sim vc terá as informações do usuário.
stackexchange-pt_stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c#, entity framework" }
@route annotation overriding another route i have a staticController with actions for the following example links: /register /imprint this is the example annotation: /** *@Route("/imprint", name="user.static.imprint") */ And now i have the following annotation for linking other pages with dynamic linknames: /** *@Route("/{area}", requirements={"id" = "!imprint"}, name="user.area.index") */ I'm using the path() function in twig to create the links. The generated link /imprint ist now routing to the second annotation. How can i avoid this problem? Thank you very much.
Second route matches same pattern as first and interferes with it, so you need to put first in priority. Somewhere in your project you're importing these two controllers routes as annotations (Probably `/app/config/routing.yml`). Looks something like this: bar_route: resource: "@FooBundle/Controller/BarController.php" type: annotation prefix: / Right now most likely second controller import is above first. Reverse that.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "symfony, twig" }
Find the parent or independent key in array Array = ( "a" => "b", "b" => "c", "c" => "y", "d" => "z" ); Output: c and d Please give me idea on how to loop an array that will find their last parent link. Its hard to describe the problem but please see the expected output. Thanks in advance! :)
I believe what you want is a function that will return all keys with a value that isn't in the keys of the array. You can use the `array_keys()` function for that (docs) and `in_array()` (docs). function independantKeys( $arr ) { $output = Array(); $keys = array_keys( $arr ); foreach( $arr as $key => $val ) { if( !in_array( $val, $keys ) ) { $output[] = $key; } } return $output; }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -4, "tags": "php" }
Do 'Faster Cast Speed' Equip Bonuses Affect Your Pet? It's been a while since I played Torchlight, but I seem to recall that my pet would sort of randomly cast the 'Heal All' skill, and the 'Summon Skeletal Archers' skill that I'd given him. It seemed like every twenty seconds or whatever, he'd cast one of them again, so this leads me to believe the pet is still affected by the natural cooldown period of whichever spells you decide to give him. Based on this, does equipping your pet with things that give a 'faster cast speed' bonus make him able to cast his spells more quickly? I never noticed any improvement myself, but since I assumed it wouldn't work, I never gave him more than probably a 4% bonus in this area. I'm not even sure if this bonus affects spells with a timed cooldown used by the _player_.
They don't. Items that affect your pets explicitly say so (bonus to pet damage, etc).
stackexchange-gaming
{ "answer_score": 3, "question_score": 9, "tags": "torchlight" }
Mysql delete with subquery > **Possible Duplicate:** > SQL Delete: can't specify target table for update in FROM clause I'm trying to delete some rows, but is currently not in success. DELETE FROM product_pictures WHERE picture = (SELECT picture FROM product_pictures WHERE id = ?) You can't specify target table 'product_pictures' for update in `FROM` clause I've never seen this error message before, nor has I been able to find some useful info about what I'm doing wrong. Example of rows: ID Picture 19 picture-grey.jpg 20 picture-grey.jpg 21 picture-grey.jpg
DELETE a FROM product_pictures AS a JOIN product_pictures AS b ON b.picture = a.picture WHERE b.id = ? or: DELETE a FROM product_pictures AS a JOIN ( SELECT DISTINCT picture FROM product_pictures WHERE id = ? ) AS b ON b.picture = a.picture
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "mysql, subquery" }
Limit bandwidth of Apache (XAMPP) I want to limit the bandwidth available to my XAMPP Apache on Windows 7, so I found something about the module 'mod_bw'. I copied the file ("mod_bw.dll") in the modules directory and added the following lines to my httpd.conf. LoadModule bw_module modules/mod_bw.dll BandWidthModule On ForceBandWidthModule On BandWidth all 65536 But with this in the configuration my apache won't even start. I noticed all the other modules have the file extension '.so' while I've got mod_bw.dll. Is this making a difference? This is the guide I was following: <
It doesn't matter, it's backwards compatible. The .so is preferred, but the .dll will work just fine. What does your apache error log say? What version of apache are you using? As I think mod_bw has issues with 2.4 or 2.+ in general. Try mod_ratelimit if you're just trying to slow users down, it won't limit (i don't think) overall bandwidth usage but will limit how much bandwidth each user can take.
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "bandwidth, xampp" }
Simple way to find the exact address / transaction by the part of the address / transaction hash? Imagine I have only a part of the address, for example, `0xa2793n`. The rest of the address is unknown. Is there any indexer, that stores this information in any suitable format, so I can find the list of "used" addresses? 1. I know, that the way geth / parity stores the blockchain data doesn't allow such queries. So most likely I need some third party indexer software which maintains an SQL table with the addresses. 2. Also I know that there's a huge amount of theoretically correct addresses with the same beginning, so this software should only do a search in already used addresses. The same question for transaction hash. Thanks in advance!
The good news is that Etherscan has an autocomplete feature for address search, check the screenshots below: ![enter image description here]( ![enter image description here]( Still not sure if there are any existing solutions for transactions search.
stackexchange-ethereum
{ "answer_score": 1, "question_score": 3, "tags": "transactions, addresses" }
How is quadrature mixing done? I've a Gaussian modulated signal whose quadrature and in phase components are separated. I'm multiplying these components with quadrature and in phase components of a signal of 10MHz frequency, respectively. Then i added the two products.This sum is quadrature mixed data.Right?
If your signal's in-phase and quadrature components are $x_I(t)$ and $x_Q(t)$, respectively, then your quadrature mixed signal is $$s(t)=x_I(t)\cos(\omega_ct)-x_Q(t)\sin(\omega_ct)\tag{1}$$ where $\omega_c$ is the carrier frequency in radians per second. You can also use a '$+$' sign in $(1)$, that's just a matter of convention.
stackexchange-dsp
{ "answer_score": 3, "question_score": 0, "tags": "matlab, discrete signals" }
How do I override a RenderElement? There is a Drupal 8 RenderElement called HtmlTag, which controls how HtmlTags are rendered. I would like to override this so that I can change its default behaviour. I could write a class that extends HtmlTag and override what I need, but then how would Drupal core and the theme system know to use my new class? Alternatively, maybe I should be using `hook_theme_registry_alter()` to tell Drupal 8 to use my new class? I'm not really sure of the best way of achieving this and there don't seem to be any examples of this being done.
Using `hook_element_info_alter()` would be one option, not sure it's the best. The existing class sets 2 pre render callbacks, which you can override in your own class: function MYMODULE_element_info_alter(array &$types) { $types['html_tag']['#pre_render'] = [ [\Drupal\mymodule\HtmlTag::class, 'preRenderConditionalComments'], [\Drupal\mymodule\HtmlTag::class, 'preRenderHtmlTag'], ]; } ... namespace Drupal\mymodule; use Drupal\Core\Render\Element\HtmlTag as CoreHtmlTag; class HtmlTag extends CoreHtmlTag { public function preRenderHtmlTag($element) { // ... } public function preRenderConditionalComments($element) { // ... } }
stackexchange-drupal
{ "answer_score": 7, "question_score": 8, "tags": "8, theming" }
OpenCV (insufficient memory in function cvAlloc) I made my simulation but I am faced with a problem. I'm getting images 640 x 480 in a video. But when it arrives at about 1600 frames or more I am faced with "insufficient memory (out of memory) in function cvAlloc". I released all the images and my RAM (mem storage) won't go over 28 MB. What should I do ?
Did you check your RAM usage? Have a look at OpenCV Memory Management. It lists some common techniques to fix memory leaks.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c++, opencv" }
Why Image is not showing in the browser in Material-UI Avatar component? I am using Material-UI Avatar React component to show profile images. While compiling it can reach the image, there is no error in compile time. But image is not showing in the browser. Please check this image to better understand **Codes** : import {avatar} from '../../images/avatar.png'; <Box component='div'> <Avatar src={avatar} alt="Russel Crow"/> </Box> Please tell me why image is not showing in the browser and How to show it?
You used a named import, try it like this: import avatar from '../../images/avatar.png'
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 3, "tags": "reactjs, material ui" }
RSpec - stubbing an instance method I've added the following method into the middle of a project: def finishes_after_venue_shuts? return unless venue && finish day = regular_day ? regular_day : start.strftime('%a').downcase finish > venue.openingtimes.where(default_day: day).pluck(:finish)[0] end This has caused 1000+ tests to fail within the project. They're failing with the following error code: ArgumentError: comparison of ActiveSupport::TimeWithZone with nil failed I've tried to stub out the method as follows but am apparently doing something wrong: before do allow(Event.any_instance).to receive(:finishes_after_venue_shuts?).and_return(false) end What is the correct syntax for stubbing out the method and simply returning false rather than performing the code? Thanks in advance.
You were close :) allow_any_instance_of(Event) .to receive(:finishes_after_venue_shuts?) .and_return(false) But using `allow_any_instance_of` is considered a bad practice, so more appropriate would be using a double: let(:event) { instance_double(Event, finishes_after_venue_shuts?: false) } allow(Event).to receive(:new).and_return(event)
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 4, "tags": "ruby on rails, ruby, rspec, mocking" }
Understanding C++ codebase with UML-tools I am trying to understand a C++ codebase. I have used some free tools that will scan the code and produce diagrams, but they are not so easy to understand. What I think would be useful is to manually construct something assisted by the UML tool. What i need is to create something that looks like the data structure at run-time. Ideally by pulling objects from the UML and arranging them. Also I would like to organise the classes in sub-packages - like those close to the DB, or towards the branches of the datastructures. ## (I am partly doing this now with Folders in the Visual Studio Solution explorer) This is a LINUX project with many Makesfiles, but many tools like Visual Studio, "understands" the code when I just create projects with the files in the main directory of the exe I am working on
Most tools will only give you a structural view (classes and packages), which honestly doesn't tell you that much of what goes on in runtime. Enterprise Architect from Sparx Systems incorporates a Visual Execution Analyzer, which can generate sequence diagrams from a debug session. It supports C++ but only on Windows so you'd have to rebuild, but if I understand you correctly you've already got your code running in Visual Studio. Here's a brief demo (in this case the code is in C#, but they do claim to support C++ as well). This isn't a full-roundtrip, write-the-code-in-UML kind of thing, but personally I think that's a pipe dream anyway. Use UML to document, use a programming language to code.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "c++, tool uml, uml" }
imbed time in shell script in shell script I need to rename a tb name so that it ends with Y_M_D timestamp, how can this be done? mysql -u root -ppassword <<EOF use mydb; alter table mytb rename to mytb_Y_M_D EOF
mysql -u root -ppassword <<EOF use mydb; alter table mytb rename to mytb_`date +%y_%m_%d` EOF
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "linux" }
Converting a byte array to an array of primitive types with unknown type in C# I have the following problem. I have an array of bytes that I want to convert intro an array of primitive types. But I don't know the type. (This is given as an array of types). As a result I need an array of objects. Of course I could use a switch on the types (there are only a limited number of them), but I wonder if there is a better solution for that. Example: byte[] byteData = new byte[] {0xa0,0x14,0x72,0xbf,0x72,0x3c,0x21} Type[] types = new Type[] {typeof(int),typeof(short),typeof(sbyte)}; //some algorithm object[] primitiveData = {...}; //this array contains an the following elements //an int converted from 0xa0,0x14,0x72,0xbf //a short converted from 0x72, 0x3c //a sbyte converted from 0x21 Is there an algorithm for this or should I use a switch
This code uses unsafe to get a pointer to the byte array buffer, but that shouldn't be a problem. **[Edit - changed code after comment]** byte[] byteData = new byte[] { 0xa0, 0x14, 0x72, 0xbf, 0x72, 0x3c, 0x21 }; Type[] types = new Type[] { typeof(int), typeof(short), typeof(sbyte) }; object[] result = new object[types.Length]; unsafe { fixed (byte* p = byteData) { var localPtr = p; for (int i = 0; i < types.Length; i++) { result[i] = Marshal.PtrToStructure((IntPtr)localPtr, types[i]); localPtr += Marshal.SizeOf(types[i]); } } }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 5, "tags": "c#, .net, arrays, primitive types" }
how can I determine the maximum value of 'backlog' that is allowed on the current system? I'm playing with ServerSocket and I don't see / find what the **limit** of the **backlog** is. The docs don't say anything about this: < int) My code is like this: serverSocket = ServerSocketChannel.open(); serverSocket.socket().bind(null, 10000); but I assume that 10000 might be too much if a system doesn't have enough RAM. So is there a way to determine the maximum value for **backlog** that I can use? It seems like in c++ you can use SOMAXCONN - does something similar exist for Java?
If there were, it would be system dependent: for Windows > The backlog parameter is limited (silently) to a reasonable value as determined by the underlying service provider. Illegal values are replaced by the nearest legal value. There is no standard provision to find out the actual backlog value. Linux states it a little differently but you would need to go through the sysctl interface (or possibly /proc). In any case, it would appear you would need to execute some system specific code. I believe most implementations will just use their maximum value if the specified value is "too big" so this may not be a concern for your application?
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, sockets" }
Is u(n) a periodic signal? ![photo taken from Dr. J. S. Chitode]( It’s given in the book Dr. J. S. Chitode that u(n) repeats after every sample but as we have searched on google quora answers are saying that u(t) is not periodic. So, now I’m confused In my perception u(n) isn’t periodic since it don’t repeat between any deterministic period!
![enter image description here]( Generally, a discrete signal x(n) is said to be periodic with periodicity N, if x(n) = x(n+N) for all values of n. Here u(n) _seems_ to be periodic with N = 1 for all values of n. Yet u(n) is not completely periodic. As you can see, **for n = -1** , the periodicity lost, as u(-1) is not equal to u(0). It would have been periodic, if all samples were 1, extended till **-infinity**. We can generate such a periodic signal like this --> u(n) + u(-n-1). If you plot this signal, you can see that its periodic at all values of n with periodicity N = 1. ![enter image description here](
stackexchange-electronics
{ "answer_score": 0, "question_score": -1, "tags": "signal" }
Keep scroll position inside div after reload php file with ajax I have a div with it's own scroll bar which is being reloaded by AJAX (php file). When I scroll inside this div and reload it, the inner scrollbar gets sent back to the top. I would like for the scroll bar to remain at the position where I originally scrolled to. <style> #div2 { height: 400px; width: 100%; overflow-y:scroll; } </style> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> setInterval(function () { $('#div1').load('shownic8.php'); },7000); </script> <div id="div1"> </div> Here is the code from "shownic8.php" file <div id="div2"> ... </div> Can you help me keep the position of my scroll bar? Thank you very much.
Check < 1. Before `.load()` store current scroll position: `var pos = $('#your-container').scrollTop();` 2. Use `.load()` callback (< to restore scroll position: `$('#your-container').scrollTop(pos);` Using your code: setInterval(function () { var scrollTarget = $('#div1'); var pos = scrollTarget.scrollTop(); scrollTarget.load('shownic8.php', function() { $('#div1').scrollTop(pos); }); },7000);
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, ajax" }
I need help ordering nested loops by integers and displaying them I need help ordering a nested list by a specific integer in it, first I sorted the order of numbers in each list, eg `[['Bob',[3,2,1]],['Kate',[5,4,3]]]`. But now I need to order each object(list) in the list according to the first number of each object from highest to lowest, for example: `[['Bob',[3,2,1]], I then need to print out the highest number in each list of numbers with the name.
>>> sorted( [['Bob',[3,2,1]],['Kate',[5,4,3]],['Jim',[4,3,2]]], key=lambda l:-l[1][0]) [['Kate', [5, 4, 3]], ['Jim', [4, 3, 2]], ['Bob', [3, 2, 1]]] Then to print as you describe: >>> li=[['Bob',[3,2,1]],['Kate',[5,4,3]],['Jim',[4,3,2]]] >>> ["{}: {}".format(n, max(sl)) for n, sl in sorted(li, key=lambda l:l[1][0], reverse=True)] ['Kate: 5', 'Jim: 4', 'Bob: 3']
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "python, list, nested, integer" }
What is Sql query to know data base already exists or not in mysql Can any one tell me the query to know data base name already exists or not in mysq. Thank You
are you trying to create a database only if i doesnt exist? here is how CREATE DATABASE IF NOT EXISTS db_name Read More
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql, sql" }
Getting distinct only for a certain column in mysql I'm trying to select rows with distinct column of 'response', but I'm having trouble doing it. Please take a look at my code: select distinct input,response, ((response REGEXP '[[:<:]]a[[:>:]]')+(response REGEXP '[[:<:]]have[[:>:]]')+(response REGEXP '[[:<:]]I[[:>:]]')) as wordsFound, (LENGTH(response) - LENGTH(REPLACE(response, ' ', ''))+1) AS wordsCount FROM allData HAVING wordsFound > 0 order by wordsFound desc, wordsCount asc, rand() LIMIT 30 If I remove column 'input', in the query, it works, but I also want to select column 'input'. If I put the distinct keyword next to response instead, it'll show an error instead. What should I do to get both the column 'input' and distinct column response?
Instead of `DISTINCT` you want to use the `GROUP BY` clause. select input,response, ((response REGEXP '[[:<:]]a[[:>:]]')+(response REGEXP '[[:<:]]have[[:>:]]')+(response REGEXP '[[:<:]]I[[:>:]]')) as wordsFound, (LENGTH(response) - LENGTH(REPLACE(response, ' ', ''))+1) AS wordsCount FROM allData GROUP BY response HAVING wordsFound > 0 order by wordsFound desc, wordsCount asc, rand() LIMIT 30
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "php, mysql, database, mysqli, distinct" }
Why should the principles of object oriented programming in developing application? To be answered from user's perspective I recently was asked this question in an interview and would like to hear the answer from you people. I discussed about code resuability and security that can be achieved by encapsulation and inheritance but the interviewer did not seem satisfied. He insisted on how exactly an application user is benefited by using applications developed on the principles of oop.
Depends. Purists (and morons) will apply abstraction to every possible bit of code they generate or come across. This is completely unnecessary in something as simple as a direct, simple MySQL call from within a tiny bit of PHP, to log site accesses, for instance. However, generally OOP can save you plenty of cycles if applied systematically to big data involving lots of information shuffling, like sorting hundreds of rows of data on every page access. It's a matter of when to use OOP and when to just write procedural code. OOP takes time and effort and is maintainable by experienced programmers, but you need to ask yourself if it is worth all that extra hassle on a tiny snippet of code that does one thing internally. There are plenty of good articles out there ( that help you to understand WHY OOP is sometimes unnecessary and in fact harmful.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -4, "tags": "oop, design patterns" }
PHPExcel в строку попадает ложь Получаю данные из таблицы, делаю foreach и заношу в таблицу данные: $objPHPExcel->getActiveSheet()->setCellValue('C'.$i, $row["title"]); Все данные есть, пустых нет, лишних символов нет, проверял на `rawurldecode()` все число. Все поля получаю, а вот название новости и название категории не хочет. В чем может быть проблема? Может проблема в кодировке windows-1251?
Проблема решена: $objPHPExcel->getActiveSheet()->setCellValue('C'.$i, iconv("windows-1251", "UTF-8", $row["title"]));
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "phpexcel" }
Powerapps - Default value of dropdown with data source I have a dropdown menu with excel items from one drive. I want to set the value "Please select a value..." as default but I couldn't find the right syntax. ![enter image description here](
**Few things to consider:** 1. As long as the string you are typing is in the column tied to the dropdown, you should be able to just type it in ("Please select a value...") as `Default`; no need for the `Lookup()` 2. There is a small typo in the word `Please` 3. If you want to use a `Lookup()` for other reasons, it requires 3 arguments (you currently have 2). Datasource, lookup column and value, return column. **Try:** Lookup(ServiceInfo, Lokasyon = "Please select a value...", Servis )
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "powerapps" }
How to fix "ERR_SSL_VERSION_OR_CIPHER_MISMATCH" Error With Tomcat and J2EE Web Application? Following configuration I am using in server.xml file. <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" keystoreFile="/home/tomcat.keystore" keystorePass="password" clientAuth="false" sslProtocol="TLS" ciphers="SSL_RSA_WITH_RC4_128_SHA" /> How to resolve this issue ..
I modified the ciphers from ciphers="SSL_RSA_WITH_RC4_128_SHA" to ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_RC4_128_SHA" and it worked for me .
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "google chrome, tomcat, jakarta ee" }
css: override active link style? i have the following selector in my css: a:active { position: relative; top: 1px; } So every link has this little button-effect when it's pressed. How can i prevent that behaviour for specific links? e.g. i have a "back to top" link on my website that shouldn't have this behaviour. a#back-to-top { position:fixed; right:0px; bottom:20px; width:20px; height:20px; background:green; } In this case the "back-to-top" starts to jump. However if I try to reset this it doesn't work. a#back-to-top:active { position:fixed !important; bottom:20px !important; } any idea what I'm doing wrong or how I could exclude specific links from that active behaviour?
Try resetting the `top` property as well. a#back-to-top:active { position: fixed !important; top: auto !important; }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "css" }
Where should I place text that I'm trying to abstract in my CakePHP application? I am writing a CakePHP application and am trying to have text that is frequently displayed (or particularly long) saved in a config file somewhere that we can easily edit it. Where should i put this file and how do I access it? I am also worried about the tradeoff in speed of reading this file when we need to display text, as well as locking from other processes being able to use it. Is this something I should worry about or does the framework handle that?
> ...have text that is frequently displayed (or particularly long) According to the manual, it is good practice to store text that is used across multiple views in a view element (as pointed out by Rob Wilkerson). > somewhere that we can easily edit it. Even in this case a view element is still the choice, as you can refer to this single element from multiple views, so no need for storing in a db yet. If you change the view element, it changes become immediatly effective, wherever it is referenced/embedded (quite logical). > ... saved in a config file This would be considered bad practice, as you start weakening your MVC structure. Supereasy, supershort reading: < Good luck with your project.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, cakephp, configuration, text, abstraction" }
Obtain google shopping matches So, as the title says, I would like to emulate the behaviour of the google shopping tab. For example, whenever I search for "Samsung A50" I get different shopping results from different merchants. Is there a way in the whole google shopping API to do so?
The content API is for submitting data to Google Merchant Center. Currently, there is no official Google API for returning results of shopping ads. You may want to use a tool such as semrush.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "api, google shopping api, google shopping" }
Can an Azure NIC be pointed to records one created in an Azure DNS zone? Is there a way to point an Azure NIC to the records one created in an Azure DNS zone? ![enter image description here](
At present Azure DNS doesn't support private DNS zones, i.e. those only available to your vnet. Also, the DNS servers specified in the "Add DNS server" box needs to be a recursive resolver, Azure DNS is an Authoritative DNS service, i.e. it will only serve answers for the zones it hosts.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "azure, dns, azure virtual machine, azure virtual network" }
Replace certain text automatically with an image I'm currently creating a small website and I want to automatically replace certain text with an image **without** a press of a button. I want it done automatically, but I can't seem to make it work. Thank you! Here's my code: html <p id="test"> javascript: <script> var str = document.getElementById("test").innerHTML; var res = str.replace(" Element.innerHTML = "<img src=' document.getElementById("demo").innerHTML = res; </script>
For this code you don't need any `id` or `class` const paragraphs = document.querySelectorAll('p') paragraphs.forEach((paragraph) => { if (paragraph.innerText == ' { return (paragraph.innerHTML = ` <img src=' /> `) } })
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, html, jquery" }
Simple Question about mathematical convention For expressions in the form: $$\sum_{i=1}^{k}f(i),$$ does this preclude the possibility that $k$ can be non positive as well as non-integer? Or more explicitly, can I make an induction on $k$? and take $1$ as base case? And then show that it is true for $k$ if it is true for $k-1$ ? Thank You.
This format does preclude non-integer numbers. It specifies that $i$ takes the integers between $0$ and $k$ inclusive, so yes, you could induct on $k$. If we want to take non integer values, we can do that by specifying an "indexing set" $I$ and saying that $I$ contains all the values we want. We then write $\displaystyle \sum_{i \in I}f(i)$ to say that $i$ takes all values in the set $I$. This a commonly used in, for example, probability, where we take $I$ to be the set of all possible events and $f(i)$ the probability that $i$ occurs.
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "notation, induction, generating functions" }
Whats the purpose of Windows Workflow Foundation (WF)? I have read about windows workflow foundation where people use this to model a business process, why not to use UML? According to some answers, the workflow can be my domain? What other tools are equivalent to the WF?
Workflow foundation is an _executable_ workflow - the framework includes an engine that executes the workflow. It allows you to write parts of your workflow logic in code. I suggest reading this developers introduction on MSDN. UML doesn't do either thing - you can't use code as part of your UML or execute your UML workflows. UML is intended as a documentation and communication tool. Workflow Foundation is a software tool that is used for modelling and _executing_ workflows. * * * Update, regarding suitability for modelling the domain. Since the core of Workflow Foundation is to model _workflows_ , that is what you should use it for. If you core domain is not workflows, you should model it in a more traditional manner. You can use Workflow Foundation to model the workflows of your model.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 6, "tags": ".net, workflow foundation" }
Finding (phonological) minimal pairs with python Is there an easy way to find minimal pairs with python given a list of words? A minimal pair is a pair of two words that differ only in one sound (one character in pythonian terms). So for example in a list like: wordlist = ["paka", "baka", "puki", "paki", "suki", "suku"] minimal pairs would be: "paka" and "baka", "puki" and "paki", "puki" and "suki", "suki" and "suku" I am new to python, I tried to search for a suitable function that can match characters except one in comparing two strings but I haven't find something useful.
A simple solution : you iterate through your list with word1 and compare with all the others words (word2). You count the differences at each position. The following example will probably work for your task... wordlist = ["paka", "baka", "puki", "paki", "suki", "suku", "buku","baba","nabab"] for n1,word1 in enumerate(wordlist): for word2 in wordlist[n1+1:]: if len(word1)==len(word2): ndiff=0 for n,letter in enumerate(word1): if word2[n]!=letter: ndiff+=1 if ndiff==1: print word1, word2
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "python 3.x, linguistics" }
How do I prove the subadditivity of the limit superior for sequences? I've been struggling for a while to prove this theorem: $\limsup s_n + t_n \leq \limsup s_n + \limsup t_n$ for bounded sequences $(s_n)$ and $(t_n)$ The textbook says it's easy to prove the above theorem by first showing: $\sup \\{s_n + t_n \, : \, n > N\\} \leq \sup \\{s_n \, : \, n > N\\} + \sup \\{t_n \, : \, n > N\\}$ for some integer $N$ but these seem like basically equivalent theorems to me, since the first is just the limit as $N$ goes to $\infty$ of the second right? I've already looked at a few similar threads on Math StackExchange but those weren't really helpful. I'd really appreciate any suggestions/pointers on what to do here. Thanks!
Sorry for returning to this so late! I went to office hours and wrote this solution from what my professor said: For each $N$, $s_N \leq \sup \\{s_n \, : \, n \geq N\\} = S_N$ and $t_N \leq \sup \\{t_n \, : \, n \geq N\\} = T_N$ by the definition of the supremum. Adding these inequalities together, we get that $s_N + t_N \leq S_N + T_N$. Since the inequality holds for all $N$ and $S_N + T_N$ can only decrease as $N$ increases, every term $s_n + t_n \leq S_N + T_N$ for $n > N$, and therefore $\sup \\{s_n + t_n \, : \, n \geq N\\} \leq S_N + T_N$. We take the limit of this expression as $N$ goes to $\infty$ (which exists since $(s_n)$ and $(t_n)$ are both bounded) to obtain $\limsup s_n + t_n \leq \limsup s_n + \limsup t_n$. Hope this helps!
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "real analysis" }
Растянуть <div> через заданную width Есть два `<div>`: <div id='const_width' style='width: 1170px;'> <div id='set_length' style='width: 100%;'>Моя мечта - быть растянутым на всю страницу</div> </div> Как растянуть div `set_length` на всю страницу по ширине? Получается, если экран большой, то `set_length` растянут на `1170px`. А мне нужно на всю ширину экрана Как это сделать с помощью `css`+`js`?
Изменять нужно только в CSS проценты :) $(function() { var e = $('.two'), p0 = $('.one'), p1 = $('body'); var w = (e.outerWidth() / p0.outerWidth()) * p1.outerWidth(); e.css({width: w}); }); .one {width:300px;height:50px;border:1px solid black} .two {width:100%;height:50px;background-color:red} <script src=" <div class="one"> <div class="two"> </div> </div>
stackexchange-ru_stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "javascript, html, jquery, css, веб программирование" }
Por que esse menu não funciona na versão mobile? Eu estava procurando uns templates de menus/layouts e encontrei esse muito legal, mas quando eu passei o google para a visão de celular quando eu clicava no menu a 1a bolinha vinha e voltava, em vez de vir todas elas e ficarem ali até eu clicar no botão novamente. Quero saber como posso fazer para esse menu funcionar corretamente em qualquer resolução de tela e em qualquer dispositivo. Creio que seja algo nesse mousedown no .JS, mas eu ainda sou newbie em JS/JQuery.... Compilador online do próprio template: CODEPEN
Nesse teu código ambos os eventos são disparados e o código anula-se. Podes detectar se é mobile e adicionar o evento certo, evitando misturar APIs: var ev = 'ontouchstart' in window ? 'touchstart' : 'mousedown'; $('.parent2').on(ev, function() { ### codepen: <
stackexchange-pt_stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "javascript, jquery, html, css, menu" }
Grub problem after upgrading Ubuntu I'm using Ubuntu 12.04 along Win7. I have tried to upgrade Ubuntu via Synaptic. After upgrade, Grub screen does not have Ubuntu in its List. You can see shot in below : !enter image description here Please tell me what am i missing here? Any helps would be awesome.
after a GRUB update you **should** execute on a virtual terminal: sudo update-grub It updates grub.cfg to reflect the new changes in the system. Since you are excluded from the system, you can try to use a rescue CD/DVD to edit grub.conf: follow the official guide is always a good idea, it will solve! Bye, good luck.
stackexchange-askubuntu
{ "answer_score": 1, "question_score": 1, "tags": "grub2, upgrade, synaptics" }
Child content types I need to create two content types (Call List and Call Announcements), in Call Announcements there are 5 fields, in Call List there are 12 fields but 5 of them are mutual with Call Announcements, I do not want to create 2 different content types (Call List, Call Announcements) because when the user create a node, he should be able to choose where the node is shown (in Call List, in Call Announcements, Both). (Call List and Call Announcements should be in the same database table) > !enter image description here How can I do these?
Have a look at the Conditional Fields module and use a taxonomy vocabulary with Call List and Call Announcements as items that users can select on node creation. Of course, add a term reference field to that vocabulary under "manage fields" for the parent content type. Conditional Fields can hide/disable/show fields upon user choice (Call List or Call Announcements).
stackexchange-drupal
{ "answer_score": 3, "question_score": 3, "tags": "nodes" }
Show that if $\int_S \varphi d\mu<\infty$, $E=\{x\in S: \varphi(x)<\infty\}$, then $\mu(E^c)=0$. The Problem arises from Walter Rudin's _Real & Complex Analysis_: ![enter image description here]( Now, I understand that $E^c=S^c\cup A$, where $A=\\{x\in S: \varphi(x)=\infty\\}$; thus I tried to show that: 1. $A\in\mathfrak{M}$; 2. $\mu(A)=0$. Because then we'd have $\mu(E^c)=\mu(S^c)+\mu(A)=0+0=0$, since $A\cap S^c=\emptyset$; but I failed on both attempts. Any hint would be greatly appreciated.
Here is a hint. Let $E_n = \\{x\in S : \varphi(x) > n\\}$. Then $E = \bigcap_{n=1}^\infty E_n$, and $\mu(E_1) \le \int_S\varphi\,d\mu < \infty$, by (4). Now it suffices to show that $\mu(E_n)\to 0$ (why?).
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "real analysis, measure theory" }
How to insert LaTeX math expressions in the comments of R chunks in Sweave? The following codes are for the Sweave/Latex beamer \begin{frame}[fragile] \frametitle{Function Basics} \begin{block}{Elementary Functions} <<>>= pi # \texttt{pi} is a predefined const. sin(pi) # \texttt{sin(pi)}$\neq$0, due to computing error. sinpi(1) # Instead, we use \texttt{sinpi(x=1)} to get around. exp(1) log(10) @ \end{block} \end{frame} My question: in the above three # comments, after Sweave compiling, \texttt{}, $\neq$ still exist. Sweave does not recognize Latex code in the R chunk. On the other hand, it seems that Latex does not identify any codes (R or Latex) in the R chunk as well. So, how to show \texttt{}, $\neq$ in Latex math format in this circumstance? Thank you in advance!
This is expected behaviour. I would suggest a workaround: \begin{frame} \begin{tabular}{ll} > pi&\# \texttt{pi} is a predefined const.\\ \Sexpr{pi}&\\ > sin(pi)&\# \texttt{sin(pi)}$\neq$0, due to computing error.\\ \Sexpr{sin(pi)}&\\ > sinpi(1)&\# Instead, we use \texttt{sinpi(x=1)} to get around.\\ \Sexpr{sinpi(1)}&\\ \end{tabular} \end{frame} yields ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "r, latex, sweave" }
Catel InitializeAsync is Not Called in ViewModel I have an issue where every single view model that inherits from `Catel.MVVM.ViewModel` is never calling `InitializeAsync()`. What could I be missing that blocks this call? I'm using Catel.MVVM v5.12.22.
The fix is to change the control type from `UserControl` to `catel:UserControl`. <catel:UserControl xmlns:catel=" Edit: you might want to include validation messages. <catel:UserControl> <catel:InfoBarMessageControl> [XAML Goes Here] </catel:InfoBarMessageControl> </catel:UserControl>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mvvm, catel" }
Табу - как слово попало в русский язык? Как известно, "табу" - это запрет. Причем употребляется это слово далеко не только в значении какого-то первобытного запрета, хотя все-таки имеет значение запрета абсолютного, не подлежащего обсуждению. Есть даже производное от него "табуированный". А вот интересно, из какого языка это слово происходит изначально и, главное, как оно попало в русский язык?
В русский слово пришло, скорее всего, из английского, а в английский - из тонганского языка (tapu), при посещении одного из островов Тонга Джеймсом Куком (1777 г.), которому это слово было растолковано (в описаниях он воспроизвёл его как 'taboo'). Однако, слово присутствовало тогда и в других языках той же группы (полинезийской группы языков), например, в фиджийском (tabu) и в языке Маори (tapu, Новая Зеландия).
stackexchange-rus
{ "answer_score": 3, "question_score": 2, "tags": "этимология" }
asp.net mvc2 ajax.actionlink is not working refresh problem has someone make ajax.actionlink for delete to work properly.After deleting the record successfully at the end it is not refreshing the page properly. **the page refresh is my problem**. i have defined the updatetarget id and returning view(model) from my controller but it is returning the master page with it. So the thing is that i am having a page with a page.I have used redirect as well which is not refreshing, <%= Ajax.ActionLink("Delete", "Delete", new { id = item.int_OrganizationGroupId }, new AjaxOptions { UpdateTargetId = "abc", HttpMethod = "Post", Confirm = "Delete Group with Organization Group ID:" + item.int_OrganizationGroupId + " Organization Group Name:" + item.vcr_OrganizationGroupName, OnSuccess = "handleSuccess" })%>| **abc is the id of the table** From controller View("ManageGroup,Model);
To use AJAX returns on models and views, you need to create a partial view and return that instead of a full view which will include your master page, etc. Public Function AjaxView() as ActionResult Return PartialView("NameOfYourPartialView", ItemsToReturn) End Function
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "asp.net mvc, asp.net ajax, asp.net mvc 2" }
Same program GCC crashes but msvc works I have written a program in C to lower a string when compile it in gcc, it crashes when run. But in MSVC program run smoothly. #include<stdio.h> #include<stdlib.h> #include<string.h> char *strlower(char *s){ for ( ; *s; ++s) *s = tolower(*s); return (char *)s; } int main(){ char *c = "HELLO"; strlower(c); printf("%s",c); return 0; } if variable `c` is array then program works in both compiler. Why not work when using pointer in gcc ?
In C all string literals are _read only_ arrays of characters. Trying to modify a string literal leads to _undefined behavior_. That's the reason you should only use `const char *` when having pointers to string literals. Try to use your own array instead: char c[] = "HELLO";
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "c, gcc, visual c++" }
reading an input(int) and storing it into an array with malloc and realloc I'm trying to read ints from stdin, but i don't know the length. I tried this but I have no idea why it doesn't work #include <stdio.h> #include <stdlib.h> int main() { int *arr = (int *) malloc(sizeof(int)); int sizeCounter = 0; int tmp = 0; while(scanf("%d", &tmp) != EOF) { arr = (int *) realloc(arr, sizeof(arr)+sizeof(int)); arr[sizeCounter] = tmp; sizeCounter++; } } Error - realloc(): invalid pointer: 0xb76d8000 _*_
This line is wrong. arr = (int *) realloc(arr, sizeof(arr)+sizeof(int)); `sizeof(arr)+sizeof(int)` is a constant. It is equal to `sizeof(int*)+sizeof(int)`. What you need is: arr = (int *) realloc(arr, (sizeCounter+1)*sizeof(int));
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c, int, malloc, realloc" }
How to get Distinct records from SQLITE table in flutter? I am having a table like this. ![enter image description here]( I want to write a query in sqlite in flutter to get all the records where id are different. For above table output should be:- ![enter image description here]( How should I work this out?
Try this query SELECT * FROM table_name GROUP BY id
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "database, sqlite, flutter" }
causing a leak via performSelector with NSSelectorFromString? I am trying to have a fairly dynamic api for the level class of my game... basically, I just have a bunch of class methods optionsForLevel1, optionsForLevel2, ...etc, that all return a dictionary object with things like how much time the level should have, how many bonus points, the level's name, etc... In my actual game object, when it's time to advance levels, it calls a method on the level object which does: +(NSDictionary*)performClassSelectorForLevel:(int)identifier { SEL sel = NSSelectorFromString([NSString stringWithFormat:@"optionsForLevel%d", identifier]); return [self performSelector:sel]; } This gives me a warning: PerformSelector may cause a leak because its selector is unknown. ... How can I resolve this warning?
This is interesting. You can't. Not in my experience. Simply this is a warning, not an error, this "may" cause a leak. When using `performSelector:` it's your responsibility to make sure it doesn't leak, of course the compiler doesn't know the selector in the `NSString`, it's unknown at compile time, as it will have its value assigned at runtime. You can suppress this warning, but it's okay to ignore Check out this answer for more details: PerformSelector warning
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "objective c, ios" }
Differentiation problem probably using increasing or decreasing property of differentiation Let $f:\mathbb{R} \to \mathbb{R}$ be twice differentiable function on $\mathbb{R}\setminus\\{p\\}$, for some $p$ belonging to $\mathbb{R}$. If $f'(x)<0<f''(x)$ on $x <p$ and $f'(x) >0 >f''(x)$ on $x>p$, then $f$ is not differentiable at $p$.
If $f$ is continuous at $p$ then it must have a strict minimum at $p$. If $f$ is differentiable at $p$ then it must be continuous at $p$ and hence $f'(p) = 0$. Since $f''(x) < 0 $ for $x >p$ we must have $f'(x) <0$ for $x >p$, a contradiction.
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "implicit differentiation" }
Check the conditions in comma separated values I'm using CodeIgniter. In my table one of the field contain value like 1,2 or 1 or 2. Now I want to check a condition in model. The column name is period that value is mentioned above. **model** if($post_period == 1) { $this->db->where('period',1); } else if($post_period == 2) { $this->db->where('period',2); }
Use Mysql Function FIND_IN_SET(str,strlist) . Returns a value in the range of 1 to N if the string str is in the string list strlist consisting of N substrings. A string list is a string composed of substrings separated by `“,”` characters. If the first argument is a constant string and the second is a column of type SET, the `FIND_IN_SET()` function is optimized to use bit arithmetic. Returns 0 if str is not in strlist or if strlist is the empty string. Returns NULL if either argument is NULL. **This function does not work properly if the first argument contains a comma (“,”) character.** $this->db->where("FIND_IN_SET( '$post_period' , period) ");
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "php, mysql, codeigniter" }
C++ a way to have a typedef template to a member function? Title pretty much says it all! Is there any pretty/simple way to do this? Since function pointers can't point to member functions and a member function needs to know the class the members belong to but in this case there is no such information since the class the function comes from will differ. Only standard library please! template <class A> typedef void (A::*Function)(Parameters p);
You could try wrapping it in a struct like this: template <class T> struct method_ptr { typedef void (T::*Function)(Parameters p); }; class A { public: void foobar(Parameters); }; // ... method_ptr<A>::Function pfoobar = &A::foobar;
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "c++, templates, pointers, typedef, member" }
net reflector and visual studio I've lost the source code for one of my programs. Is there anyway to disassemble all the code in .Net reflector and then load it into Visual Studio (express preferably), and hopefully get the designer view as well?
If you are talking about the Forms designer you might want to check out this link from the red-gate groups (problem with datasets when use reflactor to retrieve project). At the very bottom, I put a link to a hacked version of Jason Bock's File Generator which splits form files into 2 partial class files.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": ".net, visual studio, decompiling, reflector" }
get the integer between the dates i am programming in c# and i have question: how can i get the integer value between a date. for example : 12/6/2010 and 12/18/2010 how can i get at 1st i=6 and in the second i=18
DateTime dt = DateTime.Parse("12/6/2010"); int i = dt.Day; See: DateTime reference
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "c#" }
Get today's date print to the console in Protractor I'm new to Protractor. I need to select today's date from the date picker. Is there a specific anyway to select the today's date from the date picker? Thanks. :)
Please see my answer here If you need to be more quick, var pickerDue = element(by.model("supplier.enroll_date")); var today = new Date(); var dd = today.getDate(); var mm = today.getMonth()+1; //January is 0! var yyyy = today.getFullYear(); if(dd<10) { dd='0'+dd } if(mm<10) { mm='0'+mm } today = yyyy+'-'+mm+'-'+dd; pickerDue.clear(); pickerDue.sendKeys(today); Hope this helps. :)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "datepicker, protractor" }
how to get ID from file how to get 3 from `3.hpdf` if it is a big int then how can i get it
There is a function for that: string name = System.IO.Path.GetFileNameWithoutExtension(fileName); int id = int.Parse(name); That only works if your filenames look like 12345.hpdf
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c#, split" }
Login control not centering I have an aspx Login control and I would like to center it on the screen. How can i accomplish this? I've tried applying text-align: center on it.
#containing_element { //Or body text-align: center; // For IE } #element_to_center { display: block; margin: 0 auto; // For everything else text-align: left; // Assuming you don't want everything else centered. }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "asp.net, html, css" }
Ruby on Rails where clause with two tables I am using Ruby on Rails and I have three models: Artist, Album, Track Each track has an album_id and each album has an artist_id I want to find all tracks for a specific artist, something like the following: select track.* from tracks, albums where track.albmum_id==album.id and album.artist_id=5; So I am hoping to end up with tracks that I can then paginate over. My best effort so far is this but it is not working: @tracks = Track.joins(:albums).select("track.*").where(artist_id: @artist.id).paginate(page: params[:page]) I get: ActionView::Template::Error (Association named 'albums' was not found on Track; perhaps you misspelled it?) I am using Rails 4.0.0. Any ideas?
You can build a relashionship like this: class Artist has_many :tracks, :through => :albums Then, you can use: a = Artist.first a.tracks With the `has_many through`, the query is automatically built for you.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ruby on rails" }
Partially ordered set question R is relation over the set of functions continuous in $[0,1]$ that defined $$fRg \Longleftrightarrow f(x) \leq g(x) \rightarrow x\in [0,1]$$ I know that to prove it I need to show that 1. if for all $a \in A$(the functions set) implies $(a,a)\in R \rightarrow$ Reflexivity 2. for all $(a,b) \in R , (b,a) \in R \rightarrow a=b $ i.e. Anti - Symmetry 3. if for all $(a,b) \in R $ and $(b,c) \in R \rightarrow (a,c)\in R $ Transitivity for reflexivity: $fRf \longleftrightarrow f(x)\leq f(x)$ $R$ reflexivity for anti symmetry $fRg ,gRf\longleftrightarrow f(x)\leq g(x) \wedge g(x)\leq f(x) \rightarrow f(x)=g(x) $ $R$ anti symmetry what about transitivity? Thanks!
Proving transitivity (as well as reflexivity and anti-symmetry) really just falls out from the fact that $\leq$ is already transitive (as well as reflexive and anti-symmetric). Choose any continuous functions $f,g,h$ in $[0,1]$ such that $fRg$ and $gRh$. Then we know that for all $x\in [0,1]$, we have $f(x) \leq g(x)$ and $g(x) \leq h(x)$. Hence, by the transitivity of $\leq$, we know that $f(x) \leq h(x)$ so that $fRh$, as desired.
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "discrete mathematics" }
How can I send various information on one socket? I want to write an application for my android phone to control it via wlan. That should contain its camera abilities. Is there any elegant method to send live pictures and other information in one socket "at the same time"? My idea is to let the server accept more than one client: the first for life images, the second for information, third for audio streaming... It should work like skype: you can call people and chat at the same time with one connection. How can I implement something like that?
I doubt multiple sockets would do you any good (unless Android makes it really hard to put data from multiple sources into the same stream). Just send everything sequentially in the same stream, with a tag in front to identify each type of data. The fancy name for this is "time-division multiplexing". Multiple sockets might make sense if you get into fancy tweaking to, say, give more priority to realtime streams, but I have a feeling that shouldn't be necessary.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "java, android, multithreading, sockets" }
How to change my chat username? > **Possible Duplicate:** > switching which site is primary for a user How can I change my username in Chat? I'd like to participate in the chat for a site where I go by _Tim_ , but the chat insists on calling my by my first and last name (which is also what my network profile does).
Change the parent user of your chat account. !below the about section I don't believe it is possible to have different names for different rooms on the same chat site.
stackexchange-meta
{ "answer_score": 2, "question_score": 4, "tags": "support, chat, display names" }
A better way to override plugin's JS files? I'm modifying some functionality of a theme i'm using, which already set up a `.js` file inside a plugin to handle the paypal checkout process. I had to modify the code so I renamed a few elements and basically copied the old js file to a new file and made the changes. It works and everything is fine, but I wonder if there's a better way to do it in Wordpress? It doesn't feel right to modify so much just so I could change a few lines of code inside. Thanks!
Extending the above comment: Directly changing the files of the plugin or theme is not a good practice as once the plugin/theme is updated, you will loose the changes. Instead use child theme in case of themes and hook to required actions in case of plugins. In your case since you are only changing the script in plugin and they might have enqueued(they should be) with `wp_enqueue_script` hooked to `wp_enqueue_scripts`. You can dequeue that script using `wp_dequeue_script` all you have to do is findout the script handle from the original plugin. Then you need to enqueue the changed script.
stackexchange-wordpress
{ "answer_score": 5, "question_score": 5, "tags": "plugins, javascript" }
How to call .hover from Template.<template>.events api in coffeescript How do you register the two required functions for .hover when using meteor's Template..events api in coffeescript? I'm trying something along the lines of: Template.<template>.events 'hover #elementID': ( (ev) -> console.log 'hello world' (ev) -> console.log 'bye world' )
Saimeunt's is correct, but if you want it to be exactly as .hover() jquery uses mouseenter and mouseleave instead. So it'd be: Template.<template>.events "mouseenter #elementID": (event, template) -> console.log "mousehover", event "mouseleave #elementID": (event, template) -> console.log "mouseout", event
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 6, "tags": "jquery, meteor, coffeescript" }
Reduce number of lines displayed in column on web part I have created a discussion board web part but the body column displays the whole body of the discussion. I would like to reduce it so that it only shows the first line or two of the body column. ![What it currently looks like]( ![What i would like it to look like]( If the images dont illustrate, i would like to limit the number of lines displayed in the body column **on the web part** to just the first two lines. Hope this makes sense. Thanks in advance! Mike
This is a ugly way to do it but it might work for you if you just need it as a quick fix and nothing to serious. This will change the height of the actual multiple lines of text field to only "display" one or two rows. Hovering over the field will expand and show the full text. <style type="text/css"> .ms-vb2 .ms-rtestate-field { overflow: hidden; line-height: 16px; max-height: 56px; /*change this height to show more or less rows*/ } .ms-vb2 .ms-rtestate-field:hover { max-height:none; } </style> The screenshot shows the same list item, while not hovering over it and while hovering. ![enter image description here](
stackexchange-sharepoint
{ "answer_score": 2, "question_score": 1, "tags": "sharepoint enterprise, sharepoint designer, web part, list view, column" }
Make SUSY adapt to physical screen size, not pixels I scaled my site to support mobile around 320px, and to look normal on a widescreen desktop environment, etc. However, the mobile device I am testing with has a high-resolution screen- 720x1280px. This is actually pretty close to my desktop monitor of 180x1050. How would you setup SUSY to show larger text on the mobile device, not be too ridiculously big on a tablet sharing the same screen resolution, etc? In other words, how do you handle the fuzzy gray zone between tablets, high res mobile, and legacy devices?
For any responsive layout, you need to remember the viewport meta-tag: <meta name="viewport" content="initial-scale=1"> You can google for details, or read this article at tutsplus for more details.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "css, html, responsive design, susy compass" }
Enable thread support for Perl in Windows? I'm trying utilize threads in my Perl script, running on Windows 7. I'm unable to compile the script as Perl wasn't built with thread support when initially installed (the previous user installed Perl without thread support). How can I rebuild Perl with thread support? Thanks.
Most people use ActivePerl or Strawberry Perl on Windows, both of which have thread support enabled. * * * That said, I find it very odd that you have a Perl without thread support on Windows. I think you could be mistaken. You can check if your Perl has thread support by using >perl -v | find "built for" ... for MSWin32-x86-multi-thread-64int or more directly with >perl -V:usethreads usethreads='define';
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "multithreading, perl, parallel processing, perl module" }
Symfony Forms-Displaying the form details in a label Guys Im very new to Sympfony Forms. I created a form and now i want to display those data from the form on a separate page. the data must be only text and not editable. can u guys help me out here? i want to get the output of the 'firstname' from the form and display it as just a text.Thank You. {% extends 'FirstPrj/mainbase.html.twig' %} {% block body %} <!-- row start --> <div class="row"> <div class="col-md-6 col-sm-6 col-xs-12"> <div class="form-group"> <h3>First Name</h3> {{ form_widget(form.firstName) }} {#<label for="first-name">First Name*</label>#} </div>
As Sergei Kutanov pointed already out, if you only want to show the data, there is no need for a form. However, it would be possible to access the data via form like this in your twig template: <div class="form-group"> <h3>First Name</h3> {{ form.firstName.vars.value }} </div> You could also dump e.g. the `firstName` field of your `form`, just to get a closer look what is going on there and which `vars` you can access. {{ dump(form.firstName) }}
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "html, symfony" }
What would be the correct entity type for Password in Login (user_Login) intent? Hi my team is trying to create customized google actions using dialogflow. For that they have come up with some queries, please help - In Login (user_Login) Intent, we are asking for Mobile number and password. What would be the correct entity type for password? Right now it is not able to detect the password.
You should be careful with handeling users passwords in a conversation. Because password are very random there isn't a standard entity that helps you with recognising it. The only way you could approach this is by using the @sys.any entity, which just takes in anything as input. This isn't a very secure approach because the user has to type or speak out their password. The best approach would be to sign-in your users with one of the build in accountlinking features. These features can connect your action to your user database via OAuth and don't require you user to speak or type their password in the chat. This takes a lot of work out of your hands and makes your action more secure.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "dialogflow es, actions on google, google assistant sdk, google assist api" }
How to deploy an embedded server to Elastic-Beanstalk? We have developed multiple micro-services using DropWirzard to have embedded jetty servers for each micro-service. Has anyone had experience with deploying an embedded server to elastic-beanstalk for auto-scaling? _-Thanks for your time_
Did you consider deploying each micro service on a separate docker container and deploying these containers on AWS Elastic Beanstalk? <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "amazon web services, amazon elastic beanstalk, embedded jetty" }