INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Operation 10**(-9) correct in python, but wrong in Cython Very basic question: in my `python 2.7` code I have situation roughly as follows: b=5.0*10**(-9) a=9 print(a) c=a/(1.0*b) the code runs in `python` / `spyder` (64bit), but fails in `Cython`, because of a float division by 0. The printed number is 0. When I define b=0.000000005 the division is fine and the printed number, too. What is the error?
I can reproduce your error with `cython 0.22` and I think this error is related to this thread at `cython-users`. It seems that `cython` gets into trouble when calculating `10**-9`. If you use `10**-9.0` instead, everything works fine. Note, that you could get rid of the error and prettify the code snippet by replacing `5.0*10**(-9)` by `5e-9`. Nevertheless this seems to be a bug in `cython` and not in your code base.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 6, "tags": "python, cython" }
Powers of orthogonal matrices is closed This might be a basic question, nonetheless I cannot give a proof. Given an orthogonal matrix $A$ with eigendecomposition $A = Q \Lambda Q^{-1}$ with only non-real eigenvalues. Given also a diagonal real matrix $\Phi$ with $\Phi_{ii} = \Phi_{jj}$ if $\Lambda_{ii} = \overline{\Lambda_{jj}}$. The following matrix power is defined as $[\Lambda^\Phi]_{ii} := \Lambda_{ii}^{\Phi_{ii}}$. Why is $Q \Lambda^\Phi Q^{-1}$ orthogonal? (Unitarity is simple, but why is it real?)
The complex eigenvalues of a real matrix come in conjugate-complex pairs, with conjugate-complex pairs of eigenvectors. But the converse is true: If you associate to conjugate-complex pairs of eigenvectors any conjugate-complex pairs of eigenvalues, the result will be real because it is the sum of two terms which are conjugate-complex. You can take _any_ diagonal matrix $\Psi$ with $\Psi_{ii} =\overline{\Psi_{jj}}$ if $\Lambda_{ii} = \overline{\Lambda_{jj}}$, and $Q\Psi Q^{-1}$ will be orthogonal.
stackexchange-mathoverflow_net_7z
{ "answer_score": 2, "question_score": 0, "tags": "linear algebra" }
Getting the route detail by name Is it possible to get the details of a route by it's name like the controller and action name that it uses? I went through the documentation and it only has such functionality listed for the current route i.e. `current()`, `currentRouteAction()` etc. Is it possible to get the detail of a route, **action and controller** to be specific, by it's alias/name?
I think, you can get it in this way `Route::getRoutes()->getByName($name);` or `Route::getRoutes()->getByAction($action);`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, laravel, laravel 5.1" }
Tags related to languages I have seen a user tag a question with swedish, and there may be other languages. Should such tags be avoided, instead using language, language-support or localization?
Yes, they needed to be merged, likely in to either localization or language.
stackexchange-meta_askubuntu
{ "answer_score": 4, "question_score": 2, "tags": "discussion, tags, languages" }
Can we construct a continuous but nowhere differentiable surface? In my analysis course we learned about the Weierstrass function which is continuous but nowhere differentiable, is it possible to make a surface which is continuous and nowhere differentiable?
If $W$ is Weierstrass function, let $z=W(x)\,W(y)$.
stackexchange-math
{ "answer_score": 6, "question_score": 2, "tags": "real analysis, continuity, differential topology, examples counterexamples" }
How to include FFMpeg library in iphone project I am using `iFrameExtractor` to extract the frames. But when I clone the project I found that few files from ffmpeg framework was missing. I tried hard to include the missing file, but was not able to do that.. Can anyone sort out this issue or give me the link of `FrameExtractor` class which contains all the lib files of `FFMpeg`. I downloaded the project from this link but when i open the project i gets the following missing file in the image.! This are the missing files
Well you could have a look at the following links FFMPEG Compiled Libraries And iOS FFMPEG integration on iphone/ ipad project And this tutorial FFMPEG Integration
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "iphone, ios, ios4, iphone sdk 3.0" }
Applying high pass filter to streaming websocket data in javascript I'm using socket.io to stream data from a node.js server. The data is coming in at one packet every 33ms. I'm putting the data into a chart in real-time and I'd like to apply a digital high-pass filter on it. I'm trying to figure out how to use DSP.js to apply an infinite impulse response algorithm on the data - high pass at 1hz - but I'm not really sure how to go about this. I understand that I would create the filter object using this library (`var filter = IIRFilter(HIGHPASS, 1, 30)`), but as for the applying the filter (`filter.process(signal)`), I'm not sure what the `signal` would be. When each packet comes in, I add it to an array called `data`. Would it be on this array? Or would I have to do this for each packet as it comes in?
In an IIR filter, all past samples count in computation of the result for current sample. That's why it is called _infinite_ impulse response. I can see 2 options for your processing. 1. Wait, gather all the samples, finally do the processing before displaying the array `data` 2. Do it **real-time**! Keep in mind that the filtered data must not be mixed with raw data. Otherwise the filtering will be distorted. Create a new array `filtered_data`. Each time a packet comes in, copy it in `data` array, then copy `data` array in `filtered_data` and call `filter.process(filtered_data)`. Finally display `filtered_data`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, websocket, socket.io, signal processing" }
Fatal Error with NSURL ofType MP4 When I build and run my project I get a fatal error (see image below). I believe there is a problem with the `NSURL` but unsure what part is wrong. I have replaced the video with a different video and it works. There is not a problem with the video as I have played it in Quick Time Player. ![enter image description here]( Hope someone can help!
Make sure the file it is in the proper format. Use your finder to get info of your file and check if the More Info: Codecs: it is showing H.264, AAC.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "xcode, swift, video, nsurl" }
Bash: how to interrupt this script when there's a CTRL-C? I wrote a tiny Bash script to find all the Mercurial changesets (starting from the tip) that contains the string passed in argument: #!/bin/bash CNT=$(hg tip | awk '{ print $2 }' | head -c 3) while [ $CNT -gt 0 ] do echo rev $CNT hg log -v -r$CNT | grep $1 let CNT=CNT-1 done If I interrupt it by hitting ctrl-c, more often than not the command currently executed is "hg log" and it's that command that gets interrupted, but then my script continues. I was then thinking of checking the return status of "hg log", but because I'm piping it into grep I'm not too sure as to how to go about it... How should I go about exiting this script when it is interrupted? (btw I don't know if that script is good at all for what I want to do but it does the job and anyway I'm interested in the "interrupted" issue)
Rewrite your script like this, using the $PIPESTATUS array to check for a failure: #!/bin/bash CNT=$(hg tip | awk '{ print $2 }' | head -c 3) while [ $CNT -gt 0 ] do echo rev $CNT hg log -v -r$CNT | grep $1 if [ 0 -ne ${PIPESTATUS[0]} ] ; then echo hg failed exit fi let CNT=CNT-1 done
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 7, "tags": "bash, interrupt, copy paste" }
Can I register multiple *.tlb files at once in Inno Setup? When I try to register all the *.tlb files using a wildcard: RegisterTypeLibrary(Is64BitInstallMode, ExpandConstant('{app}') + '\TLB\*.tlb'); I get the runtime error 0x80029C4A. Does it mean that I have to register all the files one by one? Is there a way to register a folder?
You cannot use a wildcard for registering the .tlb file. See the documentation: > Prototype: procedure RegisterTypeLibrary(const Is64Bit: Boolean; const Filename: String); e.g. **RegisterTypeLibrary(Is64BitInstallMode, ExpandConstant('{sys}\stdole2.tlb'));** Also check the correct platform: **Is64BitInstallMode()** has nothing with .tlb bitness (you can register 32 bit .tlb on 64 bit system without any problem. The exception is shown if you try to register library for incorrect platform, which might be your problem. * Extra tip: try to run the installer as _Administrator_ , usually the libraries have to be registered in admin mode.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "registry, inno setup, tlb" }
A continuous function on a closed subset of real line can be continuously extended I need help with this question as I'm not sure Let $f$ be a continuous function on $K$ which is closed in the real line. Show that there exists a continuous $F$ on all of $R$ such that $F(x)=f(x)$ on $K$. So I'm not sure which theorem to use in Folland to prove this. If anyone can hint on what to do, I'd be grateful.
You could use Tietze's extension theorem because the real line is normal. Alternatively you could consider the connected components of the complement of $K$, these are all open intervals of the form $(-\infty, b)$, $(a,\infty)$ or $(a,b)$ and define $F$ in each interval accordingly.
stackexchange-math
{ "answer_score": 2, "question_score": 3, "tags": "real analysis, measure theory, continuity" }
Oracle-SQL Single select, cascade by field I'm not entirely sure how to phrase what I mean. Let me try: Is there a way to select all elements that cascade by a reference field? For instance, I have the rows: parentRef | Reference | Data ------------------------------ aContainer | mainObj | "Parent" mainObj | secondObj | "Child 1" secondObj | thirdObj | "Child 2" nonExistent | blankObj | "Don't select me!" And I want to select mainObj, secondObj, thirdObj in a single statement when I only know one parentRef: "aContainer". Is this possible? I could do this by having my code perform many queries: `select...where parentRef = 'aContainer'`, then `select...where parentRef = 'mainObj'`, etc, but I really don't want to hammer my DB with many queries, primarily for speed. Edit: Tree Queries! That's the search term I needed.
Oracle can do Tree Queries, have a look at START WITH and CONNECT BY
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "sql, oracle, connect by" }
Clearing jQuery animation correctly In my code I am animating objects on each carousel item like so: first_text1.fadeTo(textDuration, 1, function(){ second_text1.fadeTo(textDuration, 1); }); When the slide changes I call the following where `$animations` contains all the objects which have any animation added to them: $animations.stop(true, true); and then I call: $animations.each(function() { $(this).removeAttr('style'); }); to remove any of the inline CSS which is left by the animations so I can repeat the animations when returning to that slide. My problem is the style never gets removed from the second callback animation which would be `second_text1` in the above code. How can I fix this?
The problem here turned out to be the selectors in the variables, where some had more than one variable. E.g. var first_text2 = $('li#region-2 .text-elements h2, li#region-2 .text-elements h3'); var second_text2 = $('li#region-2 .text-elements p'); Thee removeAttr function was not working properly on all of the elements in the variable. To fix this I had to call first_text2.each( function() { $(this).removeAttr('style'); }); Apologies for not displaying more code in my question originally!!
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "jquery, css, jquery animate" }
Two energy level classical system Consider a system of $N$ particles obeying classical statistics, each of which can have energy $0$ or $E$. The system is in thermal contact with a reservoir maintained at a temperature $T$. What will be the internal energy and heat capacity of the system? I can't make head or tail out of it. I know that the Maxwell Boltzmann distribution function is $Ae^{-E/kT}$. In that $A$ depends upon the number of particles in the system. But when I substitute $0$ for energy $E$, $A$ becomes equal to the number of particles in state of energy $E$. How can this question be approached? Greatly appreciate any help. Thanks in advance.
The system is classical so the particles are distinguishable. In such a system ,you can just find out the single particle partition function which will then give you total partition function of the system. Once the partition function is known ,energy and heat capacity can be found by taking some simple derivatives.
stackexchange-physics
{ "answer_score": 2, "question_score": 0, "tags": "homework and exercises, statistical mechanics" }
Why modulo prime prefered over modulo composite? In encryption process (aes encryption), and also in Galois field, a prime number is always used to perform the modulo operation. So I wanted to know the reason for using only prime numbers for modulo operations ?
The nice things about primes is that when looking at the numbers modulo a prime, you can always "divide" by anything non-zero. In particular, if you want to solve the equation $$ ax \equiv b \pmod p $$ where $a \not \equiv 0$, and $b$ is any number, there exists some $(1/a)$, so that $$ (1/a)ax \equiv (1/a)b $$ or in other words, $$ x \equiv b/a $$ In mathematical terms, the numbers modulo a prime form a _field_ , whereas the numbers modulo a composite number only form a _ring_. To see how this _doesn't_ work for composites, note that $$ 2x \equiv 1 \pmod 6 $$ has _no_ solution, which is to say that $2$ has no multiplicative inverse.
stackexchange-math
{ "answer_score": 5, "question_score": 3, "tags": "prime numbers, modular arithmetic" }
upgrading Biztalk 2004 to Biztalk 2006 R2 I have a client running a 1/2 dozen or so orchestrations running on Biztalk 2004 (that I wrote) that they use to exchange cXML documents (mostly too send orders) with their suppliers. It has a ASP.NET 1.1 front end. It uses the SQL adapter to store the parsed cXML. I gets & sends the documents via HTTPS. My question: Is the upgrade to Biztalk 2006 R2 as straight forward as MS says? Any advice or things I should watch out for?
We finished a similar upgrade last year with little effort other than importing the projects into Visual Studio 2005. The upgrades were without issue. The biggest problem we had was with the various deployment scripts we used. There was a bit of rewriting to work with some of the new features of 2006. We also had to adjust to the multiple-host model for our apps. But all in all, no problems - just more features and API changes on deployment. Best of luck.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "biztalk, biztalk2006r2" }
How to compile a Spark job for Cloud Dataproc that reads CSV files from GCS? I'm trying to use Google Cloud Dataproc to run a Spark ML job on CSV files stored in GCS. But, I'm having trouble figuring out how to compile the fat JAR for submission. I can tell from the docs that cloud dataproc nodes have the connector pre-installed, but I don't know how to add the connector to my SBT config so I can develop and compile a fat JAR locally to submit to dataproc. Is there a line I can add to my `build.sbt` so I have access to the connector locally (i.e. so it will compile)? And mark as "provided" if necessary so that it doesn't conflict with the version pre-installed on the worker nodes? Any pointers or examples would be super appreciated. TIA!
To reference the connector explicitly in build.sbt: libraryDependencies += "com.google.cloud.bigdataoss" % "gcs-connector" % "1.6.1-hadoop2" % "provided" Note that this is the unshaded version of the library. On Dataproc clusters, the shaded artifact is provided and this artifact can be found on maven central with the 'shaded' classifier: libraryDependencies += "com.google.cloud.bigdataoss" % "gcs-connector" % "1.6.1-hadoop2" % "provided" classifier "shaded" For development, you may be able to get away with just using the Hadoop FileSystem interfaces and when deploying to Dataproc using paths of the form 'gs://[bucket]/[path/to/object]' instead of local paths.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "apache spark, google cloud platform, google cloud storage, google cloud dataproc" }
Show that $\frac 1n\sum_{k=1}^n f_k(x) \to f(x)$ uniformly on $E$. I have the following: > Let $E$ be a nonempty subset of $\mathbb{R}$ and $f$ be a real-valued function defined on $E$. Suppose that $f_n$ is a sequence of bounded functions on $E$ which converges to $f$ uniformly on E. Show that as n $\to \infty$, > > $\frac 1n\sum_{k=1}^n f_k(x) \to f(x)$ uniformly on $E$. I know that uniform converges implies pointwise converges, but this doesn't seem like much help here. If $f_n(x)$ was continuous, it would make the problem a bit easier, but I have no idea if this is the case. Would appreciate some help.
Let $\varepsilon>0$, there exists $p\in\mathbb{N}^*$ such that $|f_k(x)-f(x)|<\varepsilon$ for all $x\in E$ and $k\geqslant p$. Now, if$x\in E$ $$ \left|\frac{1}{n}\sum_{k=1}^n{f_k(x)}-f(x)\right|\leqslant\frac{1}{n}\left|\sum_{k=1}^{p-1}{(f_k(x)-f(x))}\right|+\frac{1}{n}\sum_{k=p}^n{\underbrace{|f_k(x)-f(x)|}_{\varepsilon}} $$ For $n$ large enough $$ \frac{1}{n}\left|\sum_{k=1}^{p-1}{(f_k(x)-f(x))}\right|<\varepsilon $$ so that $$ \left|\frac{1}{n}\sum_{k=1}^n{f_k(x)}-f(x)\right|<2\varepsilon $$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "real analysis" }
Why Pylons allowing duplicate action in same controller Anyone knows why Pylons allowing duplicate action in same controller instead of throwing error? And the controller ignores first duplicate action and always serves the second duplicate?
being python the second function definition overrides the first. drop this code in a file called test.py # test.py def my_func(): print "i will never get called" def my_func(): print "awesome" my_func() and run it $ python test.py awesome no errors, same applies for methods on objects.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "python, pylons" }
Featured tab shows heavily downvoted questions Is the Featured tab meant to show any and all questions with a bounty? I have seen heavily downvoted questions appear time and again in that tab. For example: !Downvoted + Featured This is an off-topic question with 10 DVs, yet it still appeared at the top of the Featured page. What is going on?
Yes, that's exactly how it works. If you hover over the tab, it will tell you "Questions with open bounties" - that is the only criteria for a question to appear there, having an open bounty.
stackexchange-meta_stackoverflow
{ "answer_score": 4, "question_score": -2, "tags": "discussion, downvotes, user interface" }
Pascal To C Translation I have a program that takes a shot of the screen in pascal: uses Graphics, LCLIntf, LCLType; var Screen: TBitmap; ScreenDC: HDC; begin Screen := TBitmap.Create; ScreenDC := GetDC(0); Screen.LoadFromDevice(ScreenDC); ReleaseDC(0, ScreenDC); Screen.SaveToFile("Screen.bmp"); end. My question rests on the `LoadFromDevice()`, and `SaveToFile()` functions. What function(s), (if any), could be used to implement these in the C programming language. Trying to keep away from third party libraries as close a possible. (WinAPI)
Look At this HDC hDC = GetDC(g_hWnd); LPRECT rect = (LPRECT)malloc(sizeof(RECT)); GetWindowRect(g_hWnd,rect); int h = rect->right - rect->left; int w = rect->bottom - rect->top; LPRECT rect = (LPRECT)malloc(sizeof(RECT)); GetWindowRect(g_hWnd,rect); HBITMAP hBmp = CreateCompatibleBitmap(hDC,w,h); PBITMAPINFO pbmi; pbmi = CreateBitmapInfoStruct(g_hWnd,hBmp); CreateBMPFile(g_hWnd, TEXT("c:\\TEMPO\\TestG2.bmp"), pbmi, hBmp, hDC) ; ReleaseDC(g_hWnd,hDC); DeleteObject(hBmp); DeleteObject(pbmi); if (rect != nullptr) free(rect);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c, winapi, graphics, gdi, freepascal" }
Sharing Set Not Working I have a custom object called Requisition. The idea is that a community user will create a requisition. The requisition will be re-assigned to a queue for processing. This is all working fine. I have defined a sharing set for the community so that the community users will still be able to view requisitions while they are being worked. ![Sharing Set]( After a user creates a requisition it is re-assigned and the user immediately loses visibility. Am I Missing something with my sharing set? ## Note I am good enough with apex that I could write a trigger to automatically share the record whenever the owner changes. I just don't think that is/should be necessary. ## Update I noticed my list views were all set to "my requisitions" I changed them to show "all requisitions" instead and still no luck. ## Update 2 When I copy/paste the Id of the requisition into the URL I get a page not found error.
Based on your screen shot, it looks like you need to apply the Sharing Set to a Profile to get it to grant access: > 5. Select the profiles of the users to whom you want to provide access. >
stackexchange-salesforce
{ "answer_score": 1, "question_score": 0, "tags": "sharing sets" }
How can I access a field in an anonymous type stored in an object variable? Let's say I have code that looks like this: public struct Foo { public object obj; public Foo(int val) { obj = new { bar = val }; Console.WriteLine(obj.bar); // Can't access bar. } } Normally I see anonymous types stored in implicitly-typed variables, and their fields can be accessed just fine in that case. But I can't implicitly type with var in this case because `obj` is a field in a struct and apparently can't be initialized. So how do I access the field `bar`?
Use the `dynamic` keyword: public struct Foo { public dynamic obj; public Foo(int val) { obj = new { bar = val }; Console.WriteLine(obj.bar); // is accessible now } }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, object, struct, var, anonymous types" }
Why does 2.11.1 fail with error: not found: type Application? I'm trying to compile the following code: object Main extends Application{ println("Hello World"); } But I'm getting this error: /Users/xx/JavaProjects/ScalaApplication1/src/scalaapplication1/Main.scala:8: error: not found: type Application object Main extends Application{ ^ one error found I'm using Scala 2.11.1.
`Application` has been deprecated from scala 2.9, probably it has been deleted in scala 2.11 (it still exists in scala 2.10) even though at the moment I can't find proofs for that, use `App` instead. Proof found, this is the scala 2.11 branch on github which has only an `App.scala` and this is the 2.10 which has `App.scala` and `Application.scala` with a deprecated warning.
stackexchange-stackoverflow
{ "answer_score": 29, "question_score": 22, "tags": "scala" }
In C++ is there a proposed type traits helper for "copying" reference category and cv-qualification? For the SFINAE in the hypothetical call operator in this answer I need a type trait that "copies" reference category and const/volatile qualifications from one type to another: template <typename T, typename U> using copy_category_and_qualifications_t = [...]; copy_category_and_qualifications_t<int, char> // char copy_category_and_qualifications_t<const int&, char> // const char& copy_category_and_qualifications_t<volatile int&&, char> // volatile char&& I seem to recall some proposed addition to `type_traits` for this. Does anybody have a reference to this proposal, or know if it was added for C++20 or C++23?
P1450 called this `copy_cvref` and `clone_cvref` (the former just applies the qualifiers to the 2nd parameter, the latter first removes the qualifiers from the 2nd parameter). The former is useful, I don't think I've ever personally had a need for the latter. P0847 uses `like_t` and `forward_like` in a few contexts, `like_t` there is basically P1450's `copy_cvref` (the latter is... a significantly better name). `forward_like` is separately proposed in P2445 (though without the other type trait helper).
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "c++, typetraits, c++23" }
How to pass in a read bash variable in linux and sent it as a message in git commit? I would like to automate the git commit function and be able to read in a message like as follows in bash: echo -n "Enter message and press [ENTER]: " read mess cd /my/dir git add * git commit -m "$(mess)" However, it tells me in bash that in `line 6: mess: command not found.` Is there something I am doing wrong?
In your script, `$(mess)` denotes a sub-shell which executes the command `mess`; which isn't a real command. Replace the parenthesis with brackets. echo -n "Enter message and press [ENTER]: " read mess cd /my/dir git add * git commit -m "${mess}" **Update** Per the bash manual, under command substitution it states the following, > Command substitution allows the output of a command to replace the command name. There are two forms: $(command) or `command` Bash performs the expansion by executing command and replacing the command substitution with the standard output of the command, with any trailing newlines deleted.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "linux, bash, git" }
Как в Sublime Text 3 установить вертикальную линию на 80 символе В Geany например она есть ![Линия на 80 символе]( Как сделать ее в Sublime?
Выберите > View -> Ruler -> 80 Можно сделать еще так, чтобы текст сам переносился после 80 символов: > View -> Word Wrap Column -> 80 (должна быть выставлена опция View -> Word Wrap) Так же можно задать все выше перечисленное в конфигурационном файле, к которому можно "достучаться" по следующему пути: > Preferences -> Settings - User Установив у ключа `"rulers"` значение в массиве (в вашем случае 80): "rulers": [80], Если вы хотите отобразить две линии, перечислети значения в массиве: "rulers": [80, 120], Кроме того, в этом же файле пользовательских настроек можно установить: автоперенос слов и его параметры, шрифт, размер шрифта и многое другое =) Более подробно о форматировании конфигурационных файлов _Sublime Text_ смотрите в этом ответе.
stackexchange-ru_stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "sublime text, sublime text 3" }
Fast way to merge points in overlapped in same position All: Suppose I have tons of points (x, y), could anyone show me a fast way(simple algorithm preferred) to remove the duplicated position value points in Javascript? What I can think about is like: sort them by x and compare one by one.
What you seem to be looking for is some sort of `HashSet` for Javascript. Conveniently enough for our purposes, Javascript `Objects` behave enough like that to do what you want in a really simple way: // Assuming points is an array of objects that look like {x:i, y:i} var uniquePoints = {}; for (var i = 0; len = points.length; i < len; i++) { var point = points[i]; uniquePoint[point.x + '_' + point.y] = point; } At the end of the `for` loop, you'll have an object containing all unique points.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "algorithm, duplicate data" }
Undefined variable (Laravel 5.7) Why I get this error? > ErrorException (E_ERROR) Undefined variable: users (View: /Users/acny/Desktop/Actor/resources/views/home.blade.php) function of controller : public function getData() { $users = DB::table('users')->get(); return view('home', compact('users')); } and .blade : @foreach ($users as $user) {{ $user }} @endforeach Thank for your help!
You are getting error from `home.blade.php`, but `getData()` try to load in`user/index.blade.php`. Are you sure your request going through method `getData()`?
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "laravel, laravel 5.7" }
how to add menu on wordpress dashboard? when I have add menu on wordpress it has been added but after save the menu it is not save on menu, I don't have any solution please assist me what is the problem there is. Thanks in Advance
Please contact to your hosting provider to change in file php.ini max_input_vars = 5000 suhosin.post.max_vars = 5000 suhosin.request.max_vars = 5000 Thanks.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "wordpress" }
Extract new dictionary from a list of dictionaries I have a list of dictionaries, I would like to create a new dictionary where the first key `'value'` corresponds to the second value of the `'b'` key of each dictionary in the list. The second key `'number'` of the new dictionary corresponds to the third (therefore last) value of the `'b'` key of each dictionary in the list. my_list = [ { 'a': (2.6, 0.08, 47.0, 1), 'b': (5.7, 0.05, 1) }, { 'a': (2.6, 0.08, 47.0, 2), 'b': (5.7, 0.06, 2) } ] expected output: new_dic = {'value': (0.05, 0.06), number = (1, 2)}
you can use comprehension as follows: new_dict = {} new_dict['value'] = tuple(val['b'][1] for val in my_list) new_dict['number'] = tuple(val['b'][2] for val in my_list) Note that you need to call the tuple constructor, because `(val['b'][2] for val in my_list)` alone returns a generator object.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -2, "tags": "python, list, dictionary" }
Floyd–Warshall algorithm on undirected graph I am referring to the algorithm from the Wikipedia page on the Floyd-Warshall algorithm. In case of undirected graphs should I change the assignment statement inside the `if` condition to dist[i][j] = dist[j][i] = dist[i][k] + dist[k][j] or they are equivalent?
Every undirected graph can be represented as directed graph by replacing every edge $(i,j)$ with 2 edges $(i,j); (j,i)$. And if you're running Floyd–Warshall algorithm on such directed graph - it would work correctly, as always.
stackexchange-cs
{ "answer_score": 6, "question_score": 3, "tags": "algorithms, graphs, optimization, shortest path" }
Listing more than 10 million records from Oracle With C# I have a database that contains more than 100 million records. I am running a query that contains more than 10 million records. This process takes too much time so i need to shorten this time. I want to save my obtained record list as a csv file. How can I do it as quickly and optimum as possible? Looking forward your suggestions. Thanks.
I'm assuming that your query is already constrained to the rows/columns you need, and makes good use of indexing. At that scale, the only **critical** thing is that you don't try to load it all into memory at once; so forget about things like `DataTable`, and most full-fat ORMs (which typically try to associate rows with an identity-manager and/or change-manager). You would have to use either the raw `IDataReader` (from `DbCommand.ExecuteReader`), or any API that builds a non-buffered iterator on _top_ of that (there are several; I'm biased towards dapper). For the purposes of writing CSV, the raw data-reader is probably fine. Beyond that: you can't make it go much faster, since you are bandwidth constrained. The only way you can get it faster is to create the CSV file **at the database server** , so that there is no network overhead.
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 10, "tags": "c#, performance, oracle" }
How do I have my king fight in battles? When I first played Crusader Kings 2 I remember my king participating in battles. How do I get my king to take up arms and go out into battle?
You need to assign your King as the leader of one of the three flanks of your army. To do this, select your army and click the blue name on one of the three flanks. Find and assign your King. If you are in enemy territory, you will need to either have your army be on the move or switch from siege view to army view. **Note** : There are certain things that may prevent you from doing this such as your "Title Revokation" law setting, and if you are serving a higher liege in their court actively. _Note the blue names below_ ![Notice the blue names](
stackexchange-gaming
{ "answer_score": 4, "question_score": 3, "tags": "crusader kings 2" }
Determinant of a block matrix in which the lower right is the zero matrix Let $D=\begin{pmatrix} C & A \\\ B & 0 \end{pmatrix}$ where $C$ is $k\times n$, $A$ is $k\times k$ and $B$ is $n\times n$. Let $P=\begin{pmatrix}A & C \\\ 0 & B\end{pmatrix}$. I'm given that $\operatorname{det}\begin{pmatrix} A & C \\\ 0 & B \end{pmatrix}=\operatorname{det}(A)\operatorname{det}(B)$. I want to find $\operatorname{det}D.$ Can I use elementary column operations on the matrix $D$ in order to get it into the same form as $P$? Or is that going to cause a problem with signs?
**Hint:** You can use elementary column and row operations to change $D$ to $P$, where $\det(D)=(-1)^m\det(P)$. Also you can use Laplace Expansion Theorem to show that |A||B| is the only cofactor product left in expanding $D$ into sum of cofactor products of $k\times k$ and $(n-k)\times (n-k)$.
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "linear algebra, matrices, determinant" }
how to work around "Your device does not qualify for bootloader unlocking I've followed the guides but stupid Motorola is telling me that I can't unlock the bootloader so I'm blocked with sudo ./fastboot flash recovery twrp-3.0.2-0-surnia.img (bootloader) has-slot:recovery: not found target reported max download size of 268435456 bytes sending 'recovery' (16152 KB)... OKAY [ 0.509s] writing 'recovery'... (bootloader) Preflash validation failed FAILED (remote failure) finished. total time: 0.921s I'm working from an Ubuntu box.
You need to get the "cid" of the device by doing ./adb reboot bootloader sudo ./fastboot getvar all In my case it gives (bootloader) cid: 0x0001 and as you can see at the official website, Lenovo/Motorola says "Your device is NOT eligible for bootloader unlock". You _buy_ their phone and they still control it. Wait, what?
stackexchange-android
{ "answer_score": 2, "question_score": 1, "tags": "recovery mode, bootloader, bootloader lock" }
A local ring not a quotient of a regular local ring In his book _Commutative Ring Theory_ , Matsumura proves that if a local ring is equidimensional, and a quotient of a regular local ring, then its completion is equidimensional. What is an example of a local ring which does not admit such a presentation?
A source available online is this paper "Examples of bad Noetherian rings" by Marinari (example 2.1). The reason many of these types of construction work is because of the following vague and counter-intuitive phenomemon: _It is usually easier than we think for a complete local ring to be a completion of a Noetherian ring with certain properties._ For example, there is this amazing theorem by Heitmann that most complete local ring of depth at least $2$ is a completion of a UFD ! So back to Marinari's paper, the example is as follows: start with some local Artinian ring $(Q,m)$ such that $Q$ is not Gorenstein. Then $Q[[X]]$ is complete, and one can find a local domain $R$ such that $\hat R=Q[[X]]$. Now if $R$ is a quotient of a regular local ring, then the comletion of $R$ is generically a complete intersection. But $Q[[X]]$ is not even generically Gorenstein, since $Q$ is not.
stackexchange-mathoverflow_net_7z
{ "answer_score": 15, "question_score": 11, "tags": "ac.commutative algebra" }
Angular, build error model I'm trying to build the Angular app I'm working on but recently It does not work. I was working on model folder, there are just typescript classes **inside the src folder** The error: Module build failed: Error: **C:\Users\USER\PhpstormProjects\holidaywatch\src\app\model\country.model.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.** Everything is included in the src folder (there is no app content out of this folder). I read that angular compiles everything inside the src folder and there is no need to add path in some tsconfig. Did someone face the same problem as I did? I didnt change much. I just added one class to model folder and project didnt build.
I solved it. Well. I kinda solved it. I reinstalled whole node.js, deleted node_modules and redownloaded it. After this, the angular had no more problems with this. I really dont know what caused this, but If you face this, this is possible "solution".
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "angular, typescript, angular cli" }
What is the max byte size that can be transferred in one package via http(s)? so as far as I understand when there is a `GET` request, the data is send from the server to the browser in multiple packages, depending on the size of the request. I am wondering how much bytes fit into one package. I am pretty sure I read this somewhere once, but I can not find the reference. Also does this differ from http to https? Thanks.
You mean IP package? For IPv4 the maximum size is 576 bytes while for IPv6 its 1280 bytes. Read this: < It doesn't depend on the protocol as long as it is transmitted over IP.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "http, browser, request, size" }
GitHub : commit display previous account username I have one issue with github , before month i have setup git account (user1) on github and worked with git from my system. now i have created second account (user2) and add new rsa_id key in ~/.ssh folder (take backup of old keys in another folder). Now when i follow the steps shown on github > Global setup: > > Set up git git config --global user.name "user2" > git config \--global user.email [email protected] > > > Next steps: > > mkdir Web > cd Web > git init > touch README > > git add README > git commit -m 'first commit' > git remote add origin [email protected]:user2/Web.git > git push -u origin master when i committed it would display previous account username (user1). what should be issue here and how can i resolve this? thanks.
Try doing: ssh -T [email protected] It should print out the `user2` username that you want. If not, make sure you have added the keys properly to the account and the proper keys are being presented. Use `-v` flag in the above command to see what's happening. Note that Github uses the configured email to associate commits with the user. So verify that it is really set ( `git config -l` etc. and verify)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "git, github" }
i have proble to count record from multiple field the result of query is like this SELECT d.icd_code,c.icd_verif2,c.icd_verif3, d.jenis_penyakit , COUNT(*) as totalapsien,e.nama as NamaPoly FROM t_diagnosadanterapi c, icd d, m_poly e WHERE c.status = '2' and c.icd_verif = d.icd_code and c.kdpoly = e.kode GROUP BY c.icd_verif, c.kdpoly, d.jenis_penyakit, e.nama, c.icd_verif2,c.icd_verif3, d.icd_code ORDER BY c.icd_verif ASC what i want is count field from icd_code to icd_code3 as jumlahpasien
I think this is what you are trying to achieve: > get `icd_verify` with values that are linked to your `icd_code`. **in order to get this, we must:** > > 1. left join icd to include those with no matching verif. > 2. use coalesce to to check values from verif 1 to 3 > 3. Need to change the way you join the tables, its quiet an old style. > select d.icd_code, c.icd_verif2,c.icd_verif3, d.jenis_penyakit , count(1) as totalapsien , sum(case when coalesce(c.icd_verif1, c.icd_verif2, c.icd_verif3, 0) != 0 then 1 else 0 end) as jumlahpasien , e.nama as NamaPoly from t_diagnosadanterapi c left join icd d on c.icd_verif = d.icd_code inner join m_poly e on c.kdpoly = e.kode where c.status = '2' and group by c.icd_verif, c.kdpoly, d.jenis_penyakit, e.nama, c.icd_verif2, c.icd_verif3, d.icd_code order by c.icd_verif asc
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "sql, postgresql" }
How to set HeaderTemplate Property of HeaderedContentControl Programmatically I am working in WPF and I need to set the Text and ToolTip of a **Header** of a HeaderedContentControl. So what I am trying to do is to create a template as below: System.Windows.DataTemplate template = new System.Windows.DataTemplate(); template.DataType = typeof(HeaderedContentControl); System.Windows.FrameworkElementFactory blockFactory = new System.Windows.FrameworkElementFactory(typeof(TextBlock)); blockFactory.SetValue(TextBlock.TextProperty, "The Header Text"); blockFactory.SetValue(TextBlock.ToolTipProperty, "The ToolTip"); template.VisualTree = blockFactory; myHeaderedContentControl.HeaderTemplate = template; But when I run the program the header is displayed empty. What am I doing wrong? Hope someone can help, Thank you in advance
Have no idea why do you use template in a such way. Why not just set header property with the text block? myHeaderedContentControl.Header = new TextBlock { Text = "Some text", ToolTip = "Some tooltip" }; Moreover, it is even better idea to define all that in XAML: <HeaderedContentControl x:Name="control"> <HeaderedContentControl.Header> <TextBlock Text="Some text" ToolTip="Some tooltip"/> </HeaderedContentControl.Header> </HeaderedContentControl>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, wpf, header" }
Highest resolution for Google / Bing map API I am using Google static map with scale value 2: example. I want better resolution for both Google and bing map. I did not find anything useful for bing map regarding this. But for Google Map I found this documentation page, which is very useful and I tried `scale:4` to get better resolution but as written on site I was unable to do this.
**Google Maps** In free API you can't use scale 4. You can have 1280x1280 as the highest resolution like this. You should use Google Maps API for work to do this. **Bing Maps** In Bing you can have 900px x 834px image, but I tried, and get the result that, It will work with 1440px x 937px(either can be height or width). You can try it too. 937x1440 Image and 1440x937 is acceptable too. Hope this will help :)
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 1, "tags": "google maps, bing maps" }
「星のカービィ」- Why ィ and not ー? The Nintendo character Kirby's name in Japanese is , pronounced "Hoshi no Kābī". For the , a is used for extending the vowel sound. For the , though, a small is used. I thought the small vowels were used for modifying the vowel in an existent sound without extending it, for example in , to make "ti", or in , to make "vi". With , however, that is of course not necessary, as the vowel is already "i". In hiragana, normal vowels are used for extension, but those are 1) not small, and 2) not used in katakana. So why is this? And how does it work? Under what grammatical rule does the small vowel extend the sound, and why is used for and not for (which I think it normally would, such as in )?
When a small vowel is added to a kana with the same vowel sound, it does indeed work the same as a []{chōonpu}. (If the kana has a different vowel sound, then the sound is not extended.) There are no hard and fast rules about this, but it seems that the here is used in proper nouns to indicate that the English spelling ends with "y" instead of being written "ii", "i" or "ī". Other examples include * : Lucky Ikeda, a comedian * : fuzzy logic
stackexchange-japanese
{ "answer_score": 5, "question_score": 6, "tags": "grammar, katakana, orthography" }
getting main diagonal of square matrix in linear representation I have int array representing elements of square matrix. I need to get rows,columns, 2 main diagonals of it. I have trouble with getting second diagonal (for 3*3 matrix it is elements with indexes 2,4,6 for 6*6 - 5,10,15,20,25,30). I'm wondering is there a neat way to do it without for loops. var matrix = new int[] { 6, 7, 2, 1, 5, 9, 8, 3, 4 }; int size = 3; int i = 0; var rows = matrix.GroupBy(x => i++ / size); i = 0; var columns = matrix.GroupBy(x => i++ % size); var diag1 = matrix.Where((x, index)=>index%(size+1)==0); var diag2 = matrix.Where((x, index) => index % (size - 1) == 0);//PROBLEM - takes 0,8 indexes also.
Try this var matrix = new int[] { 6, 7, 2, 1, 5, 9, 8, 3, 4 }; int size = 3; var rows = matrix.Select((x,i) => new {x = x, i = i}).GroupBy(x => x.i / size).Select(x => x.Select(y => y.x).ToArray()).ToArray(); var columns = matrix.Select((x, i) => new { x = x, i = i }).GroupBy(x => x.i % size).Select(x => x.Select(y => y.x).ToArray()).ToArray(); var diag1 = matrix.Where((x, index) => (index /size) == (index % size)).Select(x => x).ToArray(); var diag2 = matrix.Where((x, index) => (index / size) == (size - 1) - (index % size)).Select(x => x).ToArray();
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, enumerable" }
apex:input with oncomplete I have an input number and a button which performs an action on the input, and it is working nicely: <apex:input type="number" value="{!addCount}"/> <apex:commandButton action="{!addRows}" value="Generate Participants" rerender="messages, documents"/> Now I would like to put an onchange into the and remove the buttons. <apex:input type="number" value="{!addCount}" onchange="addRows"/> <apex:actionFunction action="{!addRows}" name="addRows" rerender="messages, documents"/> Why does this not work?
You need to actually invoke the function for `onchange` attributes by using parentheses (`()`). **No Good** <apex:input onchange="someMethod" ... /> **Good** <apex:input onchange="someMethod();" ... /> Note that if you want this event to fire every time you hit a key, you should probably switch from `onchange` to `onkeyup`.
stackexchange-salesforce
{ "answer_score": 5, "question_score": 3, "tags": "visualforce, javascript, actionfunction" }
MooTools: Attaching to destroy() event There's a div element on my page. When the page loads, I want to specify somehow that after destroy() is called on this element (based on what the user does in the UI), that a function I specify fires. How can I attach to the destroy() event?
you can just build a new element method - something like this. Element.implement({ smartDestroy: function(callback, options) { this.destroy(); var options = options || {}; if ($type(callback) === "function") callback.pass(options)(); return null; } }); $("foo").smartDestroy(function(options) { alert(options.message); }, {message: "gone"}); aside from that, destroy() has no events it can raise - you should be ok with above and you can tweak it to do whatever you need. <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "events, mootools" }
The sum of series involving binomial coefficients Could someone help me find: $$\sum_{k}k \binom{n}{k}p^k(1-p)^{n-k}\\\ and \sum_{k}k^2 \binom{n}{k}p^k(1-p)^{n-k}\\\ 0\leq p\leq 1, k\in N, n\ggg k $$ I know the answer to the first one is np, and the second is np(np-p+1) by simulation. But I am not able to prove them. Can you generalise for all powers of k? It is obvious for 0. $\sum_{k} \binom{n}{k}p^k(1-p)^{n-k}=[p+(1-p)]^n=1$ Wikipedia has a few nice solutions for similar series. <
HINT: $$k\cdot\binom nk=k\cdot\frac{n!}{(n-k)!\cdot k!}=k\cdot n\frac{(n-1)!}{\\{(n-1)-(k-1)\\}!\cdot (k-1)!\cdot k}=n\binom{n-1}{k-1}$$ Now, use the above method to find $\displaystyle k(k-1)\binom nk=n(n-1)\binom{n-2}{k-2}$ Again $\displaystyle k^2=k(k-1)+k,$ In general $$\sum_{0\le r\le m}a_rk^m=b_0k(k-1)\cdot\\{k-(m-1)\\}+b_1k(k-1)\cdot\\{k-(m-2)\\}+\cdots+b_m$$ where $a_r,0\le r\le m$ are given constants and $b_s,0\le s\le m$ are arbitrary constants to be determined by comparing the coefficients of the different powers of $k$
stackexchange-math
{ "answer_score": 3, "question_score": 3, "tags": "summation, binomial coefficients" }
Civievent 'Cancel' clarification - does 'Cancel' generate a refund / balance I've recently had to deal with cancelled event and refunds. At the moment my workflow is to: 1. Issue a refund via the payment process (PayPal) 2. PayPal updates contribution with refund transaction. 3. I then 'Cancel' the event registration for the contact. I suspect it's not the case, but I'm seeking clarification on this following: If I do it in reverse and first 'Cancel' a contact from an Event, does it automatically issue a refund with the payment processor? If not, does that leave a Balance associated with that contact/contribution? Can I apply (how do I apply) that balance to future events? Any insight appreciated. Much thanks :)
AFAIK Civi won't cancel/refund the payment automatically at Paypal when a payment is cancelled in Civi. It's the other way around when a payment is cancelled at Paypal it sends a notification to Civi about the payment. Civi based on the notification updates/cancels the payment in Civi. So you should be doing 1. Issue a refund via the payment process (PayPal) 2. PayPal updates contribution with refund transaction. 3. I then 'Cancel' the event registration for the contact.
stackexchange-civicrm
{ "answer_score": 0, "question_score": 0, "tags": "civievent, workflow" }
In Java, to use the "super" keyword, do I have to import the target class? When, in a constructor, we use the super keyword, do we have to import the class the super refers to (when super doesn't refer to Object)? class A extends ... { A() { super(); // do we need to import the class super refers to? } }
Yes, because it is in the `extends` clause. The `super()` itself requires no imports, but for it to make sense you need a superclass. You don't need to import it, of course, if it is from `java.lang`
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 3, "tags": "java, super, superclass" }
extract file path right before jar Lets say you are using any kind of fileIO, public class example{ public Example(){ File file = new File(getClass().getProtectionDomain().getCodeSource().getLocation()); //file IO process .... } } by using `getClass().getProtectionDomain().getCodeSource().getLocation()` you'll get the full path with the "example.jar". so, how can you get that file location but without the "example.jar" ? (so actually the folder where the jar is located but not the link to the jar itself)
You can use file.getParentFile() See `File#getParentFile()`
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 3, "tags": "java, jar, filepath" }
Showing Canvas Outside UserControl boundary I've found several threads on various sites vaguely related this, but no solid answers. Here's a simplified example: I want to create a usercontrol that has a textbox and a small icon beside it. If you click the image, I want to have a canvas appear under the control that has information in it. The canvas would be outside the usercontrol's boundary. I have gotten this "sorta" working. If I put the textbox, graphic, and just a canvas on the control, with the canvas outside the clip of the usercontrol - I can make the canvas visible/invisible as desired. When I add stackpanels and such, it starts exhibiting odd behavior - sometime simply vanishing. So, here's the question - what is the right way to do this? Or, is there a "right way"?
what you need to do is put your canvas into a `<Popup>` control. then, show the popup when needed. Here is a video showing how to use a `<Popup>` control, Here is the MSDN documentation.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "silverlight, user controls, popup" }
I can't figure out how to add an text dynamically to the screen in a specific "X,Y" location I need to add a text to the screen in a specific location. does anyone have any sample code they can post?? Example: lets say I had to add "This is a text" to 50px left and 100px top but I had to do it dynamically. how could I do it?? Thanks! PS I'm **VERY** new to Javascript :]
Here is how to do that with JavaScript: // Create an HTML paragraph to hold the text var p = document.createElement('p'); // Add some text to it p.innerHTML = "Some text <span>and markup</span>"; // Give it position: absolute so you can position by x,y p.style.position = 'absolute'; // Define position p.style.left = '50px'; p.style.top = '100px'; // Add it to the body document.body.appendChild(p);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "javascript, text" }
Emacs Keybindings for all Text Inputs I type with ten fingers. I try to avoid all keys on the keyboard which are not easily accessible: * `Pos1` * `End1` * `Esc` * ... Up to now my fingers like the emacs key bindings, since they work in the editor and with bash: * `ctrl`-`a`: beginning of line * `ctrl`-`e`: end of line * `ctrl`-`k`: kill from cursor until end of line * `ctrl`-`y`: insert killed content (paste) I am currently switching from emacs to pycharm. Now I could modify pycharm (there is already a config with emacs key bindings). But still there are a lot of other applications like webbrowser, email client, ... which don't understand the key bindings. Ain't there a way to have the fundamental things available in all text inputs? **Update** I am not fixed to the emacs keybings. I am still young enough to learn a different one. But it needs to be accessible for ten finger typers: I don't want to leave keys `F` and `J` with my forefingers.
After searching the web several times for some minutes, the best page I found was this It explains the remapping of keys for keyboard layout colemark. But it can be used with QWERTY/QWERTZ, too. The remapping of above forum posting gets done with the command line tool `setxkbmap`. Update: I did not use `setxkbmap`, since it felt like a tool from the last century. Today (year 2016) Linux has IBus. But up to now I found no time to solve my idea with ibus. There is a tool which looks promising (ibus typing booster). But I have not tried it up to now.
stackexchange-askubuntu
{ "answer_score": 1, "question_score": 2, "tags": "command line, keyboard, shortcut keys, emacs" }
Very long redelivery time with ActiveMQ We are using Activemq and PooledConnectionFactory (with spring boot and Camel). We are using RedeliveryPolicy and nonBlockingRedelivery. Is it recommended/possible to have a very long redelivery delay + backoff in our AMQ redelivery. Is a redelivery for several days/weeks ok with Activemq? Thanks
ActiveMQ should be able to handle long redelivery times. However, I would caution you that message brokers like ActiveMQ work best when the messages are consumed relatively quickly so that they don't accumulate excessively in the queues. A message broker should not be treated like a database. Therefore, I'd say your use-case was _possible_ but not necessarily recommended.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "jms, activemq, connection pooling" }
docker-compose: seeing all the services together from command line I have the following yml file, the services are created correctly, but when installing wordpress I cannot logon to mysql and I need to understand why. I'm totally new to docker, I'd need to see all the services together from command line (bash), now I'm running a command like `$ sudo docker exec -ti 4295b34c014a /bin/bash` but I get a login to a specific service, how can I view wordpress and mysql together from cli? yml file (from here): version: '3.1' services: adminer: image: adminer ports: - '8080:8080' db: image: mysql volumes: - 'wptut:/var/lib/mysql' environment: MYSQL_ROOT_PASSWORD: mysqlpassword wordpress: image: wordpress ports: - '81:80' volumes: wptut: null
I'm not sure what you mean by viewing them together, but in order to check if they are running you can use `docker ps` and if you want to see the logs after you `docker-compose up -d` use `docker-compose logs -f`. You should also make sure in WordPress you are referencing your MySQL database properly. For hostname, you should probably use `db` instead of `localhost`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql, wordpress, docker" }
Modern tools for Java deployment I'm trying to find deployment tools for Java and have come across a few which seem outdated (I see the latest time stamps from 2010 or 2009) like ControlTier, Smartfog. I've been out of the loop on Java for a while but now need to deploy Java code to production. it is not within in a container, so basically I need pretty simple tasks such as compile, jar it up, sftp it to server, restart process. Something like capistrano for the ruby world. Are there any equivalent solutions for Java? I know I could use cap for Java as well, but I figured I'd ask in case there are more Java-centric options.
If you are building a server-based application kwateeSDCM can take care of automating the deployment.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "java, deployment" }
C - 'Greater than' vs 'Greater than or equal to' performance I'm a bit curious about how these comparison operations work underneath the hood, as I'm trying to optimize my code as much as possible and develop good programing habits. For example, consider the statement 0 > 1 It should just check if 0 is greater than 1. But then think about the statement 0 >= 1 Does it first check if 0 is greater than 1, and then if they are equal? I'm asking because, if this were the case, wouldn't that also mean that a > b requires half the amount of operations compared to a >= b ?
As is mentioned by others, and here:, most modern processors already have instructions that handle the more complex looking cases you're mentioning. I'm not sure how far back 'modern' is here, but I would say that if you are worried about performance, this is one place you shouldn't try to optimize for speed; rather for clarity. An optimizing compiler will typically know a faster way of handling operations than you do.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 2, "tags": "c, performance" }
setting values on multiple indexes in a numpy array I have the following fragment of python code: import numpy as np # Some random array x = np.random.rand(34, 176, 256) # Get some indexes pos_idx = np.argwhere(x > 0.5) # Sample some values from these indexes seeds = pos_idx[np.random.choice(pos_idx.shape[0], size=5, replace=False), :] # Now create another array y = np.zeros_like(x, np.uint8) y[seeds] = 1 The last line given an error something along the lines of: index 77 is out of bounds for axis 0 with size 34 But I am not sure how this can happen as all the sampled indexes should be valid as they are a subset.
This code will help you setting the values to 1 import numpy as np # Some random array x = np.random.rand(34, 176, 256) # Get some indexes pos_idx = np.argwhere(x > 0.5) # Sample some values from these indexes seeds = pos_idx[np.random.choice(pos_idx.shape[0], size=5, replace=False), :] # Now create another array y = np.zeros_like(x, np.uint8) for i in seeds: y[tuple(i)] = 1
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "python, numpy" }
Why client socket take localhost as parameter? I study socket programming, and the example in the book shows: // SimpleClient.java: A simple client program. import java.net.*; import java.io.*; public class SimpleClient { public static void main(String args[]) throws IOException { // Open your connection to a server, at port 1254 Socket s1 = new Socket(“localhost”,1254); // Get an input file handle from the socket and read the input InputStream s1In = s1.getInputStream(); DataInputStream dis = new DataInputStream(s1In); String st = new String (dis.readUTF()); System.out.println(st); // When done, just close the connection and exit dis.close(); s1In.close(); s1.close(); } } My question is that, at line new Socket("localhost",1254), why the address is localhost, instead of the server's IP address?
For this particular program it's hard to say exactly _why_. The usual reason is because the server may not even have another IP address. If it's local, then accessing it through `"localhost"` or `"127.0.0.1"` is guaranteed to work even if you have no NICs at all. Another possible reason is security. Your machine may have multiple NICs, but the server may be configured to only listen on the loopback interface and therefore accept only local connections. If it isn't intended for external use at all, this is usually the best thing to do because the potential attacker will have a very hard time connecting it through an interface it isn't even listening on! They will have to break into the system using some other way first.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, sockets, tcp" }
Integration by Parts. Get original expression One of the engineering proofs I am trying to understand has the following line. It says using integration by parts the below can be shown: $$\int(\sigma_{ij},_j * u_i)dV = \int((\sigma_{ij} * u_i),_j)dV - \int(\sigma_{ij} * u_i,_j) dV$$ N.b. The above is in einstein notation in which the comma represents partial diff. I pulled out my notes but could not perform integration by parts for whatever reason. I arrived at the original expression. Any help appreciated!
This looks like the standard version of partial integration. Partial integration in one variable says the following: $$\int_a^bf(x)g'(x)dx = \int_a^b[f(x)g(x)]'dx - \int_a^bf'(x)g(x)dx.$$ Applied to your question, with some nicer notation (sometimes these shorthands like Einstein notation can cloud our vision): $$\int \partial_j\sigma_{ij}\cdot u_idV = \int \partial_j(\sigma_{ij}u_i)dV-\int\sigma_{ij}\cdot\partial_ju_idV.$$
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "calculus, integration" }
Prove EXP to be regular or non-regular Given L is regular, Prove/Disprove that the following language is regular or not. $EXP = \\{w| w^{|w|} ∈L\\}$
Suppose that $L$ is accepted by a DFA with states $Q$, initial state $q_0$, accepting states $F$, and transition function $\delta$. With every word $w$ we can associate the function $\delta_w\colon Q \to Q$ given by $\delta_w(q) = \delta(q,w)$. Note that there are finitely many such function. It is not hard to check that for any such function $\delta_w$, the language $L_{\delta_w} = \\{ x : \delta_x = \delta_w \\}$ is regular. We can also associate with $w$ a set $N_w = \\{ n \in \mathbb{N} : \delta(q_0,w^n) \in F \\}$. Note that $N_w$ depends only on $\delta_w$, and so there are finitely many such sets. Moreover, each of them is eventually periodic (why?), and so the language $L_{N_w} = \\{ x : |x| \in N_w \\}$ is regular. Combining the two observations, we see that $$ EXP = \bigcup_{w \in \Sigma^*} (L_{\delta_w} \cap L_{N_w}). $$ While the sum is infinite, there are only finitely many different summands, and we deduce that $EXP$ is regular.
stackexchange-cs
{ "answer_score": 1, "question_score": -1, "tags": "regular languages" }
Ruby Conditional If Else Assignment So I have the following code that I wanted to make a little more readable: user = User.find_by_username(username) user = User.new(credentials) if user.nil? Essentially the first line is the default, the following line instantiates itself if it's not already set. Is there a way I can clean this up a bit and get it onto a single line of code? Something like this maybe: user = User.find_by_username(username) || User.new(credentials) * * * **Edit** I now realize the the code I provided does exactly what I need, sorry for wasting cyberspace but feel free to suggest alternative solutions.
Yes, what you wrote is exactly the correct answer. You could also write it this way, if preferred: user = User.find_by_username(username) user ||= User.new(credentials) Keep in mind that your first example will only assign the second value if the first one is `nil`, but your second example and my example above will assign the second value on both `nil` and `false`. _EDIT_ : As mentioned by others, if you're working with Active Record you could also use a dynamic attribute-based finder user.find_or_initialize_by_username(credentials)
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "ruby, ruby on rails 3, refactoring" }
How can I close, restore or minimize DXRibbonWindow when it is maximized? I'm using the DevExpress libraries (version 12.1) in a WPF project. I need to create a DXRibbonWindow to obtain a RibbonBar alike to the Excel one, on the top with quick access tool bar. So, the problem is that I can close, restore or minimize this window when it is maximized. These buttons work right when the window is not maximized. The following code is my .xaml file: <dxr:DXRibbonWindow IsAeroMode="True" WindowState="Maximized" ... /> I need to manipulate this window normally. How to solve this problem?
As far as I can see from DXSearch this issue have been already reported to DevExpress. Current issue status is **_Fixed in version 12.1.8_**. So, you are welcome to update your version to that one.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "c#, wpf, xaml, devexpress, ribbon" }
How to collaborate to a Firebase project with not google account I have an invitation from the firebase project but can't activate it cause the mail I was invited with is outlook (not a google account)
You can create a Google account from any email address, not just for @gmail.com. See the Google documentation page on creating a Google account from an existing email address. Once you've followed that process, you can sign in to the Firebase project with the account.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "firebase, google cloud firestore" }
Command to set block based on item presence I am currently trying to figure out how to get this command execute if entity @p[distance=.11,nbt={SelectedItem:{tag:{display:{Name:"{\"text\":\"key\",\"color\":\"white\",\"bold\":\"true\"}"}}}}] run setblock -191 21 -52 minecraft:redstone_block to work with an arrow renamed as "key" and then it in theory should open a Iron door that is nearby, just by being near it. However anytime I get close to the Iron door, nothing seems to change. I also have this command execute unless entity @p[distance=.11,nbt={SelectedItem:{tag:{display:{Name:"{\"text\":\"key\",\"color\":\"white\",\"bold\":\"true\"}"}}}}] run setblock -191 21 -52 minecraft:stone_bricks for when someone is near the area but without the item. That seems to work fine. Can someone explain this to me? I am very confused in how to get it to work. I'm using Minecraft 1.14.3.
You have a typo in your commands, instead of .11 you need to put ..11 for it to work. Also ensure you are running this in a Repeat Command Block set to Always Active. Correct First Command: `execute if entity @p[distance=..11,nbt={SelectedItem:{tag:{display:{Name:"{\"text\":\"key\",\"color\":\"white\",\"bold\":\"true\"}"}}}}] run setblock -191 21 -52 minecraft:redstone_block`
stackexchange-gaming
{ "answer_score": 2, "question_score": 2, "tags": "minecraft java edition, minecraft commands" }
Limit number of characters in the stored field I have a document with 195 million characters. It gets indexed ok, but when it comes to displaying it to the user, I dont need to display it fully, just lets say 1 million characters or so, not to mention that Solr crashes as well. Is it possible to limit number of characters stored/displayed, but index all. Like in copy field: <copyField source="cat" dest="text" maxChars="30000" />
You are nearly providing your own answer. 1. Use copyField with maxChars settings 2. Have the original field as stored=false, indexed=true 3. Have the copied field as stored=true, indexed=false 4. Search the original field, but return copied field However, you may consider not having that content in Solr at all, but have it outside of Solr. At least if you have multiple documents like that in Solr.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, solr, indexing, lucene" }
What does it mean for argument handling to be "rigid"? Taken from the documentation for `Proc#lambda?`: > Returns true for a Proc object for which argument handling is rigid. Such procs are typically generated by lambda. What is "rigid argument" handling?
Lambdas will raise an ArgumentError if passed the wrong number of arguments, Proc.new won't. Example: lam = ->(x){ "OK" } lam.lambda? # => true lam.call # => ArgumentError lam.call(1) # => OK proc = Proc.new { |x| "OK" } proc.lambda? # => false proc.call # => OK proc.call(1) # => OK proc.call(1,2,3,4,5,6,7,8,9) # => OK
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 3, "tags": "ruby" }
SMPlayer + mpv missing OSD The OSD shows nothing when I change the sound volume or jump. It used to show "Volume: XXX%" and current time with a bar. Changed after some update. How can I have it back? SMPlayer 17.8.0-1~xenial1 ppa:rvm/smplayer mpv 2:0.26.0+git3~xenial ppa:mc3man/mpv-tests
On "SMPlayer -> Preferences -> Advanced -> MPlayer/mpv -> Options" add "--osd-level=1". For details about the problem and the solution follow the link:
stackexchange-askubuntu
{ "answer_score": 1, "question_score": 0, "tags": "video player, smplayer" }
Proving interior of a metric space $E$ is open > If $E^{\circ}$ denotes the set of interior points of $E$, prove $E^{\circ}$ is open. > **My attempt:** If $x\in (E^{\circ})^c$ then $x$ is not an interior point of $E$. Therefore, no neighborhood of $x$ is contained entirely in $E$ and thus all neighborhoods of $x$ contain a point $p\in E^c \subset (E^{\circ})^c$, hence $x$ is a limit point of $(E^{\circ})^c$ therefore $(E^{\circ})^c$ is closed and $E^{\circ}$ is open. Is there something wrong with this proof? I ask because all the proofs I have seen of this fact avoid using this argument, which somehow raises doubts about its validity, given it is just as simple as other arguments used.
Your argument is perfectly fine but is more cumbersum. The openness of $E^\circ$ can be proved directly without invoking closedness: Since $E^\circ$ is a neighbourhood (contains a ball at) of all of its points, $E^\circ$ is open.
stackexchange-math
{ "answer_score": 1, "question_score": 5, "tags": "real analysis, proof verification, proof writing" }
Shared Preferences vs SQLite for caching JSON What is the best way to persist a JSON in between Android application life cycles? Right now I am using a rest service to return a JSON. I use this JSON as a data provider for a javascript chart I am loading into a large amount of webviews. I don't want to continuously hitting the server to request the JSON, instead I want to cache it and retrieve it when needed allowing the user to manually update/refresh the data. Should I be doing this with Shared Preferences or should I persist to a SQLite table? My main concern is still being able to retrieve the stored data even after the application has been killed/restarted. I also have a large amount of JSONs and want to know which would be the most efficient.
It depends How Big is you data **SharedPrefences** > Store private primitive data in key-value pairs. If you just want to store 2-3 variables and integer,boolean sharedPreferences will do the trick. **Sqlite** > Store structured data in a private database. If your data contains of lots of item like you are filling a ListView its better to implement SQLite as data is stored in more organize order , you can set id to these data (for example you can set id as today's date and check if current date is greater then the id then you might need to refresh) along with it there are some powerful classes to help you like CursorAdapter and Cursor
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "javascript, android, json, sqlite" }
Use standard output from .Net application with powershell's Out-GridView Simple question: is it possible to use the output of a .net application and pipe it through Out-GridView in powershell ? Say for example I have a C# console application that does something like this : Console.WriteLine("col1-value \t col2-value \t col3-value"); Console.WriteLine("col1-value \t col2-value \t col3-value"); Is it possible to pipe the ouput to Out-GridView and separate everything in different named columns ? How does it work otherwise ?
Redirect the output of you C# program into a file: csharp.exe > $env:temp\foo.txt Then use a script like this to read the content of the file and display it in the Grid-Window: $Columns = "Col1", "Col2", "Col3" Get-Content $env:temp\foo.txt | ConvertFrom-Csv -Header $Columns -Delimiter "`t" | Out-GridView
stackexchange-superuser
{ "answer_score": 4, "question_score": 2, "tags": "powershell" }
Dynamic Variable Name / Increment Variable Name Please can someone assist me with dynamic variables within a loop? In the code below, I have 4 variables and an echo that loops 4 times. When the loop runs, each variable should echo (in the code I've inserted $var* as a place holder). How is it possible to increment $var* within the echo statement ($var1 should echo, then $var2 and so on)? Many thanks $var1 = 'A'; $var2 = 'B'; $var3 = 'C'; $var4 = 'D'; for ($i = 1; $i < 5; $i++) { echo ($var*); }
This is what is called a "variable variable." A variable definition is comprised of two parts: the dollar sign, which tells the interpreter that it's a variable, and the variable name _per se_ , which in short is a string; I'll call it "body" here. So, if you have `$var = 'my_other_var'` and `$my_other_var = 'hey'`, you can use the string "my_other_var" as the "body" of a the variable call. Then `echo $$var` yields "hey". Here with your example: <?php $var1 = 'A'; $var2 = 'B'; $var3 = 'C'; $var4 = 'D'; for ($i = 1; $i < 5; $i++) { $varToEcho = "var$i"; // will become var1, var2, var3 and so on echo $$varToEcho; }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "loops, variables" }
URL slash '/' get double encoded. Changed to %252F instead of %2F I have two input in my form. Input 1 value = '02/03/2015' // Both are date Input 1 value = '04/03/2015' // Both are date When I try to submit this form by GET or POST method, url in on my vps changed to this one: from_date=02%252F03%252F2015&to_date=05%252F03%252F2015 and on localhost: from_date=04%2F03%2F2015&to_date=04%2F03%2F2015 Actually the problem is '/' is double encoded in url on VPS which is breaking my sql queries. Any help is appreciable.
Use `urldecode()` PHP function before you query it into your database. Like that: <?php $date1 = urldecode($_GET["from_date"]); $date2 = urldecode($_GET["to_date"]); ?>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 4, "tags": "php, apache, .htaccess" }
How to replace forward slash with comma from date I have a new query on datepicker. I want to replace forward slash with comma (or dot) from date which is pick from datepicker. I tried some code below but it's not work fine. Fiddle `Here` HTML <input type='text' id='txtDate' readonly='true' /> <input type='button' id='btnConvert' value='Change' /><br/> Current Date : <span id='spnCurrentDate'></span> Js $("#txtDate").datepicker({ changeMonth: true }); $("#btnConvert").click(function(){ $("#spnCurrentDate").html($('#txtDate').val().replace('/', '.')); });
Here use regular expression. THis will work for you $("#txtDate").datepicker({ changeMonth: true }); $("#btnConvert").click(function(){ $("#spnCurrentDate").html($('#txtDate').val().replace(/\//g, "")); });
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 5, "tags": "javascript, jquery, css, html" }
¿Cómo sacar el primer número de una variable en PHP? Suponemos estas variables que contienen enlaces: $enlace1 = 'miweb.com/blog/post/9/Hola-123'; $enlace2 = 'miweb.com/blog/post/4938/Los-10-mejores-posts'; Tengo que establecer una función que me permita conocer el ID del post (el primer número que está entre `/ /`. De modo que me tiene que dar: extraer_ID($enlace1); // resultado deseado: 9 extraer_ID($enlace2); // resultado deseado: 4938 De momento esto es lo que he hecho: function extraer_ID ($enlace) { return filter_var($enlace, FILTER_SANITIZE_NUMBER_INT); } extraer_ID($enlace1); // resultado: 9123 extraer_ID($enlace2); // resultado: 493810 El resultado me da mal porque incluye todos los números del enlace y solamente necesito el primer número.
Puedes utilizar la función `preg_match` de la siguiente manera: preg_match('/[0-9]+/', $enlace1, $resultado); donde el primer parámetro será la regex en la cual buscas un dígito, el segundo parámetro será el `string` en el cual quieres buscar y el tercer parámetro la variable donde se almacenará el resultado. Ejemplo: <?php $enlace1 = 'miweb.com/blog/post/9/Hola-123'; $enlace2 = 'miweb.com/blog/post/4938/Los-10-mejores-posts'; preg_match('/[0-9]+/', $enlace1, $resultado); preg_match('/[0-9]+/', $enlace2, $resultado2); echo $resultado[0] . "\n"; echo $resultado2[0]; Y dará como resultado: 9 4938 **Demo**.
stackexchange-es_stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "php" }
iPhone 3Gs iOS 5.0.1 get Recieved memory warning error and crash the app I have created slideshow in my app and caching images in "CacheDirectory" of iPhone under "images" folder. After 10-15 minutes of slideshow app received memory warning and suddenly get crash without doing anything. But its not getting memory warning and even crash on iPhone 4 or 4s with same iOS.
The iPhone 4 and 4S both have more memory than the 3GS, so if you have a memory leak, or just use a lot of memory the memory warning would come at a later point on the 4/4S. Wether or not you save the images in the cache directory has no impact on memory usage. You must be keeping more images in memory than possible. When implementing a slideshow that can handle an arbitrary number of images you would have to make sure that images that are not currently displayed are released.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "iphone, memory management" }
RxJS Observables called in the reverse order I have the following code that dispatch 3 actions: * deleteLineFailed * showConfirmationMessage * Wait 2s * hideConfirmationMessage For some reasons, the only way I was able to make it work is in the reverse order, what is it I'm doing wrong? const deleteLineEpic = (action$, store) => action$.ofType(types.DELETE_LINE_REQUEST) .flatMap((action) => { return Observable.of(hideConfirmationMessage(action.line.productID)) .delay(2000) .merge( Observable.of(deleteLineFailure(action.line.productID)), Observable.of(showConfirmationMessage(action.line.productID)) ); } });
I think the following happens: deleteLine -----X------------ showConfirmation -------Y---------- hideConfirmation --------- 2s -----Z merge -----X-Y- 2s -----Z All 3 streams get merged, and the one with the delay emits after two seconds while the other emit the action immediately. So it might be better to do this: const deleteLineEpic = (action$, store) => action$.ofType(types.DELETE_LINE_REQUEST) .flatMap((action) => { return Observable.merge( Observable.of(deleteLineFailure(action.line.productID), showConfirmationMessage(action.line.productID)), Observable.of(hideConfirmationMessage(action.line.productID)) .delay(2000) )} ); Here the actions in the first `Observable.of` get immediately emitted after each other, while hide actions is emitted later on.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "redux, rxjs5, redux observable" }
Visual studio 2017 code maps filtering Is there way to filter only method calls on code map when you select a method and click "Show Methods this calls"? When I only check "Methods" in code map filter, it also shows getters and setters along with method name. I understand technically they are methods(get and set) but the diagram gets super cluttered with these getters & setters. How do we get rid of them and only show true C# Methods? ![enter image description here]( ![enter image description here](
I figured out eventually. In order for this solution to work you must select select "Skip Build" option. 1. Bring the method over to code map. 2. From the context menu, chose "Show Methods this calls". 3. By default, if you filters are on, everything that this method calls (constructor, getters, setters, fields, properties etc) will be displayed. 4. Uncheck everything from filters and select only Property. 5. This will display all the the properties. 6. Select all properties and delete them. This will also delete getter and setters in those methods. 7. Now uncheck property and check Method from filter. You will see only methods :) Much better.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "visual studio 2015, visual studio 2017, code map" }
Как посмотреть разницу всех файлов между двух заданных соседних коммитов Как посмотреть полную разницу между двух заданных соседних коммитов Git? Коммиты где-то в глубине проекта. И какая графическая утилита поможет вывести это в удобочитаемом виде вроде: список измененных файлов в дереве и при раскрытии изменения между каждым файлом?
посмотреть отличия в файлах между двумя состояниями, зафиксированными коммитами `xxx` и `yyy`, можно например, так: $ git diff xxx yyy адресовать коммиты можно разными способами, чаще всего используют первые несколько знаков (5-6 обычно достаточно) хэша коммита. хэши можно увидеть, например, в выдаче команды `log`: $ git log commit b032ec26bf7b09c9c6554195b3469fa63ec22519 Author: автор Date: дата описание коммита ... т.е., для адресации данного коммита можно использовать, например, `b032ec`. * * * в качестве «мыше-интерфейса» можно воспользоваться, например, программой `gitk`: !enter image description here
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "git, git diff, git log" }
Cambiar Formatos Como le puedo cambiar el formato a un DateTimePicker y a un Label Quisiera que el DateTimePicker muestre un formato dd/mm/yyyy h:mm Y que el Label tenga un formato de moneda. ¿Como podría hacer?
Esto te servirá para mostrar la fecha y la hora en el formato que elijas: DateTimePicker1.Value.ToString("dd/MM/yyyy hh:mm"); También puedes sobreescribir los valores por defecto del `DateTimePicker`: DateTimePicker1.Format = DateTimePickerFormat.Custom; DateTimePicker1.CustomFormat = "dd/MM/yyyy hh:mm"; Para el `label` le asignas el valor pasándolo a `string` con el formato "Cx" dónde la x es el número de decimales a mostrar, en el ejemplo el valor es de 100.10: double valor = 100.10; label1.Text = valor.ToString("C2"); También label1.Text = String.Format("{0:C}", valor); O con la cultura: label1.Text = valor.ToString("C2", CultureInfo.CurrentCulture)); También puedes forzar la cultura en que se muestra la moneda: label1.Text = valor.ToString("C2", new CultureInfo("es-ES"));
stackexchange-es_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, visual studio" }
How to get target path of a junction? I have a folder `C:\the Junction\test`, which is actually a junction, and the real path (target) is `D:\the real\path\to\the folder`. How can I find out that real target path in VBScript?
I'm not aware of a way to get this information with plain VBScript, but you can shell out to `fsutil` to extract this information: foldername = "C:\the Junction\test" Set sh = CreateObject("WScript.Shell") Set fsutil = sh.Exec("fsutil reparsepoint query """ & foldername & """") Do While fsutil.Status = 0 WScript.Sleep 100 Loop If fsutil.ExitCode <> 0 Then WScript.Echo "An error occurred (" & fsutil.ExitCode & ")." WScript.Quit fsutil.ExitCode End If Set re = New RegExp re.Pattern = "Substitute Name:\s+(.*)" For Each m In re.Execute(fsutil.StdOut.ReadAll) targetPath = m.SubMatches(0) Next WScript.Echo targetPath Change the pattern to `Substitute Name:\s+\\\?\?\\(.*)` if you want to exclude the leading `\??\` from the path.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "vbscript, junction" }
What language is an android app like twodots using? Noob here. Android apps are written in Java. An app like twodots doesn't look like typical Java. What language are they using to make their list of levels? It almost looks like they made it in flash but you don't need Adobe Air so I'm assuming they didn't. Thanks!
code monkey got it right. Emailing the developer answered this question quickly. Reply from developer: Thanks for the compliments. The Android version of TwoDots was created in Unity using Objective C/C#. Thanks!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "android" }
how to keep app active or restart when killed? I'm trying to create an app that sets an alarm if the screen is off for too long. This will be checked in the background every 5 minutes. Unfortunately android kills my app sometimes and I need to keep my app active in the background. What is the best way to do this? I was also thinking about restarting every 5 minutes if the app is killed. Is this a better way to keep my app mostly active in the background? How to do this? Or is there a better solution for me? Maybe restarting the way like Facebook does?
I think i fixed it by using a simple service that does nothing except for an infiit loop of logging.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, background" }
Loading multiple SpatiaLite layers into a single database I have many SpatiaLite layers, each in a separate database. I want to load all these SpatiaLite layers into a single database. How can this be done?
If they are SpatiaLite layers, they are already in a database. If you meant that they are in different databases (which you did not stated in your original question), you can use the DB Manager plugin, just expand your SpatiaLite connections in the `Tree` and drag & drop the SpatiaLite layers you want to import from each DB to your target DB.
stackexchange-gis
{ "answer_score": 3, "question_score": 3, "tags": "qgis, spatialite" }
Help understanding a circuit (li-ion charger with 5v step-up) In the circuit below, as well as in the typical application schematic for the tp4056, bat+ connects directly to bat- with a 10uF capacitor in between. Why doesn't this connection end up shorting the battery? ![enter image description here]( ![enter image description here]( Second question, how does the voltage step up work when bat- does not connect to that part of the schematic at all? Should I assume that bat- is connected to the output GND?
**(1) Why doesn't the capacitor short Bat+ and Bat-?** You're working with a DC circuit, hence the 10uF capacitor in this case, works as a voltage filter and does not short Bat+ and Bat-. Essentially, it reduces ripple voltage. Wiki Capacitor Filter According to an online website: > When used in a direct current or DC circuit, a capacitor charges up to its supply voltage but blocks the flow of current through it because the dielectric of a capacitor is non-conductive and basically an insulator. Introduction to capacitors **(2) How does the voltage step up work when bat- does not connect to that part of the schematic at all?** In most circuits, you can assume that all GND are connected with each other, so you have a reference voltage. _Bat- is connected to GND_
stackexchange-electronics
{ "answer_score": 0, "question_score": -1, "tags": "batteries, circuit analysis, battery charging, step up" }
Does this sequence of polynomials have a name? I'm very interested in the function $$f : (0,\infty) \rightarrow (0,\infty)$$ $$x \mapsto - \log(1-e^{-x}).$$ When I use Wolfram alpha to compute the $n$th derivatives of $f$, I find that there exists a sequence of polynomials $P_1,P_2,\ldots$ such that for $n \geq 1$ we have $$f^{(n)}(x) = \frac{e^x}{(1-e^x)^n}P_n(e^x).$$ For example: $$\frac{d^6}{dx^6}(-\log(1 - e^{-x})) = \frac{e^x}{(1-e^x)^6} (1+26 e^x + 66 e^{2 x} + 26 e^{3 x} + e^{4 x})$$ > **Question.** Is there a name for this sequence of polynomials? If these polynomials don't have a name, I'd also be satisfied with a name for the variant on Pascal's triangle whose entries are the coefficients of these polynomials.
Lord Shark the Unknown is spot on. WA%5En\)+P\(e%5Ex\)\)) tells us that $$ \frac{d}{dx}\frac{e^x}{(1-e^x)^n} P(e^x) = \frac{e^x}{(1-e^x)^{n+1}} Q(e^x) $$ where $$ Q(t)=(t-t^2)P'(t)+((n-1)t+1)P(t) $$ Therefore, $$ P_{n+1}(t)=(t-t^2)P_n'(t)+((n-1)t+1)P_n(t) $$ Since $P_2=A_1$, we have $P_n=A_{n-1}$, where $A_n$ is the $n$-th Eulerian polynomial.
stackexchange-math
{ "answer_score": 4, "question_score": 6, "tags": "calculus, polynomials" }
UltraEdit never open in hex? Is there a way to disable hex mode? So that especially .txt files are always opened in ASCII (normal) view. I already tried: {Menu Advanced, Configuration, File Handling, Unicode/UTF-8 Detection, Disable automatic detection of hex file format on reload} = yes.
Try to create following macro: (Macro –> Edit Macro -> New Macro) IfExtIs "txt" InsertMode ColumnModeOff HexOff EndIf Where “txt” – file extension. Then save it and add to Macro -> Set auto load (Number of times to execute: 1,, and specify correct macro name and file that contains this macro)
stackexchange-superuser
{ "answer_score": 1, "question_score": 1, "tags": "ultraedit" }
How to see and go to local branches in git? I have just created a brand-new git repository: git init By executing git status I have determined that I am in the master branch. The first line of the output was: On branch master As a first step I wanted to create a branch and go in there. I have learned that one can do these two steps just by one command: git checkout -b aaa I this way I have created a branch called "aaa" and went there. I could confirm it with "git status" (it tells me "On branch aaa"). Now I want to go back to the "master" branch. So, I execute: git checkout master As a result I get: error: pathspec 'master' did not match any file(s) known to git. So, how do I go to another (existing) branch in git? Moreover, I do not even know what branches exist. How can I see a list of existing branches?
You had no commit in `master` branch so, `master` does not exist actually. Create & checkout local `master` branch: $ git checkout -b master You can see branch list(s): $ git branch # see local branch(es) $ git branch -r # see remote branch(es) $ git branch -a # see all local & remote branch(es) Do changes, `git add -A`, `git commit -m 'message'`. So, now this commit actually point to the `master` branch. **N.B.** By `git init` command default branch is `master` (it's not real branch, just default git convention). Then without doing any commit you checked out to `aaa` branch. So, `master` is vanished cause no branch exists without any commit history.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "git, git branch, git checkout" }
How to read each XML lines into specified strings? I'm trying to create a VB.net application which reads each line from an XML-file (or ini file, doesn't matter) which dictates what the name of a string should be. E.g "string1 = xml.line1" "string2 = xml.line2" etc What would be the best approach of doing this? I've already pluckered a bit with Xml.XmlTextReader and it seems to do the job, but I can't manage to break down each line as it's own string?
If you are dealing with the XML line by line and want to ignore XML semantics you should treat it as a plain text file and run a regular expression or something on each line: Dim lines = File.GetAllLines("file.xml") ' Check the lines (which is a String array) for the criteria
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "xml, vb.net" }
Oct2Py only returning the first output argument I'm using Oct2Py in order to use some M-files in my Python code. Let's say that I have this simple Matlab function : function [a, b] = toto(c); a = c; b = c + 1; end What happens if I call it in Octave is obviously : >> [x,y] = toto(3) x = 3 y = 4 Now if I call it in Python, using oct2py : from oct2py import octave my_dir = "D:\\My_Dir" octave.addpath(my_dir) a,b = octave.toto(3) This returns : > TypeError: 'int' object is not iterable It seems like octave.toto(n) only returns the first value, when I'd expect two... Can anyone explain to me what I should be doing ? Thanks
In older versions of Oct2Py (3.x and older), the number of output arguments was inferred from the call within Python, so if you wanted multiple outputs, you would simply request both outputs a, b = octave.toto(3) However, as of version 4.0 you now need to use the `nout` kwarg to your function call to explicitly specify the desired number of output arguments a, b = octave.toto(3, nout=2) From the 4.0 Release Notes > Removed inferred `nout` for Octave function calls; it must be explicitly given if not 1. The old behavior was too surprising and relied on internal logic of the CPython interpreter.
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 11, "tags": "python, matlab, octave, oct2py" }
"Friendly" papers about maximum smoothness yield curve modelling I'm currently looking to implement some version of the yield curve modeling techniques in the maximum smoothness framework. The papers I have found so far explains the theory pretty well, but I find them somewhat hard to replicate. Does anyone here know any easy-to-replicate papers on the topic? The ones I have read so far are: 1. Fitting yield curves and forward rate curves with maximum smoothness - Adams, Van Deventer, 1994 2. Positive forward rates in the maximum smoothness framework - Manzano, Blomvall, 2004 Thanks in advance for any input :)
Suggest the worked examples in Chapter 5 (and for credit spreads, Chapter 17) in van Deventer, Imai and Mesler, Advanced Financial Risk Management, 2nd edition, 2013, John Wiley & Sons, Singapore. Good luck.
stackexchange-quant
{ "answer_score": 2, "question_score": 1, "tags": "fixed income, yield curve" }
How can I remove this extra character from my string? I have a string that is stored in an array, and eventually inserted into a SQL database using php and PDO. When I look in the database there is an =20 that gets stored at the end of the string that I would like to get rid of. My code looks something like this: $name = trim($message_item[1]); $name = addslashes($name); $so_row = "INSERT into sales_order (name) VALUES('$name')"; $dbmrp->exec($so_row); I thought that trim() would remove anything extra, but it doesn't seem to help. I can get rid of it using preg_replace('/\s+/','',$name), but then I lose all the whitespace, including the ones in the middle that I want to keep. So what is =20 and how do I get rid of it? _more info-_ $message_item is an array that is created from exploding a string that gets read from an email.
Trim is only for spaces on the beginning and the end of string. You can do as Donovan said and remove all 3 last caracter. $name = substr($name, 0, -3); or replace all =20 by empty str_replace('=20', '', subject) But I really think you should figure out why you are getting an string with this =20. Any solution that remove it, is nothing but an workaround.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, mysql, pdo" }
Dynamics AX 2009 - Rename Financial Dimensions We are having an issue with the length of a financial dimensions going to FRx. The new dimension; "INTDESIGN" is 9 characters obviously, but FRx seems to only accept 8. There aren't many posted transactions in AX to clean up, but I am curious if there's a way to rename this dimension in AX automatically without writing my own job. I did some google searching, but could only find AX 2012 material. ![enter image description here](
You can rename the primary key of any entity by right-clicking on the record, selecting 'Record Info' and then clicking the 'Rename' button. Note that you may need to right-click on the actual primary key field (Number in this case). It should prompt you for what the new key is, and when you click 'OK' it will rename the key and all places that key is used. See also: <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "axapta, dynamics ax 2009" }
How to add differnt sub ObservableCollections to main ObservableCollection **Example** I have ObservableCollection<Employee> // 1 ObservableCollection<Boss>// 2 ObservableCollection<Department> //3 ObservableCollection<T> // main >>>I want 1, 2, 3 ObservableCollection to main ObservableCollection **How to do?** edited1: I want to add them to be a list. Not for each item. edited2: I have to display 3 lists of field on the wpf application. the 2nd list can add/remove item in the list. ** please let me know if it unclear.
Since what you want to do is to add a collection to a collection, but those collection types are not compatible, I'd try this ObservableCollection<Employee> _employees = ... ObservableCollection<Boss> _bosses = ... ObservableCollection<Department> _departments = ... ObservableCollection<IList> _collections = ... _collections.Add(_employees); _collections.Add(_bosses); _collections.Add(_departments); Note that the generic argument to the `_collections` collection is `IList`. `ObservableCollection<T>` implements `IList` and is therefore assignable to things of that type, even for different `T`s among the sets.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, generics, collections, observablecollection" }
Why does ы have a soft sign in it? It's the only letter with two disconnected parts. How did this letter ы come about?
The letter ы is a ligature of `ъ` and `і`). In the past, these were both vowels (something like /ɤ̞/ and /i/) and ы was considered as some mixture of those two vowels.
stackexchange-russian
{ "answer_score": 18, "question_score": 8, "tags": "буквы" }
How to find an array of numbers(elements) from array of n numbers whose sum is exactly equal (or nearly equal) to the number x.? How to find an array of numbers(elements) from array of n numbers whose sum is nearly equal or exactly equal to the number x.? I implemented using recursive. But it takes too much time. Pls help Is there any algorithm? Can it be implemented using DP? if yes How? Eg: ` given Array a = { 43, 86, 12, 39, 58, 15, 9, 62, 40, 71 } If x = 125; ans : {39,15,71} Here sum of ans = 125 (exactly) for same array: if x = 49 ans = { 39, 9} Here sum of ans 48. nearly equal `
This is the subset sum problem \- it's NP-Complete, but there's a pseudo-polynomial time dynamic programming algorithm and a polynomial time approximate algorithm
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "arrays, algorithm, data structures, sum, dynamic programming" }
Real valued sufficient statistic How to find the real valued sufficient statistic of $\theta$ for a random sample from a distribution with the probability density function written below? $$f(x;\theta) = \theta ax^{a−1} \exp(−\theta x^a), x > 0, \theta > 0, a > 0$$
$$f(x,\theta) = \theta a x^{a-1} \exp(-\theta x^{a}) = a x^{a-1} \exp(-\theta x^a + \log(\theta))$$ $$\displaystyle \prod_{i=1}^n f(x_i;\theta) = a^n \left( \prod_{i=1}^n x_i^{(a-1)} \right) \exp(-\theta \sum_{i=1}^n x_i^a + n \log(\theta))$$ Given $a$, define $$h(x_1,x_2,\ldots,x_n) = a^n \left( \prod_{i=1}^n x_i^{(a-1)} \right)$$ $$T(x_1,x_2,\ldots,x_n) = \sum_{i=1}^n x_i^a$$ $$g(\theta, T(x_1,x_2,\ldots,x_n)) = \exp(-\theta T + n \log(\theta))$$ Hence, by Fisher factorization theorem $\displaystyle T(x_1,x_2,\ldots,x_n) = \sum_{i=1}^n x_i^a$ is a sufficient statistic.
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "statistics, probability distributions" }
What is the point of in-place server configuration in PhpStorm when server files are both local and remote at the same time? What is the point of in-place server configuration in PhpStorm, when as defined in the docs in in-place server configuration: > The web server is running on your computer, your project is under its document root (for example, in the /htdocs folder), and you do your development directly on the server. So, what is the point of making a server connection when I'm directly editing/using the files from my server, and they are both local and remote at the same time? Also, I've set up everything according to the docs for in-place server, and I can't find any server when I open remote hosts window.
With this server connection setup, you can tell the IDE to preview your files on your in-place web server instead of the IDE built-in webserver (` when you click the browser icon on the browsers bar
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "phpstorm" }
Php Regular expression code Can anyone have a look at the php code I wrote. I want to extract the three information into an array, but it doesn't work for me. $string = "<Name>Joh Doe <Email>[email protected] <App ID> 130105" $var = preg_split("/^<.*<$/" , $string); Thanks,
You are missing delimitters which would result in: Warning: preg_split() [function.preg-split]: No ending delimiter Here is what you should have: $string = "<Name>Joh Doe <Email>[email protected] <App ID> 130105"; $var = preg_split("#^<.*<$#" , $string); print_r($var); **Result:** Array ( [0] => Joh Doe [email protected] 130105 )
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, regex, string, split" }