INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Generating a Rank2Type within a Monad So I superfically understand Rank2Types, but when I try the following {-# LANGUAGE ImpredicativeTypes, RankNTypes #-} import Data.Machine f :: IO (Process a a) f = return . auto $ id GHC coughs out Couldn't match type `MachineT m0 (Is a0) a0' with `forall (m :: * -> *). Monad m => MachineT m (Is a) a' Expected type: IO (Process a a) Actual type: IO (MachineT m0 (Is a0) a0) In the expression: return . auto $ id In an equation for `f': f = return . auto $ id Failed, modules loaded: none. So as far as I can see, GHC won't allow me to put a forall in a Monad. Is there a principled, quantification logic reason for this, or is this simply a limitation of GHC? Or am I simply doing something silly?
Your particular example can be made to work as follows: {-# LANGUAGE ImpredicativeTypes, RankNTypes #-} import Data.Machine f = (return :: (forall a. Process a a) -> IO (forall a. Process a a)) (auto id) As Carl says, you have to annotate functions that you want to use impredicatively, such as `return` here. Even then, working with impredicative types in GHC is somewhat fragile. I wouldn't recommend it. The reasons for the restrictions are simply that it's tricky to perform type inference in the presence of impredicative types, and additionally, Haskell's surface language has no proper syntax to specify the type at which you want to instantiate a polymorphic function. A common workaround is to wrap stuff up in a `newtype`: data PolyProcess = PP (forall a. Process a a) f' :: IO PolyProcess f' = return $ PP $ auto $ id
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 12, "tags": "haskell, higher rank types" }
How to replace computer + disk icon using during installs in WiX? Is it possible to replace the ancient looking computer + disk image that msiexec displays during install using WiX 3.5? If so how? !enter image description here I'm not currently using using WixUI. I am open to using it, as long as I can get just a plain, zero-click installation experience. I've tried all of the WixVariables suggested on this page: < but no luck. Thanks for any help.
No, you can't change it. This icon comes from `msiexec.exe`, which is the Windows Installer service. Changing the icon in this system dialog as well as window icon is not supported.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "wix" }
Selenium webdriver opens firefox but doesn't fetch page through Selenium and NodeJS I'm starting work with selenium along NodeJS and set up a simple config file. **test.config.js** var webdriver = require('selenium-webdriver'), By = webdriver.By, until = webdriver.until; var driver = new webdriver.Builder() .forBrowser('firefox') .build(); driver.get(' When I run `$ node test.config.js` Selenium open **Firefox** but doesn't go to yahoo page. In chrome, all works fine. Below my settings: Firefox Quantum 63.0.3 64 bits. Ubuntu 18.04.1 LTS 64 bits. Geckodriver version 0.11.1 node version: 8.11.3 **Firefox open by selenium** ![enter image description here]( What could be wrong here?
The _Geckodriver_ version **0.11.1** is quite **ancient** and is incompatible with **Firefox Quantum v63.0.3** ## Solution Download and install the compatible version of _Geckodriver_ as per the chart the current released version being **Geckodriver v0.23.0** * * * ## _GeckoDriver_ , _Selenium_ and _Firefox Browser_ compatibility chart !supported_platforms_geckodriver
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "node.js, selenium, firefox, selenium webdriver, geckodriver" }
Mashing worlds, good or not so good? I have these two worlds in my mind, and don't really want to choose between the two, but have only time to write one story since I'm not exactly a spring-chicken. Would it be worthy trying to find a way to merge both worlds into one where both main characters can come together to "fight" against an enemy which has come to be common to both worlds due to some bizarre occurrence? Or... Should I just throw away one of the worlds and its peoples? Both are just as palpable to me.
Of course you can. Numerous works of fantasy do this. Raymond E Feist's Riftwar saga does this. It's a recurring theme throughout all the books, and develops almost exactly as how you've described (with the Tsurani and Elves both fleeing to Midkemia to avoid the Dread). It's even done on a smaller scale with the character of Thomas/Ashen Shugar, as the boy and the Valheru merge together to create something unique, powerful and capable of standing with Pug (who also is a product of the two worlds merging). Or there's the stories that merge the seen and unseen worlds together - Jim Butcher's Dresden Files, for example, or Terry Brooks Knight of the Word series (the precursor to the Chronicles of Shannara). So in short, yes, it can be done and done well. It revolves around the conflict of the two worlds, the fear and conflict arising from dealing with the unknown/unseen, and then ultimately the resolution that combines the strengths of both to stand against the greater threat.
stackexchange-writers
{ "answer_score": 3, "question_score": 1, "tags": "time depiction, time management" }
Why doesn't C++ implement construction + calling functions in same line? I'm wondering why C++ (and possibly other languages, I'm not sure) doesn't allow statements like this. MyObject foo.DoBar(); You would think that the language could understand to construct the object, then call the function. The only reason I can think of this not working is that if the construction of the object failed, the statement would still try to call the function. What are the reasons why those who help develop and integrate new features into C++ (and possibly other languages) don't allow this?
You _can_ construct an object and immediately call a function on it, you just can't assign the object to a variable if you do so: MyObject().DoBar(); A practical reason for this restriction is that the constructor creates the object and the function you're calling could also have a return value, so that you would end up with two values produced by the same statement. Then you would need some special syntax to assign both of these values to variables, something that doesn't happen anywhere else. And the little convenience that might be gained by directly calling the method isn't that big of an advantage that it would be worth introducing new syntax for it.
stackexchange-stackoverflow
{ "answer_score": 16, "question_score": 5, "tags": "c++" }
hash table with integer as keys A hash function transform a Key into an integer hash value, is it possible to have an integer as a Key ? with boost::hash function it seems I get the same integer for the hash value...so I am a little bit in trouble
With integers that wouldn't be a problem, would it? Equal input values would produce the same hash-value, and distinct input values produce distinct hash-values. This is the perfect hash-function!
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "c++, boost" }
Is there pseudo-distribution mode still supported in hadoop 2.2.0? I was trying to run hadoop 2.2.0 on my pc in a pseudo-distribution mode. unfortunately, I couldn't find any doc about how to config a pseudo-distribution mode on hadoop 2.2.0. So I followed some tutorials about some earlier version, and it run pretty well. But I wonder if the hadoop is running on a single-node mode or a pseudo-distribution mode. Is there any indicator to tell me about it ?
Yes, of course. here is the doc on how to setup single-node cluster with 2.2.0, it shares the same page as 2.1.1-beta though.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "hadoop" }
How to restart Chrome Remote Desktop from command line Say I was using Chrome Remote Desktop and remotely killed the host process on accident, causing me to get kicked off. However I still have SSH/terminal/command-line access. How can I relaunch the service so I can connect again? Also, is it possible to install or reinstall Chrome Remote Desktop via SSH?
## Restarting the service **Linux** : The host process is a normal Linux service, so you can restart it by typing this in your SSH session: sudo service chrome-remote-desktop restart You should only have to wait a few seconds before it's ready for you to try connecting. **Windows** , run these commands to restart the service (thanks @JohnLock): net stop chromoting net start chromoting **macOS** : launchctl start org.chromium.chromoting ## Reinstalling the service (I don't know how to install/reinstall Chrome Remote Desktop via SSH. Someone please update this answer if you know how.)
stackexchange-superuser
{ "answer_score": 24, "question_score": 16, "tags": "chrome remote desktop" }
Positioning the pivot point in center in part of mesh I made three models which will be tiled next to each other in a game. Center Tile, Corner Tile, Edge Tile. !Tiles My problem is I have trouble positioning them next to each other, I've come to the conclusion the problem is the pivot point. My most left tile, the pivot is directly in the center. But on the other two they are not in the center even though I used "Origin to center of mass" and also Shift-C and "Origin to 3D cursor". I have also tried selecting the top vertices "the green part" and Shift-S "Cursor to selected", its nearly perfect but not quite. !Tile problem How can I perfectly center the pivot point in the green part in each model?
The reason " _Origin to Center of Mass_ " (or " _Origin to Geometry_ ") does not work is because your center of mass in not in the same location. The two tiles with dirt, have most of the geometry much lower. To set the origin in the seam place as the your all green first tile requires a 2 step process. 1. In edit mode, select the top 8 vertices of your tile. (Note that the pivot point can not be set to " _3D Cursor_ " or " _Active Element_ ") Now press `Shift``S` > _Cursor to Selected_. That will move the 3D cursor to the location you want as the origin. ![enter image description here]( 2. In object mode press `Ctlr``Alt``Shift``C` > _Origin to 3D Cursor_. ![animated gif](
stackexchange-blender
{ "answer_score": 2, "question_score": 4, "tags": "mesh, objects, transforms" }
Showing $S^2/{\sim}$ (real projective plane) is Hausdorff Let $\pi:\;S^2\to S^2/{\sim}$ be the projection map where the relation on $S^2$ is $a\sim b\iff a =\pm b$. I am trying to show $S^2/{\sim}$ is Hausdorff. So take $\alpha,\beta\in S^2/{\sim}$ then $\pi^{-1}(\alpha)=\\{\pm a\\},\pi^{-1}(\beta)=\\{\pm b\\}$. Take $\varepsilon<\frac{1}{2}\min\left\\{\|a-b\|, \|a+b\|\right\\}$ then $A=B_\varepsilon(a)\cap S^2, B=B_\varepsilon(b)\cap S^2$ are disjoint open neighbourhoods of $a,b$ (and $-A,-B$ for $-a,-b$). Now $\pi(A)\cap\pi(B)=\emptyset$ since $\pi(u)=\pi(v)\iff u=\pm v$ and $A,B$ disjoint. But I can't see how to properly show that $\pi(A),\pi(B)$ are open? I know that not all projection maps are open maps so it's not immediate...
By definition of the quotient topology, $\pi(A)$ is open iff $\pi ^{-1}(\pi(A))$ is open. But this is just $A \cup -A$, which is a union of two open sets. Similarly for $B$.
stackexchange-math
{ "answer_score": 4, "question_score": 5, "tags": "general topology, metric spaces, quotient spaces" }
How to perform code coverage in C++ using meson? I'm using meson and ninja as build system in my C++ project and I've configured catch2 as testing framework. I was wondering how to perform code coverage with the tests that I've written. I read this page, < but seems pretty unclear to me, can anybody help?
You should use one of coverage related targets: **coverage-text** , **coverage-html** , **coverage-xml** as described here. Or just **coverage** that tries all of these if possible: $ ninja coverage -C builddir Results are written to _./builddir/meson-logs_ directory. Note that to produce html coverage reports you need **lcov** and **genhtml** binaries which are installed by **lcov** package.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "c++, code coverage, ninja, meson build, catch2" }
How to replace the last one or two characters of a file with unix tools I have a hanging comma at the end of a file that I would like to replace with a close square bracket. There may or may not be a newline character at the end of the file as well. How can I replace the one or two characters with the square bracket using common unix tools?
This will delete all trailing empty lines and then replace the last comma in the file with a ']' cat origfile | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | sed -e '$s/,$/]/' > outputfile
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "unix, file" }
Prevent direct access to a web page except redirect I have redirect to a web page upon successful form submission using guest plugin. The redirected page is in announcement tone so I'd like to prevent it from direct access with exception that comes from form submission. Is there something Craft can do?
Add a Preparse field to the entry type you're posting to and make it generate a random string on entry save. Then make the Guest Entries plugin redirect to a URL with that Preparse field's value in the query string. `<input type="hidden" name="redirect" value="success?id={id}&key={preparseField}">` You should now be able to get that entry model in your template and test against that Preparse field's value. {% set query = craft.request.getQuery() %} {% set entry = craft.entries.id(query.id).preparseField(query.preparseField).first() %} {% if not entry %} {% exit 404 %} {% endif %}
stackexchange-craftcms
{ "answer_score": 3, "question_score": 3, "tags": "config" }
TTPhotoViewController: deactivate rotation (no orientation landscape) In my project, I use the Facebook API "three20": < How can I deactivate the auto rotation? The image and the thumbnails should always displayed in portrait and not in landscape mode. Thanks!
Use `shouldAutorotateToInterfaceOrientation:` - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return NO; }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "iphone, objective c, ios, three20, ttphotoviewcontroller" }
Virtual destructor on IUknown Derived interfaces I have been doing some code learning by reading some existing code. I know the importance of having a virtual destructors on Interfaces which are non com types. I mean which do not derive from IUnkown or IInspectable. However, I am not able to understand why it is not required to have a virtual destructor on a COM interface. I have my interface defined like this MIDL_INTERFACE("0D70D782-809D-403B-AC95-XXXXXX") IMyInterface : IUnknown { public: virtual bool method1() = 0; virtual int method2() = 0; } And at the same time I have another interface which doesnt derive from IUnkown like this class ISampleLogic { public: virtual ~ISampleLogic() {}; //some more methods } Why there is no virtual destructor for first interface? Thanks in advance
`IUnknown` has a method called `Release()`. Its job is to decrement the object's _reference count_ and destroy the object if that reference count drops to zero. So it acts as the destructor; and an explicit destructor is therefore not required. If you have an `IUnknown` pointer (say `IUnknown* punk`), you shouldn't `delete` it, but call `Release()` instead (`punk->Release()`). That's because other processes may have a reference count on the object. It's down to the _implementation_ of the interface to ensure that the entire object is deleted. That implementation may well contain classes with virtual destructors, if necessary.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "c++, c++11, com" }
Writing and reading an array with specified keys to a json file I have an array $monthlyStatistics = array('total' => 1, 'opened' => 1, 'clicked' => 1, 'bounced' => 1, 'optout' => 1); that I have saved to a json file $monthlypath = '/storage/monthlytotals.json'; file_put_contents($monthlypath, json_encode($monthlyStatistics)); and I need to read this json file and output the contents as an array with the specified keys. I am currently doing this: $monthlypath = '/storage/monthlytotals.json'; $read_file = file_get_contents($monthlypath); $monthlytotals = json_decode($read_file); which I know that file_put_contents puts as a string and that file() is supposed to read the entire file into an array (which I am currently not using since it doesn't read what file_put_contents wrote). Am I doing this wrong or am I missing a function that is supposed to go along with file() for writing it properly as an array?
You're trying to convert from a PHP data structure in memory to something that can be written to disk. Somehow that needs serialising - either through `json_encode()` or `serialize()` etc. `file()` reads a file into a list of lines (one line per array entry). For what you're doing, `file_put_contents($monthlypath, json_encode($totals))` and `$totals = json_decode(file_get_contents($monthlypath), true)` are probably all you probably need.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, arrays, json, file" }
Why can't I add to a numeric object property? If I have a simple object like this: const currentAccount = [{ name: 'J.Edge', balance: 100, }] Firstly, am I right in thinking (forgive my newbie-ness, only been learning JS for a few weeks) that I can't add to the numeric balance property directly, like in the function below, because of JS type coercion converting the balance property's 100 to a string? const withdraw = (amount) => { currentAccount.balance - amount return Object.keys(currentAccount) } And secondly, what would be the easiest way of getting around this?
You can do this with the assignment operators `+=` and `-=`. This is the same as writing `variable = variable + change` or `variable = variable - change` const currentAccount = [{ name: 'J.Edge', balance: 100, }]; const withdraw = (amount) => { currentAccount[0].balance -= amount } const deposit = (amount) => { currentAccount[0].balance += amount } withdraw(20); // => 100 - 20 deposit(45); // => 80 + 45 console.log(currentAccount[0].balance); // => 125 Note that `currentAccount` is an Array, thus you need to access an element in there before changing values.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, object, properties, add, numeric" }
How to use the proxy provided in .condarc for pip packages in the environment.yml? I have to use a proxy, which I have configured in the .condarc file, for conda work, which works perfectly fine. However when I'm setting up a new python environment with an environment.yml file, which could look like this: name: Test channels: - intel - defaults dependencies: - pypdf2=1.26.0=py36_1 - mkl=2018.0.2=1 - pip: - adjusttext==0.7.2 prefix: C:\ProgramData\Anaconda3\envs\Test Pip doesn't use the provided proxy to install those packages, so I get an error. How can I get pip to use that proxy as well?
Indeed pip doesn't pick proxy settings from .condarc. But it will use HTTPS_PROXY environment variable if present. Just add this line to .bash_profile: export HTTPS_PROXY=<
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "python, proxy, pip, conda, requirements" }
How can I properly document a method with a completion handler in iOS swift I'm documenting the code for my company's iOS application, and now I've moved on to methods that have a completion handler. Is there a specific method for documenting completion handlers, or should I just put it as part of the parameters? for example: /** Description - Parameters: - parameter1: description - parameter2: description - completion: description */ Is this the right way or is there another better way? Or maybe it should be in the "Returns" part of the documentation? Thanks
/** Sends an API request to 4sq for venues around a given location with an optional text search :param: location A CLLocation for the user's current location :param: query An optional search query :param: completion A closure which is called with venues, an array of FoursquareVenue objects :returns: No return value */ func requestVenues(location: CLLocation, query: String?, completion: (venues: [FoursquareVenue]?) -> Void) { … } taken from <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 4, "tags": "ios, swift, documentation" }
How many frames per second can we get on html5 video? > **Possible Duplicate:** > get a >24 fps framerate in HTML5 video? And if it's not a matter of html5, what is it that determines how high a frame rate we can get? I asking because I'd like to film several things in 60fps and create a slow motion function in JavaScript.
It only depends on the encoded video (frame rate of actual video) and implementation of the browser vendor (whether media player in browser supports that much fps).
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "javascript, html, video" }
Dynamic Named Range based on Another Cell Value I have two columns, col A contains an ID number from 1 to 9999 and column B contains a list of names. I would like to create a dynamic named range for column B where the associated ID value is between 999 and 9000. Normally I would use the OFFSET function to define the named range. Is it possible to expand the functionality to exclude records in col B based on the value in col A? I would like to avoid filtering, vba, pivot tables or manipulating the raw data if possible. Thanks
Here is a solution with only 1 limitation that your filter on ID column should result in continuous values, e.g. the filter can be ID >= 5 and/or ID<=1000 If this is acceptable, solution would be: Along with ID (column A) & Name column (column B), create a third column (column C), e.g Name2 where Name2 = =IF(AND($A2>=start_val,$A2<=end_val),B2,"") ID Name Name2 1 A 2 B 3 C C 4 D D 5 E E 6 F F 7 G G 8 H 9 I 10 J create two other name ranges for your filter start_val 3 end_val 7 finally, create a namedrange with formula: xyz = OFFSET(Name2,MATCH(start_val,ID,0)-1,,1+MATCH(end_val,ID,0)-MATCH(start_val,ID,0),)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "excel" }
Java How to get date format : dd/MM/yyyy HH:mm:ss.SS” with Date variable I wouldlike to change format of my date variable : private java.util.Date utilDate = new java.util.Date(); I use it to set Date in my database (postgresql) : stmt.setDate(2, new java.sql.Date(utilDate.getTime())); How can I transform my actual format : dd/MM/yyyy to dd/MM/yyyy HH:mm:ss.SS ?
If you want to store the hours, minutes and seconds, you have to use DateTime or LocalDateTime type instead of java.util.Date. Date only stores the year, month and day. Then, you can use a formatter. For example: public DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss.SS");
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, date" }
Validation Rule: End Date is less or equal to the Start Date I'm trying to write validation rule that `end_date__c` should be `<=` `start_date__c` `isHired__c is boolean` But does not seems to work, for an example: my start_date__c = 8/8/2016 11:34 AM end_date__c = 8/8/2016 11:34 AM the validation should accept since I'm checking to see if the start <= but I'm keep getting the validation message as if the condition did not match. here is what I have got: AND ( (DATEVALUE(start_date__c) - end_date__c) <=1, isHired__c, ISPICKVAL(status__c, 'Approved') )
Start Date minus End Date means that the result would be negative if the End Date was after the Start Date, which should trigger this rule. Instead, you meant to say End Date minus Start Date, which would be negative if the Start Date was after the End Date. Of course, as Adrian said, simply use the comparison operators directly, which helps you avoid that common mistake: End_Date__c < Start_Sate__c && isHired__c && ISPICKVAL(Status__c, 'Approved') As, as you've noticed, when doing your math, if Start Date and End Date are the same, you'd also get the error (0 is less than 1).
stackexchange-salesforce
{ "answer_score": 2, "question_score": 2, "tags": "formula, validation rule" }
em.createNativeQuery executa primeiro do que o em.persist e agora? Estou desenvolvendo uma aplicação com Hibernate + Spring mv. o spring cuida da dependência do EntityManager para meu DAO, porem tenho o seguinte problema. * eu persisto um objeto chamado User * depois eu executo createNativeQuery com "insert into tabela1 (campo1, campo2) select campo1, campo2 from User" com isso notei que na tabela1 não estava registrando o User, fui conferir habilitando show_sql e no console o hibernate executa primeiro o createNativeQuery depois o persist, independente da ordem que os dois foram escritos. Existe alguma forma de configurar o hibernate pra que ele mantenha a ordem?
O problema é causado porque muitas das operações comuns são armazenadas em uma espécie de fila em memória, que geralmente é descarregada no banco de uma só vez ao fechar o `EntityManager`. O Hibernate tenta assim otimizar o acesso ao banco de dados. Porém, queries nativas não passam por essa fila e para o SGBD é como se o primeiro comando nunca tivesse ocorrido. O ideal nesse caso é executar o método `flush()` após o `persist()` para forçar que os comandos aguardando na fila foram enviados ao banco de dados, neste caso a inserção.
stackexchange-pt_stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "java, hibernate, spring" }
How can I prove this probability equation? Say we have: $$ y = A(1+X)^n $$ where $ 'X' $ is a random variable that is normally distributed with a mean $ 'μ' $ and a standard deviation $ 'σ' $. If the following statement is true, how can it be proved? $$ E[A(1+X)^n] = A(1+μ)^n $$ EDIT: What would be the expected value of $'y'$?
Assuming also that A is a parameter, using Jensen's inequality you can prove that your statement is false. In fact $$\mathbb{E}[1+X]^n \ge (1+\mathbb{E}[X])^n$$ this is valid in general, not only when $X$ is Normally distributed * * * Using @lulu's hint, setting $A=1,n=2$ you can have a counterexample being $$\begin{align} \mathbb{E}[1+X]^2 & =\mathbb{E}[1+2X+X^2]\\\ & =1+2\mu+\sigma^2+\mu^2\\\ & = (1+\mu)^2+\sigma^2>(1+\mu)^2 \end{align}$$ $\forall \sigma^2>0$
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "probability, statistics, expected value" }
Calculation of trigonometric functions in python How does Python calculate trigonometric functions? I try to calculate using x = ((0.1-0.001)/2)*math.sin(((1/20)*math.pi*20)+(0.5*math.pi*1))+((0.1-0.001)/2)+0.001 I'm getting x = 0.1 why is that? in a usual calculator (radian) i'm getting `0.001`
In Python 2, `/` is integer division,you need to import `__future__ .division` for floating division : >>> from __future__ import division >>> import math >>> x = ((0.1-0.001)/2)*math.sin(((1/20)*math.pi*20)+(0.5*math.pi*1))+((0.1-0.001)/2)+0.001 >>> x 0.001
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "python, calculator, trigonometry" }
Long filenames in forfiles / for cmd My script has a problem with long file names. It cuts until "c:\Program" Thanks! SET directoryToSearch="C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader" SET r1="" for /f %%F in ('FORFILES /S /P %directoryToSearch% /M "ac*.exe" /C "cmd /c echo @path"') do set r1=%%F echo %r1%
You don't need `forfiles`, `for` is able to to it by itself: SET "directoryToSearch=C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader" SET "r1=" for /r "%directoryToSearch%" %%F in (ac*.exe) do set "r1=%%F" echo %r1% Note: best practice is to not include the quotes in the variable value, but quote where needed. See the changed (preferred) `set` syntax (note where the quotes are)
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "batch file, cmd" }
Is there a way to save "char * argv[]" to a variable in C++? I'd like to be able to save argv into a struct so that it can be passed to functions like so: struct Parameters { int argc; char * argv[]; }; void Start( Parameters P ) { }; int main ( int argc, char * argv [] ) { Parameters P; P.argc = argc; P.argv = & argv; return 0; } But with: clang++ -std=c++2a -stdlib=libc++ -rtlib=compiler-rt -Ofast Start.cpp -o Start && ./Start; I'm getting this error: Start.cpp:21:9: error: array type 'char *[]' is not assignable Is there a way of saving argv to a variable? Any help would be very much appreciated.
You can simply change to: struct Parameters { int argc; char ** argv; }; Your `argv` array of pointers to `char` will decay to a pointer to pointer to `char`. Then, your main becomes simpler, with: P.argv = argv;
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c++, clang++" }
Using a UIProgressBar to display status of a download Does anyone have a link to a good tutorial about using a UIProgessBar in iOS to display the status of a download? I wouldn't have a problem even taking the total download size and inserting an if statement that states if (downloaded "x" megabytes), then add 0.1 to the progress bar. Thanks for your help!
Try using ASIHTTPRequest < <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ios, download, progress, documents, uiprogressbar" }
Heroku with AWS RDS: Are details in database.yml needed? We're running a Rails app on Heroku and have it connected to a database on Amazon RDS. It works fine, the security zone is configured and the app is live. Heroku requires you to provide a Database URL in the format of mysql2://user:[email protected]/database Since we're specifying the DB info in the add-on, what do we need to provide in the `database.yml` file, if anything? Would the following suffice, or do we need even less than that? Maybe just the adapter name? production: adapter: mysql2 encoding: utf8 reconnect: false pool: 5
Heroku automatically replaces the content of any `database.yml` file on deploy with the value of the shared database, normally stored in the `SHARED_DATABASE_URL` config variable. I don't know if it's save to override that value. If you do it, you should be able to connect to the database from Rails without any additional effort. If your app is working fine and you are just wondering what you need to write inside the default `database.yml` file, then you can put in whatever you want, Heroku will replace it in any case on deploy.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ruby on rails, ruby on rails 3, heroku, amazon web services" }
Modify multiple rows in dataframe assume I have a dataframe. I would like to modify a list of rows with certain value. For example, below is my dataframe. df = pd.DataFrame({ "strings":["A", "B", "C", "D", "E"], "value":["a", "b", "c", "d", "f"], "price":["1", "2", "3", "4", "5"]}) And I want to replace all cells with '0' in row C, D, and E, which is like below. Rows = ['C', 'D', 'E'] df = pd.DataFrame({ "strings":["A", "B", "C", "D", "E"], "value":["a", "b", "0", "0", "0"], "price":["1", "2", "0", "0", "0"]}) I know we can achieve this by simply giving the rows' name and certain value, but as we have lots of rows to be modified, how could we do this more efficiently using pandas? Anyone hint please?
If I understood correctly, you want all the values in columns "price" and "value" to be set to zero for rows where column "strings" has values either C, D or E. df.loc[df.strings.isin(["C", "D", "E"]), df.columns.difference(["strings"])] = 0 df Out[82]: price strings value 0 1 A a 1 2 B b 2 0 C 0 3 0 D 0 4 0 E 0
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 1, "tags": "python, python 2.7, pandas" }
ImageMagick get pixel color by x y coordinates I have this 30x20 image which is 10x increased in size here: ![enter image description here]( I need to get the color of the pixel with the coordinates `x 19` and `y 14` which in this case is red I changed all kind of values in this code: -crop "1x1+0+%[fx:h-7]+0" -format "%[hex:u.p{0,0}]\n" info: but only get the blue pixel
If you want pixel at (19,14), you need: magick image.png -format "%[hex:u.p{19,14}]\n" info: Or: magick image.png -crop 1x1+19+14 -format "%[hex:u.p{0,0}]\n" info:
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "imagemagick" }
How can a breakpoint's location affect the findability of a bug? In this MSO bug report, our very own waffles makes the following observation: > This bug also happens to be a heisenbug, when debugging it if your first breakpoint is too early, stepping through shows that everything is good. (Ref: Wikipedia's entry on Heisenbugs) How is it even possible for the location of a breakpoint make a difference in whether a bug appears? _(Yes, I know the Wikipedia article answers this, but I thought it'd be a good question for SO to have the answer to, and I bet SO can do better anyways.)_
If there is any kind of asynchronous activity going on then this could affect _heisenbugs_. e.g. threads, I/O, interrupts, etc. Setting breakpoints in different locations would affect the relative timing of the main thread and the asynchronous events which could then potentially result in related bugs either showing up or disappearing.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "debugging, language agnostic" }
MySQL join with two columns looking at same table I have a table with the fields: orderID collection delivery username collection and delivery are IDs and correspond to a record in the addresses table: addressID address1 address2 address3 town country How can I write a query that shows all orders for a particular username but with the full address details for both collection and delivery.
You just need to add an alias to you joined tables. select * from orders join addresses collections on orders.collection = collections.addressID join addresses deliveries on orders.delivery = deliveries.addressID where username=<username>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -3, "tags": "mysql" }
How to Design/Figure out the Required Path in Ruby Programming? Is there a well-designed method that can run my ruby program from anywhere? I already searched a couple of ways to import my ruby program from the different directories by using the relative path. i.e. > File.expand_path(“my_path”) It worked and let me run it anywhere, but somehow, it is a little unreadable and I think it is pretty messy. So I think there may be a solution or convention to deal with this kind of problem when there are many file paths that have to be imported.
I suggest you have a look how to package a gem and build your own and install it. Or you could place your binary in `$PATH`, but that's a bit more messy.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "ruby, path" }
JS - converts objects to array I have following array of objects: [{"CZ-PR":"1"},{"CZ-JC":"0"},{"CZ-JM":"0"},{"CZ-KA":"0"},{"CZ-VY":"0"},{"CZ-KR":"0"},{"CZ-LI":"0"},{"CZ-MO":"0"},{"CZ-OL":"0"},{"CZ-PA":"0"},{"CZ-PL":"0"},{"CZ-ST":"0"},{"CZ-US":"0"},{"CZ-ZL":"0"}] I need to convert it to array of arrays, like this (need to pass it to Google Maps Geocharts constructor): [["CZ-PR","1"],["CZ-JC","0"]] I tried: var arr = []; for (var k in obj) arr.push([+k, obj[k]]); Which gives me array for each letter... How can I convert my initial object to what I need? EDIT: The format that is expected from Google geocharts is this: var data = google.visualization.arrayToDataTable([ ['Country', 'Popularity'], ['Germany', 200], ['United States', 300], ['Brazil', 400], ['Canada', 500], ['France', 600], ['RU', 700] ]);
Try this var data = [{"CZ-PR":"1"},{"CZ-JC":"0"},{"CZ-JM":"0"},{"CZ-KA":"0"},{"CZ-VY":"0"},{"CZ-KR":"0"},{"CZ-LI":"0"},{"CZ-MO":"0"},{"CZ-OL":"0"},{"CZ-PA":"0"},{"CZ-PL":"0"},{"CZ-ST":"0"},{"CZ-US":"0"},{"CZ-ZL":"0"}]; var result = []; result = data.map(function (el) { var key = Object.keys(el).pop() return [ key, +el[key] ] }); console.log(result);
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, arrays, object" }
Software to display statistics based on EXIF data? > **Possible Duplicate:** > What software can show my most frequently used focal length? I'm interested in learning what the photo settings i use the most often (eg. what focal length, what ISO etc.) to possibly help with deciding what lens to get in the future. Is there any software (or a simple script) that will enumerate all my photos and produce a report based on EXIF data? Something that will for example list the number of photos for taken at each ISO setting or (possibly more useful) a lsit of how many photos at each focal length.
Maybe this could help you : < . It's (ExposurePlot) a Windows freeware. I hadn't tested it but according to his description it allow to > generates statistical graphs for exposure information, contained in the EXIF data of digital photos. It analyzes focal length, ISO, aperture (F-Stop) and shutter speed and generates graphs that display the percentage used, times used and combinations of these values
stackexchange-photo
{ "answer_score": 2, "question_score": 3, "tags": "software, metadata" }
Why does string interpolation work in Ruby when there are no curly braces? The proper way to use string interpolation in Ruby is as follows: name = "Ned Stark" puts "Hello there, #{name}" #=> "Hello there, Ned Stark" That is the way I intend to always use it. However, I've noticed something **odd** in Ruby's string interpolation. I've noticed that string interpolation works in Ruby without the curly braces in regards to instance variables. For example: @name = "Ned Stark" puts "Hello there, #@name" #=> "Hello there, Ned Stark" And that trying the same thing as a non-instance variable does not work. name = "Ned Stark" puts "Hello, there, #name" #=> "Hello there, #name" I've tried this with success in both 1.9.2 and 1.8.7. Why does this work? What is the interpreter doing here?
According to _The Ruby Programming Language_ by Flanagan and Matsumoto: > When the expression to be interpolated into the string literal is simply a reference to a global, instance or class variable, then the curly braces may be omitted. So the following should all work: @var = "Hi" puts "#@var there!" #=> "Hi there!" @@var = "Hi" puts "#@@var there!" #=> "Hi there!" $var = "Hi" puts "#$var there!" #=> "Hi there!"
stackexchange-stackoverflow
{ "answer_score": 111, "question_score": 95, "tags": "ruby, string interpolation" }
Adding Microsoft.AspNetCore.All to private NuGet Microsoft.AspNetCore.All package has a gazillion dependencies and pushing each to a private NuGet instance is heinous. Is there any good / easy way?
This library here will download all NuGet dependencies of your package and then you can add each file to nuget separately. <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": ".net core, nuget" }
Displaying overlapping polyline segments as multiple lines with offsets Selecting which polyline is displayed on top in case of segment overlaps seems to be quite a FAQ, however, I would like to find a way to display overlapping polyline segments side-by-side, i.e. as multiple lines separated by offsets, similar to how Google Transit displays branching transit services. ![Google Transit]( Is there a Leaflet library that does that?
there appears to be one called Polyline Offset which should allow you to control the rendering of polylines. There's a demo here and a screen shot of one of the other demos:- ![enter image description here](
stackexchange-gis
{ "answer_score": 3, "question_score": 4, "tags": "leaflet, line, overlapping features, visualisation, offset" }
dart BrowserClient - how to read response headers? I don't manage to read response headers using browser_client.dart : import 'package:http/browser_client.dart'; var response = await client.post(url, headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: body); print('Response headers: ${response.headers}'); Thanks for your help.
The server needs to allow the browser to expose the headers by listing the headers in the `Access-control-expose-headers` response header, otherwise you can see them in the browser devtools but when you try to read them in code, the browser will suppress them. See also * < * Why is Access-Control-Expose-Headers needed?
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "http, dart" }
legit to adjust tableView bounds to desplay single section? I appologize if this information is readily available, as it is late and am wanting to take shortcuts. Instead of messing with all of the backing data and reloading the tableView, is there anything wrong with recalculating the bounds of a UITableView to show a single section? I have a grouped section with a start and end date range, that when you select a row a datePicker animates in from the bottom of the screen. I change the navigationItems during this mode to "cancel" and "done", however in doing so it doesnt make sence to allow editing of information in other sections.
Sure, resizing of table views is done all the time. Another common reason to resize table views is when the keyboard comes up. You can also disable scrolling if you do not want them to move out of the area they are in.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "iphone, ios, uitableview, bounds" }
Life on other planets first of all I'm not sure if I should post this here or in the astronomy stack. I think biologist are more likely to answer my question. To make it short: Why when looking for any sort of life on other planets, we keep looking for similar conditions we call "life friendly", like nice temperature, oxygen level, pressure etc... Is there some rule in biology that says life can only exists under these conditions? Why nobody supposes that evolution did not have enough time yet on our planet to generate other living mechanisms, and that on other planets even if the conditions are not suitable for us, there might be something well evolved through time there. After all if we can conceive electric robots that can survive to radioactivity and to high pressures and temperatures, why nature shouldn't be able to?
We might imagine living things that are very different from what we know. There is no conceptual reason for limiting life in its relation to water for example. Moreover, the definition of what is alive is really unclear. We classified more or less arbitrarily objects we know on earth as being living or not living but this does not give any clear definition of what is life and therefore it would not allow an exobiologist to even know what he's looking for! But if you had to seek in billion of planets/natural satellite a living creature somewhere where what planets would start looking at? Probably those that look alike yours because you already know that life is possible the kind of conditions these planets offer. I think the answer is as easy as that.
stackexchange-biology
{ "answer_score": 3, "question_score": 4, "tags": "evolution, life, abiogenesis, astrobiology" }
Comprehending wiring data sheet for ME3 C2H4 gas sensor ![datasheet]( am humbly requesting an English translation of this image. The only thing I figured out is that the box on the top left is the ME3 sensor I am trying to connect to an Arduino. It has three pins, as indicated by the reference sheet. But aside from that, nothing on here tells me anything about how to connect this to an Arduino Uno. All I need is for you to identify the pins of the sensor. Anything extra would be greatly appreciated but thats all. Thanks greatly in advance. The link of the pdf image of the sensor I am using is: pdf image link
![enter image description here]( These sensors need a custom design of a small circuit board to create a linear response to Arduino. * C = Common electrode * W = Working electrode * R = Reference electrode ![enter image description here]( ## Datasheet < ## \- consider a better sensor and SDK <
stackexchange-electronics
{ "answer_score": 0, "question_score": -1, "tags": "arduino, datasheet, wiring, arduino uno, gas sensor" }
Combining two Postgresql similar tables located on two different machines I have two Windows machines (PC1 & PC2) with PostgreSQL in both. In PC1 I have the table: !enter image description here And in PC2 I have the same table with the following records: !enter image description here I want to combine both tables and put them in PC1 to be like (the order is not important): !enter image description here How can do that? I am using PostgreSQL 9.2 & pgAdminIII. I prefer,if possible, to transfer the data using USB stick rather than a network.
This is what i would have done: PC1-> pgadmin-> yourtablename -> right click -> backup File options: format:plain, encoding:your_ecnoding dump options #1: only data, use column inserts. this will create the sql query. **replace yourtablename with yourtablename2** and excecute it on PC2 _delete duplicate records and add data:_ delete from yourtablename2 where id in (select id from yourtablename) insert into yourtablename select * from yourtablename2 drop table yourtablename2
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "sql, postgresql, postgresql 9.2" }
Merge two json object in python I am merging two json in python I'm doing import json json_obj = json.dumps({"a": [1,2]}) json_obj1 = json.dumps({"a": [3,4]}) json_obj += json_obj1 print(json_obj) I am expecting the output as {"a": [1, 2,3,4]} but i got {"a": [1, 2]}{"a": [3, 4]} How to get the earlier one?
In json module, dumps convert python object to a string, and loads convert a string into python object. So in your original codes, you just try to concat two json-string. Try to code like this: import json from collections import defaultdict def merge_dict(d1, d2): dd = defaultdict(list) for d in (d1, d2): for key, value in d.items(): if isinstance(value, list): dd[key].extend(value) else: dd[key].append(value) return dict(dd) if __name__ == '__main__': json_str1 = json.dumps({"a": [1, 2]}) json_str2 = json.dumps({"a": [3, 4]}) dct1 = json.loads(json_str1) dct2 = json.loads(json_str2) combined_dct = merge_dict(dct1, dct2) json_str3 = json.dumps(combined_dct) # {"a": [1, 2, 3, 4]} print(json_str3)
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "python, json, python 3.x" }
Sending "this" keyword into an object var View = Backbone.View.extend({ id: 'foobar', param: { x: this.id // Will be "undefined" } }); Is there any way making use of `this`, that can make `this.param.x` pointing to, or has the same value with `this.id`?
Use something like that, var View = Backbone.View.extend({ id: 'foobar', initialize: function () { this.param = { x: this.id }; } });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, backbone.js, this" }
SharePoint Calculated Yes/No Column I've tried to create a calculated column in a SharePoint list that looks for a word in the title of the list entry and then returns yes or no based on if that word is included in the title or not. =IF((FIND("word",Title)),"Yes","No") All of the items that have the word in the title return "yes" as expected, however the items that should return "no", actually return as "#VALUE!" and I am not sure how to solve this.
Adding `ISERROR` let's you display something else than the error message. "SEARCH" is better than "FIND" as "FIND" is case sensitive and doesn't allow wildcard characters. =IF(ISERROR(SEARCH("Word",Title)),"Yes","No") SharePoint: ISERROR Function
stackexchange-sharepoint
{ "answer_score": 1, "question_score": 0, "tags": "sharepoint online, list, calculated column, calculated column formula, yes no field" }
Linearly independent subset of a spanning set > Given $V_1 + V_2 \in \operatorname{Sp} \\{V_1,..,V_n\\}$ and $V_1 \notin \operatorname{Sp}\\{V_2,...,V_n\\}$, prove that $\\{V_2,...,V_n\\}$ is linearly independent. Well, I know that $ V_1 + V_2 \in a_1V_1,..,a_nV_n$ and $V_1 \notin a_2V_2,...,a_nV_n$ I need to show that $a_1V1+...+a_nVn \ne 0$ if $A_i \ne 0$. I don't have any clue how to keep going from here to prove that. Any ideas?
As given the claim's false: Over the real field $\;\Bbb R\;$ : $$\binom10+\binom01\in\text{Span}\left\\{\;\binom10\;,\;\;\binom01\;,\;\;\binom02\;\right\\}\;\;and\;\;\binom10\notin\text{Span}\left\\{\;\binom01\;,\;\;\binom02\;\right\\}$$ yet $$\left\\{\;\binom01\;,\;\;\binom02\;\right\\}\;\;\;\text{is linearly dependent}$$
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "linear algebra, vector spaces" }
How to make HTTPClient request appear in Symfony profiler? I'm using Symfony 4.4.7 and making http requests with HTTPClient (Symfony\Component\HttpClient\HttpClient) but requests doesn't shown in profiler. How to make this profiler tab work?
I solved it. You should use HttpClient using Dependency Injection then requests will appear in Profiler. // services.yaml App\Service\SomeService: arguments: $httpClient: '@http_client' ... use Symfony\Contracts\HttpClient\HttpClientInterface; ... class SomeService { protected $httpClient; public function __construct(HttpClientInterface $httpClient) { $this->httpClient = $httpClient; } ... }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "symfony4, symfony http client" }
lib for Nonlinear Fitting on iOS I need to fit some data in an iOS app, basically with Newton's Law of Cooling: y = a + b * c^{x} I found the GNU Scientific Library is likely to handle this, however, it is out of consideration for the sake of GPL. Is there any open-sourced nonlinear Chi-Square solver in C/C++ with a commercial friendly license (e.g., BSD, APL etc.)? Looking forward to your suggestion.
It seems that MINPACK could do the job. <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ios, open source, statistics" }
Calculating time differences in MySQL > **Possible Duplicate:** > Is there a way to calculate time differences in MySQL using one select I have this kind of table in my db: last_login_time last_logout_time 2011-07-11 17:29:28 2011-07-11 16:11:58 2011-07-11 17:29:28 2011-07-11 16:14:35 2011-07-11 17:29:28 2011-07-11 16:40:18 2011-07-11 17:29:28 0000-00-00 00:00:00 2011-07-11 17:29:28 2011-07-11 16:47:26 2011-07-11 17:29:28 2011-07-11 16:49:13 2011-07-11 17:29:28 2011-07-11 16:53:21 2011-07-11 17:29:28 2011-07-11 17:35:59 I want to calculate in another column the duration of the session (i.e. last_logout_time - last_login_time) In another column I want so sum up all the duartions. I'm using MySQL and PHP. Thanks!
SELECT TIMEDIFF(last_logout_time, last_login_time) AS last_duration FROM...
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "php, mysql" }
Non professional website using .pro top level domain I am planning to offer a web service based on a .pro top level domain. The reason why I want to use this domain is because putting together my own domain with .pro makes a very good name. However, I have seen that the .pro domain is destined for certificated professionals. My website has totally a different purpose of course. My question is about if it is adequate to use .pro domain for a different purpose than its original. Could I be penalised on search results or even have legal problems?
.pro's eligibility criteria was removed, so anyone can register for a .pro. <
stackexchange-webmasters
{ "answer_score": 1, "question_score": 2, "tags": "domains" }
Directive not responding to changes in scope variable I have the following directive: <span ng-show="{{ save_state == 'saved' }}"> Saved </span> <span ng-show="{{ save_state == 'saving' }}"> Saving </span> <span ng-show="{{ save_state == 'error' }}"> Error </span> These callbacks are called at various time: var saving = function() { $scope.save_state = "saving"; $scope.$apply(); }; var saved = function() { $scope.save_state = "saved"; $scope.$apply(); }; var error = function(err) { alert(err); $scope.save_state = "error"; $scope.$apply(); }; **and I also have this statement for debugging** <span> {{ save_state == 'saving' }} </span> **For some reason, even what the span tag above shows`true`, the "Saving" span tag does not show. Same for "error". Why?**
It is because you are interpolating `{{ }}` the contents of the `ng-show` Directive: ng-show="{{ save_state == 'saved' }}" `ng-show` requires that you provide a valid Angular Expression.: ng-show="save_state == 'saved'"
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, angularjs" }
Are questions about [labview] still on topic? As shown in the electronics.SE FAQ > and it is not about … > > * a shopping or buying recommendation > * consumer electronics such as media players, cell phones or smart phones, except when designing these products or hacking their electronics for other uses > * **Programming software for a PC** > So should I post labview questions here or there? There are only 87 questions tagged as labview on StackOverflow so maybe it will do better at electronics. Labview is a {visual} programming language but most if not all the times ... there is some sort of DAQ component (electronics ?) as well. So where should it go ?
If your question is about the DAQ hardware I'd ask it on Electronics SE. Since the software you write in LabVIEW runs on a PC and only communicates with the DAQ, I'd keep asking LabVIEW programming questions on Stack Overflow.
stackexchange-meta
{ "answer_score": 2, "question_score": 2, "tags": "discussion" }
Values of $k$ for which the line $y=kx-1$ is tangent to the parabola with the equation $y=x^{2}+3$ How can I find the values of $k$ for which the straight line $y=kx-1$ is tangent to the parabola with the equation $y=x^{2}+3$? I used this short cut form $c=-am^{2}$, which gives me $k=\pm 2$. I think I am not correct. What's the answer?
Notice, Solving the equation of straight line: $y=kx-1$ & equation of the parabola: $y=x^2+3$ $$kx-1=x^2+3\iff x^2-kx+4=0$$ Now, the line will touch the parabola if both real roots of the above quadratic equation are equal, hence we have the determinant $$\Delta=(-k)^2-4(1)(4)=0$$ $$k^2=16\iff |k|= 4$$ $$\bbox[5px, border:2px solid #C0A000]{\color{red}{k=\pm 4}}$$
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "algebra precalculus, geometry, analytic geometry, conic sections" }
Boot Ubuntu Server Without GRUB I'm in a hurry. I've searched all around but evidently I'm not looking up the right think or I'm too much of in a rush to recognize anything as my solution. I've installed Ubuntu Server for something that I need to run in a little while. I only need it once and while installing I encountered a fatal error installing GRUB. The problem is that now I don't know how to get into my box. I have Windows 7 on the other drive but because there is no boot manager setup, it goes straight into Windows7. I don't need any fancy solutions, I just need a fast way to boot into my Ubuntu Server and hopefully later set it back to auto boot into Windows7 again. **EDIT** I've also looked in msconfig and EasyBCD. Neither of them show my newly installed Ubuntu Server, only my Windows7. Thanks!
Taken from : < Please refer to it for more options. > The easiest way to use Boot-Repair is to burn one of the following disks and boot on it. (< > > Boot-Repair-Disk is a CD starting Boot-Repair automatically. (English only, 32&64bits compatible, based on Debian-live so Wifi drivers are not recent). > > Boot-Repair is also included in Ubuntu-Secure-Remix (multi-languages, ok for Wifi, based on Ubuntu 12.04 LTS, run Boot-Repair from the Dash) > > Remark : you can also install the ISO on a live-USB (eg via UnetBootin, LiliUSB or MultiSystem).
stackexchange-superuser
{ "answer_score": 3, "question_score": 2, "tags": "ubuntu, boot, boot manager" }
3 dots in the end of TextView are vertically centered When using **android:ellipsize= "end"** property, 3 dots are vertically centered instead of appearing in the bottom of the view. How should I make 3 dots appear in the bottom? <TextView android:id="@+id/widgetTitle" android:layout_width="0dp" android:layout_height="wrap_content" tools:text="@string/lorem_ipsum_short" android:maxLines="1" android:ellipsize="end" android:layout_marginStart="@dimen/spacing_4" android:paddingEnd="@dimen/spacing_2" app:layout_constraintTop_toTopOf="parent" app:layout_constraintEnd_toStartOf="@id/widgetTimeArrived" app:layout_constraintStart_toStartOf="parent" /> How it looks
It's hard to tell without access to your full layout, but that's not the standard behavior, so you may be using a custom Font/Theme. This is how it looks in a blank layout with a ConstraintLayout: ![TextView with IDE/XML code and preview visible on the right]( Notice I pinned the "end" to the parent, since I don't know what your `widgetTimeArrived` is.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "android, xml, kotlin, android layout, android fragments" }
Сортировка строк по возрастанию Есть строки в `Memo1.Text` такого вида: способ - 8 повторов протащить - 2 повторов год - 14 повторов принять - 3 повторов и - 15 повторов Как отсортировать строки по первым словам, по длине слова - от большего к меньшему, то есть чтобы на выходе получить результат: протащить - 2 повторов принять - 3 повторов способ - 8 повторов год - 14 повторов и - 15 повторов
У `TStringList` (увы, не у `TStrings`) есть метод `CustomSort`. В него передаётся функция сравнения. А внутри этой функции нужно выделить первые слова строк и сравнить их длину. В идеальном случае достаточно будет просто найти Pos пробела: function SortCompare(AList: TStringList; Index1, Index2: integer): integer; begin Result := Pos(' ', AList[Index2]) - Pos(' ', AList[Index1]); end; procedure TForm1.Button43Click(Sender: TObject); var sl: TStringList; begin sl := TStringList.Create; try sl.Assign(Memo1.Lines); sl.CustomSort(SortCompare); Memo1.Lines.Assign(sl); finally sl.Free; end; end;
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "delphi" }
PSU with unspecified max safe amperage > **Possible Duplicate:** > Choosing power supply, how to get the voltage and current ratings? I'd like to power my new LG M2450D monitor with a basicXL BXL-NBT-U02 universal AC-DC power adapter. This PSU is rated 90W max and supports 15-24V output voltage. The original monitor PSU (PA-1650-68) was fixed at 19V and 3.32A. Now, doing the math: 90W / 19V = 4.74A Of course this is an ideal value, what is "safety margin" i should assume for the real max amperage?
To be conservative, you should assume that the maximum power rating of the universal adapter occurs at the maximum output voltage, and that all lower output voltages are limited to the same current. In this case, 90W/24V = 3.75A, so you should be good to go with the output set at 19V with this amount of current.
stackexchange-electronics
{ "answer_score": 2, "question_score": 2, "tags": "power supply" }
Is it possible to filter addresses in the CC field but not in the TO field? What I'm trying to do is setup a rule in Outlook 2010 that filters on a specific e-mail address in the `CC` field but not in the `To` field. For example, all mail with To:[email protected] should move to a folder called ToEmails. All mail with CC:[email protected] should move to a folder called CCEmails. Is this possible?
You can * Create a new rule * Choose `Start from a blank rule` \-- check messages when they arrive * On the next 'conditions' page, choose `Where my name is in the To box` * Click next * Now choose `Move to a specified folder` and choose the folder Create another new rule just the same, except choose `Where my name is in the Cc box`
stackexchange-superuser
{ "answer_score": 2, "question_score": 1, "tags": "microsoft outlook, microsoft outlook 2010" }
На устройствах Apple не корректно отображается кнопка отправки формы У нас на сайте описана в CSS внешний вид кнопки, но на устройствах Apple эта кнопка отображается не корректно, заменяется на стандартную кнопку Apple. Как это исправить? Пробовала прописать вендорные префиксы, но результата это не дало.
Попробуйте для **необходимых** элементов: .box {-webkit-appearance: none;}
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "css, apple" }
Does the word "inquisitivo" have a negative connotation? RAE defines "inquisitivo" as: > inquisitivo, va. (Del lat. inquisitīvus). > > 1. adj. Perteneciente o relativo a la indagación o averiguación. > 2. adj. ant. Que inquiere y averigua con cuidado y diligencia las cosas o es inclinado a ello. > but doesn't specify the context in which it can be used. I was wondering if it would be correct to say, for example, "El niño me miró inquisitivo cuando vio que escondía algo" or, due to the association with the Spanish Inquisition, the word has only a more "aggressive"/negative meaning. "El secuestrador me miró inquisitivo. Él sabía que escondía algo y no me iba a dejar marchar sin descubrirlo"
The word _inquisitivo_ has no negative connotations. The Inquisition was called that way because they inquired, true, but that did not change the meaning or use of the word. A related, though very different, word would be _inquisitorial_ ; this one does indeed derive from _Inquisición_ and has a definite negative connotation. But _inquisitivo_ is a pretty neutral word.
stackexchange-spanish
{ "answer_score": 5, "question_score": 3, "tags": "uso de palabras, definiciones" }
How to update a SharePoint Hyperlink field via a Workflow I'm using Sharepoint 2013 One great feature in SharePoint is the Hyperlink/Picture field which allows URLs or pictures to be added to a SharePoint list quickly and easily, one frequent requirement that crosses my path is the need to update a SharePoint hyperlink field via a workflow allowing you to add in a clickable descriptive text with a link to the relevant URL added in the field. So how can this be done? By using a pretty straight forward format shown below: URL, Display Text I.e like this < Open Google!
Use "Set Field in Current Item" action to add a clickable text: ![enter image description here]( ![enter image description here](
stackexchange-sharepoint
{ "answer_score": 1, "question_score": 0, "tags": "sharepoint server, workflow, hyperlink" }
Google Play Services Login succeeds on one phone but fails on antoher I've successfully implemented Google Play Services in my app. I was following Accessing the Play Games Services APIs in Your Android Game and the login is working on my Sony Xperia Z5 but fails on my old Galaxy S2 with the message: "Failed to sign in. Please check your network connection and try again". What could cause this? Thanks for any help.
The Problem was, that I was using a different account on the other phone and that account wasn't a Test-Account. I just added it to the testers and it works now! (The app is in developement)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, google play, google play services" }
Fail2Ban or DenyHosts to block invalid username SSH login attempts Is there a way to automatically block IP address when a user tries to login as any invalid username? I already have: [ssh] enabled = true port = ssh filter = sshd logpath = /var/log/auth.log maxretry = 3 bantime = 31536000 in `/etc/fail2ban/jail.conf`
I cannot help you with fail2ban, but I am using denyhosts quite successfully for exactly this thing. You can tune quite a lot parameters and it also have a distributed database where you can send and receive other badhosts. Here's more detailed howto: Install `denyhosts` package (`sudo apt-get install denyhosts`) Look at the default configuration in `/etc/denyhosts.conf`, you might be interested in `DENY_TRESHOLD_INVALID`, `DENY_TRESHOLD_VALID` and `DENY_TRESHOLD_ROOT` options. As for the sync server it's disabled by default and you will need to enable it by uncommenting `SYNC_SERVER` option. It's also not bad to set `PURGE_DENY` option to 1w or something like that in case you block-out yourself, so the entry will get purge after one week and you will be able to login again.
stackexchange-askubuntu
{ "answer_score": 5, "question_score": 10, "tags": "networking, security, iptables, fail2ban" }
Core Data NSPredicate casting key value I have a data model which has values of type id that I was planning on casting appropriately when needed. Is it possible for me to cast these as strings and compare them to strings from a UISearchBar using NSPredicate or do I have to use another method? Maybe something like this: NSPredicate * predicate; predicate = [NSPredicate predicateWithFormat:@"CAST(%K) contains[cd] %@", employeeID , theSearchBar.text];
No. The `CAST()` function doesn't work that way. I think you just have to assume that the `id` returned from `-employeeID` is comparable to a string.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "core data, nspredicate" }
Do Azure Container Instances share a HTTP connection pool? I understand that ACI's (Azure Container Instances) share resources in a Container Group. A fair amount is documented here. However, does anyone know if Container Instances share a HTTP connection pool in their respective Container Group? I ask, because I am running many concurrent HTTP requests for a process (multiple copies of the same process running) and I am wondering if it is more beneficial to split out the work into separate Container Groups or Instances.
> Does anyone know if Container Instances share a HTTP connection pool in their respective Container Group? Generally, the HTTP connection pool is defined on the host. One host would share the same HTTP connection pool. And you can see the description below in the document that you provided: > A container group is a collection of containers that get scheduled on the same host machine. So according to this, I think the containers in the same container group cloud share the same HTTP connection pool.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "azure, http, azure container instances" }
"Install from File" not working to install addon I'm facing a problem with the installation of a downloaded addon. I press `Ctrl`+`ALt`+`U` to access preferences panel in addons I select INSTALL FROM FILE !enter image description here Then a choose caliper script and press INSTALL FROM FILE !enter image description here After that I go back to the preferences panel and type CALIPER in search bar to find a new installed caliper addons to activate it no such addons among installed !!! !enter image description here What am I doing wrong?
Sometimes when you download add-ons from the internet the files are saved as HTML code and not as text files, so Blender has no way to interpret them. The error might be caused by using the **save** otpion from the browser and not using the link on the page that triggers the download of the correct file. To make sure your Python scripts are in the right format you can open them in a text editor, which preferably supports python syntax highlighting. * * * ### It should look like: !enter image description here ### And not like this: !enter image description here * * * Another common error is when the addon is contained in a .zip file instead of on a single .py file. If you unzip (or decompress) the file, you are left with a folder that contains many more files that are not easy to install manually. In such cases install directly from the .zip file instead of decompressing.
stackexchange-blender
{ "answer_score": 3, "question_score": 7, "tags": "add on" }
Swarm rescheduling after adding new node With the new version of Rancher is it possible to tell docker SWARM (1.12+) to redistribute containers when I add a new node in my infrastructure? Suppose I have 4 nodes with 5 containers on each, if I add a 5th node, I'd like to redistribute my containers to have 4 of them on each node. When a node crashes or it shuts down (scaling down my cluster), the re-scheduling triggers well, but when I scale up by adding 1 or more nodes, nothing happens.
This is not currently possible to do this. What you can do, is update a service with `docker service update` (i.e.: by adding an environment variable) A new feature coming in docker 1.13 will be a force update of services, that will update the service and force the redistribution of nodes, so something like `docker service update --force $(docker service ls -q)` might be possible (haven't tried this yet, so can't confirm yet). You can find more info about this feature in this blogpost
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "docker, swarm" }
Why do we use RMS instead of average for average Kinetic energy? The formula for average Kinetic energy is $1/2 MVrms^2$ But why isn't it $1/2MVavg^2$? Average should be _average_ right?
Maybe a numerical example would help. Suppose that a ball of mass 1.00 kg has these speeds after being hit by a bat on 3 occasions: 6.00 m s$^{-1}$, 8.00 m s$^{-1}$, 10.00 m s$^{-1}$. The corresponding kinetic energies of the ball are 18.0 J, 32.0 J and 50.0 J. So the mean energy is 33.3 J. You can easily check that this is equal to $\frac 12 m \langle v^2\rangle$. The mean speed,$\langle v\rangle$, is 8.0 m s$^{-1}$. Therefore $\frac 12 m \langle v\rangle^2 = 32.0\ \text J$. This is not the mean kinetic energy (33.3 J)!
stackexchange-physics
{ "answer_score": 1, "question_score": 0, "tags": "atomic physics" }
supersymmetry in 7, 8, 9 dimension Why above dimension (7,8,9) the number of supercharge per supersymmetry is equal? $i.e$ For 32 supercharges, supersymmetry in 7,8,9 dimension is describe by $N=2$. And for 16 supercharges, supersymmetry in 7,8,9 dimension is described by $N=1 \qquad \text{i.e.} \qquad 9d \\\\\\\\\\\\\\\N = 2 \rightarrow 8d \\\\\\\\\\\\\ N=2 \rightarrow 7d$
Weyl Invariance in 8d, Majorana invariance in 9D and no reductions are possible in 7D. So the minimum number of supercharges in 8,9D = $2^{8/2}/2$ complex components = 16 real supercharges. And in 7D that number is $2^{6/2}$ complex components = 16 real supercharges For further details, refer to the appendix of Polchinski vol 2
stackexchange-physics
{ "answer_score": 2, "question_score": 1, "tags": "supersymmetry, supergravity" }
Vertically center UILabel in parent UIView How do I vertically (y-axis) center a UILabel inside its parent UIView without changing the horizontal position of the UILabel? The following is not it (it changes the x-axis): [self.label setCenter:CGPointMake(view.frame.size.width / 2, view.frame.size.height / 2)] Again, I am looking to center along the y-axis.
CGPoint center = self.label.center; center.y = view.frame.size.height / 2; [self.label setCenter:center]; **Swift Answer..** var center : CGPoint = self.titleLbl.center center.y = self.frame.size.height / 2 self.titleLbl.center = center
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ios, iphone, xcode, uiview, uilabel" }
When getting "Premature end of script headers" in Apache error log, is it possible to also log the GET arguments sent to the script? I have a single PHP script on a fairly high traffic server that is throwing off a lot of errors of this sort: (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server Premature end of script headers: script.php However, for any parameters I can think of, the script returns successfully and immediately. There have also been no user complaints, nor any corresponding errors in the PHP error log. However, it's only this one script that is giving any errors, so I assume there must be a problem causing it to fail under certain conditions. In order to debug further, I need to know what GET parameters are being sent to the script when it fails. Is there a way to modify Apache's error logging to include this information?
I was able to solve this problem in a somewhat cludgy way by grepping the domain access log for the IP address from the error in the error log. That let me narrow down to the specific request that was failing. Was able to get the arguments from the access log that way, as well as confirm that it's returning internal server error (500).
stackexchange-serverfault
{ "answer_score": 0, "question_score": 1, "tags": "apache 2.2, php5, mod fcgid" }
How to display HTML resources downloaded as zipped file in iOS I have a requirement where in i have to download a zipped files(basically contains web resource say HTML/JS/CSS files) from internet to iOS device using the iOS application and then display the content of the zipped file using the application. The starting point of the application will be index.html file.
First you have to download the zip file from the server using library like ASIHTTP Then you have to unzip the zipped file using SSZipArchive to a specific folder in your Document folder Now just load a UIWebView with the NSURL made from the path of the index.html file inside the unzipped folder.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "iphone, ios" }
I have accidently deleted the file name_app.app(executable) in my Xcode project's! I have accidently deleted the file name_app.app in my Xcode project's. How can I regenerates it? thanks
If you're attempting to prepare your application for submission to the App Store, you really need to read the iTunes Connect Developer Guide as this explains in detail how to prepare your application for submission. (N.B.: You _might_ need to log-in to the Apple developer portal for the above link to work.)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "objective c, xcode, executable" }
subquery as the from for mysql What am I doing wrong here? Trying to use a subquery as my FROM to ensure all joined tables are joined on the correct set. SELECT active_users.username as username, active_users.computer_name as computer_name, alert.cnt as alerts FROM (SELECT computer_name, username FROM computers INNER JOIN users on users.computer_id = computers.computer_id WHERE computers.account_id = :cw_account_id AND computers.status = :cw_status ) AS active_users LEFT JOIN (SELECT user_id, count(*) as cnt from logs group by user_id ) AS alert on alert.user_id = active_users.user_id
You need to select `user_id` in the first subquery: SELECT active_users.username as username, active_users.computer_name as computer_name, alert.cnt as alerts FROM (SELECT user_id, computer_name, username FROM computers INNER JOIN users on users.computer_id = computers.computer_id WHERE computers.account_id = :cw_account_id AND computers.status = :cw_status ) active_users LEFT JOIN (SELECT user_id, count(*) as cnt from logs group by user_id ) alert on alert.user_id = active_users.user_id;
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "mysql, sql, subquery" }
Expressing: "Send them over/up, please" This should be a rather straightforward (if a bit specific) bit of translation, but I cannot find a form that makes sense to me and gets corroborated by Google. How would one translate the typical phrase structure: > **Send him up/over** [to the nth floor, to my office etc] Such as spoken to an office receptionist over the phone, to ask them to have a visitor go up to a certain floor/office. More specifically, I am wondering what verbal form would be appropriate. My two inclinations were to go with either: > ... but I am pretty sure this could only apply to an object, not people. Or: > ... but this sounds more like "allow them/me to go" than "have them go" (and so do most usage examples I can find in Google). Does anybody know what the definite way of expressing this would be?
> {}[]{} (article from a business keigo website, more examples) > > {}[]{} (seen in a keigo manual (p.4), more examples) Causative form can work too, if you don't need to use keigo to the visitor: > {}{} I think is acceptable, but sounds unnatural. This is not because of the verb form, but because of the semantics of .
stackexchange-japanese
{ "answer_score": 7, "question_score": 6, "tags": "translation, verbs" }
Best way to give a table a title for accessibility? I want to give a title or heading to a table. For sighted users this will be hidden as the context is obvious, but for screenreaders what is the best way to mark this up? The table is for opening times so that is the title/ caption/ heading/ etc.
You can use `<caption>` for a title. Even though the caption tag is with the table element, it accepts block level tags, so people wrap the text in a heading tag. The `summary` attribute can be used to provide a descriptions. See webUsability's guide about these two topics.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "html, html table, accessibility" }
What's the difference between wParam WM_NOTIFY and idFrom in NMHDR? The documentation for `WM_NOTIFY` says: > * `wParam`: > The identifier of the common control sending the message. This identifier is not guaranteed to be unique. An application should use the `hwndFrom` or `idFrom` member of the `NMHDR` structure (passed as the `lParam` parameter) to identify the control. > And the documentation for `NMHDR` says: > * `idFrom` > An identifier of the control sending the message. > What exactly is the difference between these two?
There is in general no difference. It's a convenience. The same convenience that you get in the `WM_COMMAND` message, which passes both an ID and a window handle, even though you can derive the ID from the window handle via `GetDlgCtrlID`.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 5, "tags": "winapi, visual c++" }
Power bi line and stacked column chart custom series don't show position property I am using power bi Version: 2.65.5313.5141 64-bit (January 2019). I have created line and stacked column chart. Every thing working fine. But i am unable to fixed line values position.From this link i have find a solution.But another problem arise. This link shows customize series into data labels where show position property for column values but my power bi desktop customize series don't show any position property. Can any body tell me why this happen into my power bi desktop.
welcome! Looks like your Power BI could be out of date. Update it to the latest version here and try again.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "powerbi" }
Are RandomAccessFile writes asynchronous? Looking at the constructor of RandomAccessFile for the mode it says 'rws' `The file is opened for reading and writing. Every change of the file's content or metadata must be written synchronously to the target device.` Does this imply that the mode 'rw' is asynchronous? Do I need to include the 's' if I need to know when the file write is complete?
> Are RandomAccessFile writes asynchronous? The synchronous / asynchronous distinction refers to the guarantee that the data / metadata has been safely to disk before the `write` call returns. Without the guarantee of synchronous mode, it is possible that the data that you wrote may still only be in memory at the point that the `write` system call completes. (The data will be written to disk eventually ... typically within a few seconds ... unless the operating system crashes or the machine dies due to a power failure or some such.) Synchronous mode output is (obviously) slower that asynchronous mode output. > Does this imply that the mode 'rw' is asynchronous? Yes, it is, in the sense above. > Do I need to include the 's' if I need to know when the file write is complete? Yes, if by "complete" you mean "written to disc".
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "java, file io" }
Parsing a float from a string in different locales I want to parse a floating point value from a std::string where decimal separator is ".". How do I parse such floats in locales where the separator is ","? I'm using std::stringstream. To clarify: How do I force en-US style float parsing with stringstream?
You can set the locale for your whole program to the basic "C" one this way: setlocale(LC_NUMERIC, "C"); Or for a single stream: std::locale c_locale("C"); my_stream.imbue(c_locale); This will give you "old school," non-i18n parsing and printing. You can try other locale names too, but the one two that are guaranteed to be available on all systems are "" and "C", and it seems like the latter works for your case.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "c++, string" }
Launching an arbitrary executable over a file on Netbeans We want to add command-line support to Netbeans, as in being able to run any program (using the full path of the current file as the argument) directly from the IDE. The same way you can do it already on Notepad++ with the Run tool. Apparently there is a plugin called VCS Generic Command-Line Support that offers this functionality, but when we try to install it we get this error message: > **Some plugins require Master Filesystem to be installed** > > The plugin Master Filesystem is requested in version >= 1.1 but only 2.15.2 was found. Any ideas?
**EDIT** I Did some googling as you got me interested pretty much everything i found was in refernce to NetBeans 5.x or below... Im thinking maybe its not compatible with 6 - but thats just a guess. * * * Looks like a version incompatability with "Master Filesystem". Maybe they are checking the version improperly or perhaps they really mean it needs to be 1.x >= 1.1. Do you have the newest version of VCS Plugin? As an aside if Im going to have to chek this out... ive been dying for external tool support like in my beloved Eclipse :-)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "command line, netbeans, plugins" }
How to compare Accountids in trigger in my project I have one situation where I need to compare new `Accountids` with existing `Accountids` and needs to through an error if the id doesn't exist. Help me with code. Thanks in Advance.
Please see the method. I hope this is what you are looking for public static Set<ID> filterOutNonExistingIDs(Set<ID> InputAccIDs){ Set<ID> ExistingAccountIDSet = new Set<ID>(); for(Account Acc : [SELECT id FROM Account WHERE id IN :InputAccIDs]){ ExistingAccountIDSet.add(Acc.id); } Set<ID> NonExistingAccountIDSet = new Set<ID>(); for(ID AccountID : InputAccIDs){ if(!ExistingAccountIDSet.contains(AccountID)){ NonExistingAccountIDSet.add(AccountID); } } return NonExistingAccountIDSet; } This method takes in a set of all IDs you need to validate. It returns you a set of IDs that dosent exist in the system. Hope this helps.
stackexchange-salesforce
{ "answer_score": 0, "question_score": 0, "tags": "trigger" }
Тень в css Добавил тень на сайт с помощью css, вот так: box-shadow: #666 0px 0px 3px; Подскажите, пожалуйста, как сделать чтобы тень не отображалась сверху и снизу?
box-shadow: 3px 0 3px -3px #666, -3px 0 3px -3px #666; -moz-box-shadow: 3px 0 3px -3px #666, -3px 0 3px -3px #666; -webkit-box-shadow: 3px 0 3px -3px #666, -3px 0 3px -3px #666; _подсказка_
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "css3" }
Query about jenkins in linux I am having problem with the executor in jenkins. Can anyone please tell me about executor in jenkins? Also, explain it's practical implementation.
from : Jenkins User Documentation Home - Glossary Executor: A slot for execution of work defined by a Pipeline or Project on a Node. A Node may have zero or more Executors configured which corresponds to how many concurrent Projects or Pipelines are able to execute on that Node. An Executor does "the work" of executing the job steps. In our configuration, we have many nodes, each one corresponding to a VM host / server. We have each node configured with one executor per core. That let's us run one job per core, which is a generally good performance balance. That gives use the ability to run n jobs in parallel on an n-core VM. There are no rules regarding the ratios, depends really on what your jobs do and where the performance issues may be.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "jenkins, devops" }
Premiere Pro - How to make a slideshow/compilation I have a bunch of videos and pictures. I want to make a compilation with them. I just don't want it to be worse than movie maker. I am looking for these moving effects that you can play while the video is changing ( < ) I already have experience in After Effects and Photoshop CC
Premiere Pro has a number of default transitions under the "video transitions" tab in the effects pane (usually located in the bottom left of the window). Are those what you are looking for? If you have experience with After Effects, you could also use AE's more robust effects library to animate interesting effects for your videos. Based on your included image, it looks like you might be interested in wipe transitions.
stackexchange-avp
{ "answer_score": 1, "question_score": 0, "tags": "video, audio, mixing" }
Saving MFC Model as SQLite database I am playing with a CAD application using MFC. I was thinking it would be nice to save the document (model) as an SQLite database. Advantages: * I avoid file format changes (SQLite takes care of that) * Free query engine * Undo stack is simplified (table name, column name, new value and so on...) Opinions?
This is a fine idea. Sqlite is very pleasant to work with! But remember the old truism (I can't get an authoritative answer from Google about where it originally is from) that storing your data in a relational database is like parking your car by driving it into the garage, disassembling it, and putting each piece into a labeled cabinet. Geometric data, consisting of points and lines and segments that refer to each other by name, is a good candidate for storing in database tables. But when you start having composite objects, with a heirarchy of subcomponents, it might require a lot less code just to use serialization and store/load the model with a single call. So that would be a fine idea too. But serialization in MFC is not nearly as much of a win as it is in, say, C#, so on balance I would go ahead and use SQL.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "sqlite, mfc" }
Как указать относительный путь при копировании? Имеется: 1. файл file.txt в папке **D:\Test** 2. файл file.txt в папке **D:\x64_this-is-my-test_54321_99.88.77.555_folder_n12345** Как используя командную строку (FOR /R [[диск:]путь] %переменная IN (набор) DO команда [параметры]) Cкопировать (xcopy /o /y) C заменой файл `file.txt` из папки `D:\Test` в папку `D:\x64_this-is-my-test_54321_99.88.77.555_folder_n12345`, если известно только что наименование второй папки начинается с `x64_this-is-my-test`, а дальнейший набор символов неизвестен?
Я понял, что расположение второй папки известно, проблемы только с наименованием. Если это так, попробуйте использовать короткие имена файлов. Должно получится что-то в стиле x64thi~ или x64_th~. подробнее тут : < Если короткие имена не подходят, можно попробовать несколько извращенный вариант. for /d %%f in ("x64_this-is-my-test*") do echo %%f в результате в переменную %%f будут последовательно подставлены каталоги, попадающие под маску "x64_this-is-my-test*"
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "windows, cmd" }
SSRS 2008 (not R2) parameter only returns the first name in list SSRS parameter only returns the first name in list. I am running SQL Server 2008 (NOT R2) Reporting Services I have a Parameter called @Signature in my Dataset. The query for this parameter pulls a list of names from a field called “fullname.” The properties of the parameter are “Get values from a query” and the Available Values are set to Dataset = Signature Value Field = fullname Label field = fullname I placed the “fullname” field in my report, but when I select any name from the list in my parameter, it always returns the first value in the parameter list. I am pretty certain that is because the expression for this field is set to the following: =First(Fields!fullname.Value, "Signature") Because I have 2 datasets, I have to distinquish with “Signature.” I need the “fullname” field to populate with the name I select in my parameter.
If you want to display the name selected in your parameter, use the expression: =Parameters!Signature.Label
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "reporting services" }
How to press a key on function call to move to its body Can you give me plugin or something like that for vim to move the cursor or open a source file that contains the function's body when pressing a key on its prototype or call
It sounds like you're looking for the tags feature.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "vim" }
Android emulator throws system UI not responding Although this question has been answered quite some times before but the solution is not working for me. My android emulator throws `system UI not responding` over and over. I've tried the below solution: 1.Open AVD Manager. enter image description here 2.Click to edit button for your device. enter image description here 3.Select Hardware in the Graphics drop down menu. Using: * android studio version: 4.1.3 * flutter: Flutter 2.0.6 Can anyone provide any solution?
Hey there you do not need to all that stuff just go to your AVD manager and click that down arrow i.e DropDown arrow and click on cold boot but make sure you are not running the device at that time as it may cause some error. It is not a permanent solution to the problem it works fine for 4-5 hours as I m not able to find the perfect solution. So it works for me and I hope it works for you too. Whoever seeing this after 2025 Please Reply me to see if I m alive. Bye!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "flutter, android studio" }
Is mutlibit rate option available in Azure media service Video indexer? I am using azure media service Video indexer widget in my application. Is there any option to obtain multi bit rates of video when we upload videos in Video indexer (just like we have in azure media service streaming policy "Predefined_DownloadandClearStreaming"). I have also checked the output asset which is created after video indexing , dose not provide same video download links as it do while using encoding job on input asset. Thanks in advance
@s-tabassum If the single bitrate is chosen, then we either encode to H264 Single Bitrate 4x3 SD if the video’s height is less than 720, and use H264 Single Bitrate 720p otherwise (>= 720p). If the adaptive bitrate is chosen, then we use Content-Aware Encoding, which includes layers with a lower resolution.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "azure, azure media services, video indexer" }
How is the end of round bonus calculated? I've found several very contradictory explanations / formulas how the end of match bonus in MW3 multiplayer is calculated. I would be very grateful if someone could shed some light on this subject. If you can, please provide reliable sources.
This is from a modder who hacked the game code: Scaler = 1 if you win the match, 0.5 if you lose spm = (3 + ( YOUR_RANK * 0.5 ) ) * 10 //maxmatchLength in seconds, YOUR_MATCHTIME in seconds (time it took to finish the match): matchBonus = Scaler * ( ( maxmatchLength/60 ) * spm ) * (YOUR_MATCHTIME / maxmatchLength) Obtained from here. Hope this helps!
stackexchange-gaming
{ "answer_score": 6, "question_score": 3, "tags": "call of duty modern warfare 3" }
How is Git hash constructed? What kind of properties make up the hashes in Git? I realize that it may differ depending on the object type (commit, tree, etc.). For example, how is the commit hash made? Does it involve the commit message perhaps and the changes?
From Pro Git: > The output from the command is a 40-character checksum hash. This is the SHA-1 hash — a checksum of the content you’re storing plus a header There's more detail in that chapter.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "git" }
Back EMF and Source EMF, stabilizing current? In a circuit where there is change in a magnetic flux, Back EMF is induced. When back EMF is increases it reduces the source EMF( or oppose it) and therefore, the current is reduced, in order to stabilize current as it was before back EMF was created to reduce current, what can be done? Note: Power can be changed. So what might be the solution? Increase the resistance so that source EMF would be higher than the back EMF, therefore... stabilizing current at the cost for higher power?
When back EMF (such as from a motor) increases it **doesn't** reduce the source EMF (because that is a voltage source and is fixed by the power supply generating it). What the back emf does is act in opposition to the source voltage so that if back emf increases the current taken by the (say) motor decreases. Typically a motor with no mechanical load will produce a high back emf and this keeps the motor current small - this is logical because on no-load the motor current should be small. As the mechanical load on the motor increases, the back emf decreases and more current is taken. I'm trying to tease a question from the words and misinformation posted and hopefully I've answered the correct question.
stackexchange-electronics
{ "answer_score": 2, "question_score": -1, "tags": "voltage, current, constant current" }
how to rename column name without hard coding in SQL display Currently if I want to rename the column name to something else, I would do Select column as "what I want to name it" from table1 However, I don't want to hard code the column name so I tried to set a variable set @var = "some name" select column as @var from table1 but this is giving me syntax error, what am I doing wrong? All help appreciated, thanks.
The SQL processor just doesn't work that way. Variable evaluation happens within expressions; it can't be used for structuring the output. You can use dynamic SQL, if you really have to, but it's like killing a fly with a rusty chainsaw that has no guard on its blade. Better to not do this in the SQL. As @juergend said in a comment, the form of the dynamic SQL depends on what SQL engine you are using: Oracle, SQL Server, mySQL, etc.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "sql" }
How to hide all toolbars in Excel? I have disabled the _Formula Bar_ and the _Ribbon_ : ![Screenshot of view options]( But Excel still shows a bunch of tools at the top: ![Screenshot of Excel ribbon]( I want to de-clutter / simplify the view to only the data and the Menu itself . How can that be done?
You can collapse the ribbon by clicking on the title of a ribbon section, i.e. "Home", "Insert", "Draw", etc... ![enter image description here](
stackexchange-apple
{ "answer_score": 2, "question_score": 0, "tags": "ms office" }
When I skip to a different time in VLC, there's lag and visual distortions I'm on Ubuntu 16.04 using the latest stable version of VLC from the repository. My gpu is a GTX 950 with the binary driver if that's relevant. When I'm watching a video in VLC and I skip to a different time, it takes like 8 seconds to load, plus the visuals are all distorted for about another 4 seconds afterwards. Is there any way to mitigate this? It's quite annoying at times. I'm having neither of these problems with Ubuntu Videos 3.18.
OK, I _seem_ to have fixed it by doing this: Tools -> Preferences -> Video -> Output: changing it from "Automatic" to "X11 Video Output (XCB)". I'll update if the problem comes back.
stackexchange-askubuntu
{ "answer_score": 0, "question_score": 0, "tags": "16.04, vlc" }