INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
How can I share my YouTube clip anonymously? I have uploaded a video to YouTube and I want to share it without revealing my YouTube identity. Meaning I don't want people to see other videos of mine or my YouTube or Gmail username. How can I do this?
Seems like you are over thinking this one. You should create a second account. It would allow you to keep them separated. You can be logged into more than one account on youtube at a time.
stackexchange-webapps
{ "answer_score": 1, "question_score": 0, "tags": "gmail, google, youtube, anonymous" }
What corresponds to the radial component of the axion potential? An axion can be understood as an oscillation of the axion field in some potential. In the Higgs mechanism, there are 4 degrees of freedom. The Higgs boson is the radial oscillation and 3 remaining degrees of freedom are Nambu-Goldstone bosons which are eaten by the gauge bosons. In the Peccei-Quinn mechanism we only have 2 degrees of freedom. When the universe has a temperature above the $T_{QCD}$, before the vacuum realignment mechanism (VEM) kicks in, we have a symmetrical mexican hat potential. The axions become Nambu-Goldstone bosons "oscillating" along the azimuthal angle inside the brim, and eventually become Pseudo-Nambu-Goldstone bosons after the VEM is turned on and the hat potential "tilts". My question is what particle corresponds to radial motion in this potential? ![Vacuum Realignment Mechanism]( Taken from this paper
This particle doesn't have a standard name -- if pressed, most people would probably just say "the radial part of the Peccei-Quinn field". The reason for this is twofold. First, you generically expect it to be quite heavy, on the order of the Peccei-Quinn scale, and hence far above what can be probed in experiments. Second, its particular properties depend very sensitively on how you set up the model. For example, if you had two coupled PQ-charged complex scalars and broke $U(1)_{\text{PQ}}$, you'd still get one light axion, but now you'd have three extra heavy particles rather than one. So the really interesting part of the model is that which is simultaneously generic and observable, in other words, the axion itself.
stackexchange-physics
{ "answer_score": 2, "question_score": 2, "tags": "quantum field theory, higgs, quantum chromodynamics, axion" }
Como puedo mandar el id junto con un evento en Typescript Tengo el siguiente método definido: elclick(id:string) { console.log('El id es: ' + id); } Y mi html es el siguiente: <a id="0" (click)="elclick(this.id);">Button</a> ¿Cual es la manera en la que se hace esto?
Por los tags que colocaste das a entender que usas angular para este caso. Podrías usar lo siguiente: import {Component} from 'angular2/core'; @Component({ selector: 'my-app', template: ` <button (click)="onClick($event)" id="test">Click</button> ` }) export class AppComponent { onClick(event) { console.log(event); console.log(event.srcElement.attributes.id); var idAttr = event.srcElement.attributes.id; var value = idAttr.nodeValue; console.log(value); } } Comparando con la implementación de javascript cambia el hecho de que no se envía el `this` sino que se envía directamente el evento click `event`; este evento cuenta con toda la información que necesitas, en este caso el elemento Source `srcElement` que sería tu botón y sus respectivos atributos `attributes`, como el id `event.srcElement.attributes.id`
stackexchange-es_stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "angular, typescript, angular5, angular directivas" }
I'm getting an undefined reference error to something that isn't there When I try to compile this code Analysis2::Analysis2() //line 13 { Seconds_v = 0; //Seconds_v and Seconds_t are both of type int Seconds_t = 0; //and declared in header } I get this error analysis2.cpp:13: undefined reference to `FileParameters::FileParameters()' Why is it giving me that undefined reference? FileParameters is a class included in Analysis2 and there is a FileParameters object defined in the Analysis2 header file if that helps.
When you have constructor, every member variable is automatically default-constructed if you don't explicitly construct it in the initializer list. Your code above automatically expands to: Analysis2::Analysis2() : mFileParams(), Seconds_v(), Seconds_t() // line 13 { Seconds_v = 0; //Seconds_v and Seconds_t are both of type int Seconds_t = 0; //and declared in header } And if you didn't implement the default constructor of `FileParameters` yet, or don't even have an accessible one, that's the error you get.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c++, g++, compiler errors, undefined reference" }
Russel's paradox: what is the contradiction with $R \not\in R$? Let the Russel's Set be: $$R = \\{S | S \notin S\\}$$ Where $S$ is a set 1. Suppose $R \in R$, but by definition $R \not\in R$, contradiction. 2. Suppose $R \not\in R$... (I am not sure what should be the contradiction here) My guess: then $\\{S | S \not\in S\\} \not\in R$, then $R$ is not the set of all sets such that $S \not\in S$ OR $R$ is empty, but clearly it cannot be empty (?) Can someone point out the contradiction in the second one?
Suppose $R\not \in R$. Then $R$ is a set that does not have itself as an element. Since $R$ satisfies this condition, we conclude $R\in R$.... woops.
stackexchange-math
{ "answer_score": 4, "question_score": 0, "tags": "elementary set theory, proof explanation, paradoxes" }
C++ unique_ptr as class property doesnt compile i'm using Visual Studio 2013 with the DirectXToolkit but i seem to not be able to compile the unique_ptr part: class Graphics { private: ID3D11Device *Device; ID3D11DeviceContext *DeviceContext; IDXGISwapChain *SwapChain; ID3D11RenderTargetView *RenderTargetView; protected: std::unique_ptr<PrimitiveBatch<VertexPositionColor>> Batch; These are the errors: 1. Error 3 error C2974: 'std::unique_ptr' : invalid template argument for '_Ty', type expected 2. Error 5 error C2238: unexpected token(s) preceding ';' 3. Error 2 error C2065: 'VertexPositionColor' : undeclared identifier 4. Error 1 error C2065: 'PrimitiveBatch' : undeclared identifier d Error 4 error C2059: syntax error : '>' The Headers and libs are all included. The IDE itself doesnt show any error. Maybe someone can tell me what i'm doing wrong! Thanks in advance!
Oh gosh, i had to include the using namespace in the same header as the class definition. this solved the errors.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "visual studio 2013, directx 11, unique ptr" }
Multiplying numbers Your task, is simply to multiply 2 integers given in input, separated by a ",". The catch is, you cannot use the multiplication operator "*", even if it is being used differently, or any loops whatsoever This is code-golf, so shortest code wins! Test cases: _i dont know if you even need it! lol_ 1,0 -> 0 5,6 -> 30 3920,549 -> 2152080
# 05AB1E, 6 bytes ',¡`иO Try it online or verify all test cases. Would be 2 bytes without the restricted input-format: иO Try it online or verify all test cases. **Explanation:** ',¡ '# Split the (implicit) input-string on "," ` # Pop and push both values separated to the stack и # Repeat the first value the second value amount of times as list O # Sum that list # (after which the result is output implicitly)
stackexchange-codegolf
{ "answer_score": 0, "question_score": -7, "tags": "code golf, code challenge" }
Passing a fixed length array to a function I want to write a function that can accept arrays of fixed length, but different arrays have different lengths. I know that i can pass the slice with arr[:] (the function will accept []T), but is there another way, maybe more efficient? I'm using a struct that i'd like to mantain with fixed length arrays (for documentation purposes), so using slices everywhere at declaration time is not optimal for my purpose.
No there is no way to pass different size arrays, because the length of an array is part of the type. For example `[3]int` is a different type then `[2]int`. At all in Go it is not recommended to use arrays you should use slices (<
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 5, "tags": "go" }
why does c allow initialization of string without declaration? When the arguments of dyn_mat are constants, the code runs through without any error and s1 and s2 do store the input values. #include<stdio.h> int main(int argc, char const *argv[]) { char *s1, *s2; int n1=7, n2=8; printf("Enter, %d \n", n1); scanf("%s", s1); scanf("%s", s2); int dyn_mat[155][347]; return 0; } but with arguments as variables, say n1 and n2, scanf reading s1 gives segmentation fault.
> why does c allow initialization of string without declaration? There is no data type `string` in C. In C one possible way to store a string of characters is using an array of characters, with the last element of this array carring a `0` to indicate the end of this string. You program does not declare any array, but just pointers to characters, which have no memory assigned to which you copy data using `scanf()`. Your just lucky the program does not crash with the first call to `scanf()`.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "c, pointers, segmentation fault" }
Swift 4 in Xcode 9 - How to lightweight Core Data migration? My Core Data will update one more attribute and , to avoid crashing , I added a new model version as first, and furthermore: The most of the keys about this issue is that change : coordinator!.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: url, options: nil) options: nil in the code to options:[NSMigratePersistentStoresAutomaticallyOption:true, NSInferMappingModelAutomaticallyOption: true] But In my _appdelegate.swift_ , I can’t find any _“persistentStoreCoordinator”_ , so can I migrate CoreData in my version?
You can achieve like this: let container = NSPersistentContainer(name: "YourDbModelName") let description = NSPersistentStoreDescription() description.shouldMigrateStoreAutomatically = true description.shouldInferMappingModelAutomatically = true container.persistentStoreDescriptions = [description]
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 1, "tags": "swift, xcode, core data, swift4, ios11" }
How to pass query string parameters from one page and get in another in WP 7 using MVVM Light I am developing application in Windows Phone 7 in MVVM arhticeture. I have never worked with MVVM Light. But today for sending querystring parameters from ViewModel of first Page to another, I have searched google and found that I have to use MVVMLight. But I cant find any tutorial or working sample. I have found one that it navigates from one page to another, but without parameters. **UPDATE** How to change this solution that in can get parameters from OrderViewModel? code can be found here
You use a concept called messaging. Read more on Geoff's Blog: MVVM Light - Passing Params to Target ViewModel Before Navigating. Basically, you send a message of some type (represented by a C# class) and the target ViewModel registers itself as the recipient of that message. Once you broadcast the message, the other view model will be called.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "c#, windows phone 7, mvvm, navigation, mvvm light" }
jquery jcache doesn't persist past browser refresh? I'm using jquery's jCache plugin < to cache some data that I calculate between refreshes, the problem is, after the page refreshes, the cached data seems to get lost. alert($.jCache.hasItem(window.location.href)); //false $.jCache.setItem(window.location.href,stringStore); alert($.jCache.hasItem(window.location.href)); //returns true After the page refreshes, the first hasItem is false again. What's going on?
I never used this plugin, but as I looked inside the last release from 2007! I have to say that this plugin can not store data persistent. It's somehow nothing else than a kind of stack with limited number of items to store data related to the current document. You need to work with cookies or webstorage to keep data available after a refresh.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "jquery" }
Do .so files get loaded as a whole into memory? When a program causes a .so file to be loaded into memory, does is get loaded as a whole, or or does it only load the necessary "chunks"?
No. First the .so file is opened, then `mmap()` creates the virtual address space necessary to hold the whole file contents. However, only when something tries to access a particular address in the space will the access cause a page fault, and the kernel will read a (4k) block from the file corresponding to the page's offset into real memory. When it is in actual memory, the access will be restarted. This is demand paging.
stackexchange-unix
{ "answer_score": 2, "question_score": 2, "tags": "memory, dynamic linking" }
Can I control motion tween speed according to timer? I want to make simple motion tween of analog timer seconds arrow. Can i sync it with specified defined timer on AS3? I know that the regular speed of animation can variate according to system specs. Any suggestions? Thanx in advance!
Given your requirements, I suggest that pure actionscript would be the way to go. Your arrow should be a movieclip. With actionscript, we can change the rotation of the movieclip to make it rotate around like an analog clock. Frames are not a good way to keep track of time, so timers are the way to go. Here's some sample code: var secondTimer:Timer; public function Arrow() { secondTimer = new Timer(1000); //1 second secondTimer.addEventListener(TimerEvent.TIMER, tickTock); } private function tickTock(e:TimerEvent){ rotation += 6; //360 degrees, 60 seconds. 1 second = 6 degrees }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "flash, actionscript 3, tween" }
How to overcome missing timezone implementation in the Mono WASM runtime If I try to print `DateTime.Now.TimeOfDay` in Uno, Wasm, and UWP will print two different times. Wasm in UTC and UWP in current culture. How can I make sure in both cases I get Local time?
I ran into this issue as well. To resolve use javascript. When wasm is detected use Uno.Foundation.WebAssemblyRuntime.InvokeJS. var getTime = Uno.Foundation.WebAssemblyRuntime.InvokeJS("javaTime()"); In a javascript file in your wasm WasmScripts folder function javaTime() { var date = new Date(); return date.toLocaleTimeString(); }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, uwp, webassembly, uno platform" }
Is variable updated "by reference"? I have the following simple script. <script> SPC = { a : [10], b : 10, t: function() { y = this.a; z = this.b; y[0]++; z++; alert('this.a[0] = ' + this.a[0] + '\nthis.b = ' + this.b) } } SPC.t(); SPC.t(); </script> Running it in your browser will display two alert boxes with: this.a[0] = 11 this.b = 10 and this.a[0] = 12 this.b = 10 The question is, why does the value of this.a[0] increment? I'm assigning "y = this.a" and updating element of "y" as "y[0]++;"? At the same time, exactly the same thing is happening with "b": "z = this.b; z++". Yet, "this.b" remains equal to 10. How can I change value of "y[0]" in the local scope without affecting "this.a"? Any ideas? Thanks!
`a` is an array, and you're simply copying a reference to the array into `y`. You need to copy the array `a`'s _contents_ into a _new array_ `y` instead (using `Array.slice()` (`y = a.slice()` in your case) is the easiest way). (Or, if you only need `a[0]`, you can set `y = a[0]`. Subsequent changes to `y` will not affect `a[0]`, since you are copying the value.) See the "Javascript Arrays Are Assigned By Reference" and "Passing Arrays As Values" sections of this article for more information.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 3, "tags": "javascript, scope" }
How can I change the default properties of Visio's connector tool? I'd like to change the default properties of the connector tool in Visio from right-angled lines with an arrow head to curved lines without arrows at either end. Can this be done? If so, how?
1. Open your diagram 2. Menu -> File -> Shapes -> Show Document Stencil. > New Stencil window shows up in left of screen, with lots of shapes!) 3. Select the "Dynamic Connector"! 4. Right mouse-click -> Edit Master -> Edit Master Shape > Master Shape is opened for editing. 5. Change the Line Colour, Line Thickness, Arrow Type etc! 6. Close the Master Shape. > You will be asked, do you want to save and update all linked items. **Notice:** If you say `yes`, this will change the format of all of the connectors that were created using the "Dynamic Connector" This worked for me in VISIO 2007, and is not the general DEFAULT, but the default for the current document you are working on. I am guessing it can also be applied to the standard visio template, but I have not attempted that.
stackexchange-superuser
{ "answer_score": 51, "question_score": 59, "tags": "microsoft visio, diagrams, connector, microsoft visio 2010" }
derivative of function with norm Let $x, r \in \mathbb{R}^n$. There is function $\eta(x, r):=A \frac{1}{\| x-r \|^p}$, where $A \in \mathbb{R}^{n \times n}$. How can I compute derivative of $\eta$ wrt. x?
Assuming that $||x|| = \langle x, x\rangle^{\frac{1}{2}}$ \- note that the scalar product is bilinear, so the derivative of its square with respect to $x$ in direction $v$, ($D_x(v) ||x||$ \- the notiation being admittedly a bit clumsy) is given by $$D_x(v) \langle x- r, x-r \rangle = 2 \langle x-r, v\rangle$$ Applying the chain and product rule you get \begin{eqnarray} D_x(v) A\frac{1}{||x-r||^p} & = & D_x(v) A\langle x-r, x-r\rangle^{-p/2} \\\ & = & \- p \frac{ \langle x-r, v\rangle}{||x-r||^{p+1}}A \end{eqnarray} (If you want to know the derivative wrt to $x_i$ just set $v= e_i$). (I'm not sure what the intention is of having the matrix $A$. Since it does not depend on $x$ it just behaves like a constant, though).
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "calculus, multivariable calculus" }
Javascript calling JSF handler method I am reading an xml file using javascript and then I need to submit my form so that it calls a particular method in my JSF handler. Usually this can be done on a jsp when user clicks a button by having an actionlistener like so: <h:commandLink styleClass="button" action="#{myHandler.outcome}" actionListener="#{myHandler.doNext}"> <span><h:outputText value="#{text.button_submit}" /></span> </h:commandLink> I am not sure how to call a method like 'doNext' above in the handler from javascript. I cannot do a simple: document.form.submit(); as it then repeats the processing i have already done. I want to read values from an xml file and then call a particular method in handler. Any ideas much appreciated.
I found a solution to this. I added a hidden button to my jsp like: <p id="hiddenButton" style="display:none;" > <h:commandLink id="hiddenRegButton" styleClass="button" action="#{myHandler.doNext}" /> </p> and in my javascript I used jQuery to execute the click which leads t the "doNext" method in my Handler to get executed. jQuery('#hiddenRegButton').click(); this was easier than I thought.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "javascript, handler" }
What is the difference between an axiomatization and a definition? It is sometimes said that some things are not ever defined but instead axiomatized. What does this mean exactly and what is the difference? For example in set theory the symbol $\in$ is not ever actually defined but instead "axiomatized" in set theory.
Let's consider two different words: axiom and definition. An axiom is something that is accepted to be true without proof. For example, one axiom of Euclidean geometry is "Two parallel lines never meet". This is never proved in Euclidean geometry; it's a fact that's accepted. Any type of math has a set of axioms. This is what a type of math is, a set of axioms. Then, as mathematicians, we ask ourselves, "What can we prove given the set of axioms that we have?" Given a set of axioms, we can create definitions. A definition is simply a meaning stated to a word, and it is logically equivalent to "if and only if". For example, we can say, "A value $\gamma$ is the supremum of a function $f$ that maps real numbers onto the real numbers means $f(x)\leq\gamma$ for all $x\in\mathbb{R}$". Logically, this is equivalent to saying "A value $\gamma$ is the supremum of a function $f$ that maps real numbers onto the real numbers if and only if $f(x)\leq\gamma$ for all $x\in\mathbb{R}$"
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "soft question, definition, axioms" }
NTFSprogs uninstalled ntfs-3g package After installing `ntfsprogs` package, the package uninstalls _ntfs-3g_ thus I can't mount my NTFS partitions through fstab I have this line in _/etc/fstab_ that obviously does not work UUID=6B3962A91560C093 /media/Data ntfs-3g defaults 0 0 Also this line does not work UUID=6B3962A91560C093 /media/Data fuse.ntfs locale=es_ES.utf8 0 0 Any workaround? Thanks a lot!
`ntfsprogs` are the old ntfs tools ( mkfs.ntfs, resizentfs, etc ). They have been superseded by the ntfs-3g package. You can not have both versions installed at once; just stick with the ntfs-3g versions.
stackexchange-askubuntu
{ "answer_score": 2, "question_score": 3, "tags": "11.10, ntfs" }
How do I have my lambda functions make outbound requests from a static IP? I've seen plenty saying I need to setup a VPC and NAT but there's no guide I can find that covers exactly how to do that. I have no experience with VPC, so it's all pretty confusing. I tried following < but it didn't work... NB: the service we have to send data to requires IP whitelisting, that's why we're going through this process. Edit: the issue with the NAT gateway I setup is that my lambda function can no longer make any outbound connections
Following this guide worked after some debugging. The mistake I had made was pointing the lambda at the _public_ subnet not the _private_ subnet.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "aws lambda, amazon vpc" }
How do I remove a git branch whose name starts with a unicode character? Using GfW I accidentally created a branch whose name begins with `<U+0096>`, which seems to be a unicode control-character. $ git branch features/#72_some_branch * features/#73_another_branch master <U+0096>features/#73_another_branch Now, in order to correct this mistake, I need to know how to escape it in the git bash. I tried using the well known Alt+Num key combinations, but that didn't work.
I have to admit, the answer was quite obvious. Using the built-in `echo` command of the bash shell, I was able to insert the desired symbol: git branch -d "$(echo -e '\u0096')features/#73_another_branch"
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 4, "tags": "git, git bash, git for windows" }
Bootstrap glyphicon edit not showing I wanted to implement bootstrap glyphicon edit but its not showing in my web page though its showing in bootply Please see this jsfiddle I have included all the necessary `js` and `css`.This is the code From the bootstrap to show edit glyphicon `<a class="glyphicon glyphicon-search" id="edit"></a>`
You are using bootstrap 2.2 so the icon prefixes are `icon-*` not `glyphicon-*` <a class="icon icon-search" id="edit"></a> _In bootstrap 3._ the prefix got changed to `glyphicon-*`*
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "javascript, jquery, html, css, twitter bootstrap" }
Getting an "Undefined" error in console.log Write a function called "getAllKeys" which returns an array of all the input object's keys. Example input: { name : 'Sam', age : 25, hasPets : true } Function's return value (output) : ['name', 'age', 'hasPets'] Do not use "Object.keys" to solve this prompt. My solution is below. function getAllKeys(obj) { var arrayToPrint = []; for (var key in obj) { arrayToPrint.push(key); } console.log(arrayToPrint); } obj1 = { name : 'Sam', age : 25, hasPets : true }; getAllKeys(obj1); console output: ![enter image description here]( Can someone please explain, why I am getting this Undefined?
That is because the function is not returning anything. A function will return undefined if it explicitly does not return a value. You can return the `arrayToPrint` from the function and log `getAllKeys(obj1)` function getAllKeys(obj) { var arrayToPrint = []; for (var key in obj) { arrayToPrint.push(key); } return arrayToPrint; // changed here } obj1 = { name : 'Sam', age : 25, hasPets : true }; console.log(getAllKeys(obj1)); // changed here **DEMO**
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "javascript" }
How to update the data of a particular column in SQL I was updating the values of columns to 0.00 using below query update table name set column name = '0.00' I did this for many columns but I also accidentally updated one wrong column to 0.00 which I was not suppose to do. now I want the data back for this column, I have backup in Excel file but don't know how to update only this particular column. Please help
Depending on the number of rows affected you could try something like putting the following formula in cell `C2` of your Excel table: ="UPDATE tbl_name SET col_name=" & B2 & " WHERE id=" & A2 assuming that in your Excel table the `id`s for each record can be found in column `A` and the original values in column `B`. If you then copy the formula down until you have the whole table covered you should end up with a command batch of `UPDATE` commands which you should **check carefully at first** and then possibly apply on your database to revover the old values.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "sql, excel" }
Embedding YouTube videos into a Google Slides presentation Is it possible to embed a YouTube video into a Google Slides presentation?
In Google Slides, use `Insert → Video`. You can then embed a YouTube video either by searching or by video URL. ![embed video by searching](
stackexchange-webapps
{ "answer_score": 3, "question_score": 2, "tags": "youtube, google slides" }
"Disk read error, press ctrl+alt+del" message on bootup HP NC8000 I've upgraded my computer from Compaq Evo N1020V to HP NC8000 and also moved my half-year old HDD drive Samsung HM160HC to it. I've got one partition. It was working fine for 2 days and then after turning computer off and then on I got: "Disk read error, press ctrl+alt+del" message on bootup I've booted from diagnostic CD and all content is still on drive, so I've copied all important files to my USB drive and then restored the whole system from VHD image. Then it's working fine for next 2 days and then it happens again. It's really annoying. My old Compaq was working for 10 years without any problems... Disk is completely fine, SMART ok, I've also tested with BIOS HDD Test utility and no errors. Notebook: HP NC8000, 1 GB RAM (2x512 MB), Radeon Mobility 9600 64 MB, 160 GB HDD, DVD combo Windows XP Professional SP3 Polish 32-bit How to fix this permanently ?
Problem was related to disk size. It didn't like the 160 GB. I've installed 30 GB SSD in Multibay as a second disk and now it's all ok ;)
stackexchange-superuser
{ "answer_score": -1, "question_score": 1, "tags": "boot, laptop" }
Como salvar em um banco de dados, confrontos entre times? Gostaria de saber como salvar em uma tabela no banco de dados confrontos entre times, por exemplo: TIME A x TIME B TIME A x TIME C TIME B x TIME C
Uma tabela associativa, creio eu, seria a alternativa mais interessante: CREATE TABLE CONFRONTOS ( ID_CONFRONTO INT PRIMARY KEY, ID_TIME_1 INT NOT NULL, ID_TIME_2 INT NOT NULL, DATA_CONFRONTO DATETIME NOT NULL, GOLS_TIME_1 INT NOT NULL, GOLS_TIME_2 INT NOT NULL -- Aqui você pode colocar FKs, algumas outras coisas de verificação, etc. ) Fiz um SQL genérico. Não sei que banco você está usando, mas é um começo. * * * **EDIT** Não faço a menor ideia de qual _framework_ você está usando, mas segundo seu comentário, falta uma associação no _join_ : $cons = $fcrud->select('t1.nome, t2.nome, confrontos.gols_time_1, confrontos.gols_time_2', 'confrontos c JOIN times t1 ON t1.id_time = confrontos.id_time_1 JOIN times t2 ON t2.id_time = confrontos.id_time_2', 'ORDER by confrontos.id_confronto DESC',array()); $ver = $cons->fetchAll(PDO::FETCH_OBJ);
stackexchange-pt_stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "php, banco de dados, tabela banco de dados" }
Book Series Identification - A series about mechanically enhanced children Recently I was reminded of a series of books that I never got round to finishing and I can't remember what it is to save my life Can anybody help me? Details I can remember \- A boy after discovering he has these weird abilities and enhancements is being pursued by some unknown group, (who helped create him) \- His parents were just scientists who helped create him and were tasked with bringing him up \- He eventually joins some sort of resistance \- At some point his "father" became the prime minister after murdering the previous PM \- Where I had gotten to there were three children known to have been "enhanced" \- There was the main character (who was a boy), I think what was meant to be his brother, and a french girl (who was working for the french government) Any help would greatly be appreciated
The _Jimmy Coates_ series by Joe Craig. Zafi Sauvage is the French girl. !Book covers
stackexchange-scifi
{ "answer_score": 2, "question_score": 5, "tags": "story identification" }
Why is my GCD program in C not running? I am trying to find the GCD of two numbers using Euclid's algorithm in C (recursively) and I do know that mathematically it's not completely perfect yet as it neglects negative number conditions, but I just want this one to work for positive numbers for now. #include <stdio.h> int gcd(int m, int n); int main() { return gcd(60, 24); } int gcd(int m, int n) { if (m < n) { //swapping both a and b m = m + n; n = m - n; m = m - n; } if (m == n) { return m; } else { return gcd(n, m % n); } }
`gcd(60, 24)` -> `gcd(24, 12)` -> `gcd(12, 0)`. That means you need to add a check. if ( n == 0 ) { return m; } or if ( m%n == 0 ) { return n; } You can also remove the variable swapping code with another call to the function with the values swapped in the call. int gcd(int m, int n) { if (m < n) { return gcd(n, m); } if (m%n == 0) { return n; } else { return gcd(n, m % n); } }
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "c, algorithm, function, recursion, greatest common divisor" }
How to use resque with the rubber gem I see that rubber has a bundle for the `resque` gem. If I vulcanize resque, what command would i need to run to create an instance that has the resque_worker and the web interface and the redis database? Thanks!
I answered this on the rubber mailing list: <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "ruby on rails 3, amazon ec2" }
Bubble line Up/Down in any modes The arrow keys can easily be enhanced and I would like to add the "bubble" feature for all modes. The idea is to use the `<C-Up/Down>` to take the line and move it along the text and preserve the cursor position. If possible I also would like the `cut` with `dd` to not alter the yank registers. The following works great in normal and visual mode, but not in insertion where I obviously need some help: nmap <C-Up> ddkP nmap <C-Down> ddp imap <C-Up> <C-C>:call BubbleUp()<cr> imap <C-Down> <C-C>:call BubbleDown()<cr> vmap <C-Up> xkP`[V`] vmap <C-Down> xp`[V`] function! BubbleUp() let l:col = virtcol('.') + 2 normal! ddkP execute 'normal! '.l:col.'|i' endfunction function! BubbleDown() let l:col = virtcol('.') + 2 normal! ddp execute 'normal! '.l:col.'|i' endfunction
Here's a trick I picked up a long time ago: nnoremap <silent> <M-c> @='"zyy"zp'<CR> vnoremap <silent> <M-c> @='"zy"zPgv'<CR> nnoremap <silent> <M-j> @='"zdd"zp'<CR> vnoremap <silent> <M-j> @='"zx"zp`[V`]'<CR> nnoremap <silent> <M-k> @='k"zdd"zpk'<CR> vnoremap <silent> <M-k> @='"zxk"zP`[V`]'<CR> The point of `@='...'` is to allow these macros to be given _counts_ , so that I can f.i. mark a few lines, then press `3``Alt-j` and move the entire block 3 lines down. The `Alt-c` combinations copies lines. "But these don't preserve cursor position". Yes: adding that part would leave you with nothing to do. :)
stackexchange-vi
{ "answer_score": 4, "question_score": 2, "tags": "key bindings, vimscript" }
How do you move a tile in OpenTTD Can you move a tile in OpenTTD 1.5.2 (depot, station, etc)? If so, how do you do it? I don't want to demolish it.
You cannot 'move' any structure you have constructed. The game does not allow you to undo any action, be it construction or purchases. To move something, you have to build the structure somewhere else, then remove the original. For stations, as long as the new station is within a certain radius of the original and you construct the replacement first, the new station will be grouped together with the original. This may also work for other structures, but further testing is needed.
stackexchange-gaming
{ "answer_score": 7, "question_score": 2, "tags": "openttd" }
Using multiples storages and task hubs for orchestrators between same function app in Azure I'm working with durable clients and I can't find the way to have multiple task hubs for each orchestrator in the same function app. Is this possible, and if so, how? Can I also have, between the same function app, multiple orchestrators using different storages?
As far as I know, a `Function App` can only have one `task hub`, and orchestrators in a function app should use the same storage. The following two designs are allowed: ![enter image description here]( Please refer to this official documentation.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "azure, azure functions, azure durable functions, orchestration" }
How to structure my DB for storing user's behavior (follow, favorite...) of my website I'm building a website that contains articles, these articles won't be shown until the user is logged in, I'm planning to add two buttons, the first one is called "follow this article", the second is meant to make the article as a favourite. My question is how can I structure that in my database? Should I just add a table that contains `id_article`, `id_user`, `followed(1 or 0)` and `favourite (1 or 0)`, or is there another solution that would let me economize more memory space? NOTE: My website will have lots of articles that will be visited by a lot of users.
Make two separate relations: `articles_followed (id, id_article, id_user)` and `articles_favourite (id, id_article, id_user)`. This will give you enough flexibility in: * adding new attributes, specific for each relation, * sharding your database (at some point): it'd be easier to move one relation from another since they are not depending on each other, * concurrent update: you can use separate locks on these two, in addition, you'll have fewer issues with transaction visibility, * you don't need to keep `is_followed` or `is_favourite` flag: if there's an entry, then it means that article is followed (once unfollowed, simply remove the line) Think about your domain classes structure -- which option would be more convenient to code? I bet, in case of two separate relations, it would be clearer.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "php, sql, database, web, storage" }
Data extract UserAgent with Mac We are running data extract on a daily basis, recently we added the 'Include User Agent Information'. Checking the consistency of the data we have found a user who opens the email with a Mac and clicks a link. The 'Opens.cvs' shows the following data: Browser EmailClient OperatingSystem Device Firefox Unspecified Windows XP PC But the 'Clicks.csv' is inconsistent with this data: Browser EmailClient OperatingSystem Device Chrome Apple Mail 1 Mac OS X 10.1 Macintosh We are 100%sure that the click is related with the open. ¿Has anyone expecienced this before?
There is a Known issue oppened:
stackexchange-salesforce
{ "answer_score": 0, "question_score": 1, "tags": "marketing cloud, data extract" }
How to test for the http ref in a link with Capybara <div id="look_here"> <a href="stackoverflow.com"><img src="xxxxxxxxxx.xxx"></a> </div> How would you test for this link in Capybara (and RSpec)? The image is dynamically generated, so I just want to test by `href`.
page.should have_selector "a[href='stackoverflow.com']" See Section 5.8.1 Matching attributes and attribute values on <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ruby on rails, rspec, capybara" }
Why does Quarkus warn me about injection in private fields? When I use something like the following in my Quarkus application: @Path("v1") @Produces(APPLICATION_JSON) public class HelloWorldResource { @Inject private SomeBean someBean; } then I get a warning the following during the build process. [INFO] [io.quarkus.arc.processor.BeanProcessor] Found unrecommended usage of private members (use package-private instead) in application beans: - @Inject field acme.jaxrs.v1.HelloWorldResource#someBean Everything seems to work just fine so why is Quarkus suggesting that change `private` to `package-private`?
If a property is `package-private`, Quarkus can inject it directly without requiring any reflection to come into play. That is why Quarkus recommends `package-private` members for injection as it tries to avoid reflection as much as possible (the reason for this being that less reflection means better performance which is something Quarkus strives to achieve). See section 2 of this guide for more details.
stackexchange-stackoverflow
{ "answer_score": 26, "question_score": 16, "tags": "quarkus" }
How to determine if Windows 10 executable can connect to my network I'm considering use of a scanner driver I see on a website. I don't know the site or the owner so I'll be paranoid and assume that this Windows 10 exe is malicious. I can run the code in a throwaway VM. What I'd really like to know if there's code in the driver that might try to access my network. Monitoring the network while running the driver code is not good enough. That code might be benign for some period of time and then become malicious. So, I'm wondering if there is some tool that can read (disassemble) Windows 10 exe code and identify any code that tries to access the network.
You could always setup a firewall rule. Open Windows Firewall, and select ADVANCED SETTINGS Right-click on OUTBOUND RULE, select NEW RULE. Select PROGRAM enter the pull path the exe under THIS PROGRAM PATH BLOCK THE CONNECTION Apply to All 3 connection profiles (domain, private, public) And give it a name... done!
stackexchange-security
{ "answer_score": 2, "question_score": 1, "tags": "windows 10" }
Assigning value to variable using if statement I am a learner. When I try to assign value to a variable as follows it doesn't work. Want to know the reason. this doesn't work: const w = if (2 > 1) { return 1500; } else { return 2500; } However this works: const w = function() { if (2 > 1) { return 1500; } else { return 2500; } }() Is there a better approach?
You cannot use a statement to assign into a variable. For the alternate solution use conditional/Ternary operator **_Syntax_** const var_name = condition ? true_value : false_value **_Example_** const w = 2 > 1 ? 1500 : 2500
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 0, "tags": "javascript, d3.js" }
How to execute command-line utilities in PHP? I have very limited knowledge when it comes to console commands. What I'm trying to achieve is to execute a console command within a PHP query. **Example** <?php $sql = mysql_query("SELECT * FROM `users`"); while( $select_users = mysql_fetch_array( $sql )){ } ?> **The command I want to execute within the WHILE** So within this query I want to execute this command however am unsure how to achieve this; I have looked at similar questions however unsure how to implement them into my example. ffmpeg -ss 00:00:01.01 -i /my_video_file_dir/video.flv -y -f image2 \ -vcodec mjpeg -vframes 1 /image_dir/screenshot.jpg
You can use exec function of php like this $command = 'ffmpeg -ss 00:00:01.01 -i /my_video_file_dir/video.flv -y -f image2 -vcodec mjpeg -vframes 1 /image_dir/screenshot.jpg'; exec($command);
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php" }
Let $|f(x)-f(y)| \leqslant (x-y)^2$ for all $x,y\in \mathbb{R}.$ Show that $f$ is a constant. > Let $|f(x)-f(y)| \leqslant (x-y)^2$ for all $x,y\in \mathbb{R}.$ Show that $f$ is a constant. This seemed quite straightforward just using the definition of the derivative, but I've ran into some weird issue. I have that $$|f(x)-f(y)| \leqslant (x-y)(x+y) \Longrightarrow \frac{|f(x)-f(y)|}{x-y} \leqslant x+y$$ from where I have that $\lim_{x\to y} x+y = 2y$. If the problem assignment would instead had $|f(x)-f(y)| \leqslant |(x-y)^2|$ I would have gotten $$|f(x)-f(y)| \leqslant |x-y||x+y| \Longrightarrow \frac{|f(x)-f(y)|}{x-y} \leqslant |x-y|$$ from where $\lim_{x\to y} |x-y| = 0$. And $f$ would be a constant. What might I be missing here?
For any $x \in \mathbb{R}$, you have: $|f(x+h) - f(x)| \le ((x+h) - x)^2=h^2=|h|^2\implies \left|\dfrac{f(x+h) - f(x)}{h}\right|\le |h|\implies \displaystyle \lim_{h \to 0} \left|\dfrac{f(x+h) - f(x)}{h}\right| = 0 \implies \displaystyle \lim_{h \to 0} \dfrac{f(x+h) - f(x)}{h} = 0\implies f'(x) = 0\implies f = \text{constant}.$
stackexchange-math
{ "answer_score": 5, "question_score": 4, "tags": "calculus, analysis" }
Removing non-English words from text using Python I am doing a data cleaning exercise on python and the text that I am cleaning contains Italian words which I would like to remove. I have been searching online whether I would be able to do this on Python using a tool kit like nltk. For example given some text : "Io andiamo to the beach with my amico." I would like to be left with : "to the beach with my" Does anyone know of a way as to how this could be done? Any help would be much appreciated.
You can use the `words` corpus from NLTK: import nltk words = set(nltk.corpus.words.words()) sent = "Io andiamo to the beach with my amico." " ".join(w for w in nltk.wordpunct_tokenize(sent) \ if w.lower() in words or not w.isalpha()) # 'Io to the beach with my' Unfortunately, _Io_ happens to be an English word. In general, it may be hard to decide whether a word is English or not.
stackexchange-stackoverflow
{ "answer_score": 46, "question_score": 26, "tags": "python, data science, data cleaning" }
Can hacker delete my server files and database where I am using below function? I want to know how to protect my website from hacker. I am a php-mysql developer. For fetching data from database i always use mysqli. For prevent my website from sql injection i always use `$db->real_esacpe_string()` function of php. For prevent my website from XSS(Cross site scripting) i used this function function parsing($text) { global $db; $text=$db->real_escape_string($text); $text= @trim($text); $text= strip_tags($text); if(get_magic_quotes_gpc()) { $text= stripslashes($text); } $text=str_replace('<','',$text); $text=str_replace('>','',$text); $text=htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); return($text); } $name=parsing($_POST['name']); Any suggestion from your side is welcomed. Thanks in advance.
With all of does done i don't think a hacker can delete or access your database. But there are also many other techniques a hacker can use in hacking your website. Like 1. DDOS 2. XSS 3. SESSION Hyjacking etc Which there are also different ways of protecting your website against them.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "php, mysqli, xss, spam" }
How to Fade, Blur, Feather an Object Gradually with Illustrator? Think of a black triangle. How would I gradually fade this triangle top down, where the top point stays sharp/in-focus while gradually (fading, blurring, feathering) towards the triangle base? Here's the best I could achieve with a faded clipping mask on an overlapping blurred second triangle. Doesn't look great. Ideally the triangle sides blur, fade evenly as they travel downward. ![enter image description here](
Here's what the output looks like using the suggested Gradient Across Stroke and pinching the anchor at the apex with the Width Tool. I'm happy with these results. ![enter image description here](
stackexchange-graphicdesign
{ "answer_score": 1, "question_score": 1, "tags": "adobe illustrator" }
regex adding linebreaks at every dot in a text except for defined abbreviations I am trying to find a regex for a bash shell script in Mac OS-X which replaces dots (.) into linebreaks (\n) in a big text file. But dots used for common abbreviations like tel. etc. Mr. Ms. U.S. and some others should be excluded. So far I am using sed for simple replacements already (but of course the ignore-part is missng): LC_ALL=C sed -i "" -e "s/.*SEARCH.*/REPLACEMENT/" ascii.txt **example:** Mr. Brown searches his fox. My tel. nr. can be found online. U.S. is a typical abbreviation for the United States. **the result should be:** Mr. Brown searches his fox.\n My tel. nr. can be found online.\n U.S. is a typical abbreviation for the United States.\n
After final testing I found out an even worse problem: sed is interpreting "\n" as text so I tried a different approach with "tr" which brings other problems for me. Finally I ended up again with sed and the following works for me on Mac OS-X 10.11.3: sed -E $'s/\./\.\\\n/g; s/(ca|Ca|Mr|Ms|etc|[0-9])\\n/\\1./g;' test.txt
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "regex, bash, macos, shell, sed" }
Benefits of Lotus Notes over Exchange Speaking big picture, what are the benefits of Lotus Notes over exchange. Is exchange meant for smaller companies who don't want to spend a lot of time maintaining their systems... but not as scalable? Is lotus notes more secure?
Lotus Domino and Exchange are **completely** different products. What do you want? Do you _only_ want email/calendaring? If so, I would avoid Domino. Domino provides a 'database infrastructure' of sorts. Databases can be webpages, email, calendar info, address books, CRM systems, configuration pages, everything. It's a way of life, not an email platform. Email using the Notes client is simply painful. If you're simply looking for an email system, go with something else. Why single out these two products? Do you happen to be looking for simply an email/calendaring solution compatible with BES (Blackberry Enterprise Server)? If so, I'd suggest considering either Zimbra or Exchange.
stackexchange-serverfault
{ "answer_score": 12, "question_score": 4, "tags": "exchange, exchange 2007, lotus notes" }
Usefulness of SQL Server "with encryption" statement Recently a friend and I were talking about securing stored procedure code in a SQL server database. From distant memory, I'm pretty certain that "with encryption" is incredibly easily broken in all versions of SQL Server, however he said it has been greatly improved in SQL 2005. As a result I have not seriously considered it as a security option in any systems I have ever worked on. So in what scenarious could "with encryption" be used, and when should it be avoided at all costs?
It can be used to hide your code from casual observers, but as you say: it's easily circumvented. It really can't be any other way, since the server needs to decrypt the code to execute it. It's DRM, basically, and fails for the same reason as all the other DRM does - you can't simultaneously hide the data, and allow it to be accessed.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 5, "tags": "sql server, encryption" }
How do I stub IQueryable<int> and IQueryable<String> How do I stub these methods: ProductDAL: public IQueryable<string> getCatNameList() { var db = new Database(); var categoryNames = db.ProductCategories.Select(c => c.Name); return categoryNames; } public IQueryable<int> getCatIdList() { var db = new Database(); var categoryID = db.ProductCategories.Select(c => c.Categoryid); return categoryID; } IProductDAL: IQueryable<int> getCatIdList(); IQueryable<string> getCatNameList(); Been searching on stackoverflow, but no questions/answers that gets me any closer to understanding how I go about doing this.
In this case I would recommend you change your interface to a series of `IEnumerable` rather than `IQueryable`. There is little point having these methods as queryables as they have already been projected. If you are just trying to stub them, use `Enumerable.Empty<type>().AsQueryable().`
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -2, "tags": "c#, asp.net, asp.net mvc, unit testing, stub" }
Ms Access List Box - Pass parameter on Double click to a new form **I have a listbox in Microsoft Access 2010** ![enter image description here]( **I am trying to pass all parameters to a new form(frmpopUpPatientInfo) on double click of a record, example when I click on Patient:21, it should pass 21, Clinton, bill to new form. What i tried is below where`lstEvents` is listbox name, `frmCalendar` is the parent form** Private Sub lstEvents_DblClick(Cancel As Integer) DoCmd.OpenForm "frmpopUpPatientInfo" MsgBox Me.Parent.frmCalendar.lstEvents.Column(1), vbInformation, "Test" End Sub **The Error i am getting is** ![enter image description here](
Try Forms!frmCalendar!lstEvents.Column(1) <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "vba, ms access" }
Is it true that there will always be a .lib(import library) associated with the .dll you build? Or do I need to instruct the compiler explicitly ?
With a user name like "ieplugin" the answer would probably be No. COM servers don't have .lib files. For regular DLLs, the .lib file is produced by the linker, not the compiler. The /IMPLIB option generates them.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "c++, c, dll" }
JQuery: fadeToggle() works in a wrong way I have two checkboxes with id > 'check1' , 'check2' two table columns with class > 'column1', 'column2' . In js file $(document).ready(function() { $('.column1').hide(); $('.column2').hide(); $('#check1').change(function() { $('.column1').fadeToggle(); }); $('#check2').change(function() { $('.column2').fadeToggle(); }); }); When check1 is checked column shows, then hides when unchecked. The problem is when check2 is checked column hides, and show when unchecked. They are code in the same way but works in different way. What causes the problem, how to fix it? Thanks.
Try this alternative: $('#check2').click(function(){ if($(this).is(':checked')) { $('.column2').fadeIn('slow'); } else { $('.column2').fadeOut('slow'); } });
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "javascript, jquery" }
Warning: This declaration shadows an existing declaration with a Struct I 'm looking for a way to clean my compile warning, i have a `Warning: This declaration shadows an existing declaration.` on the function below. The Transaction in the return is a `Struct` compose with id, sender,receiver etc... I don't know how i could refactor my code, any idea ? ![the function]( ![The compile warning](
Whenever you specify the return element in `returns()` with a variable name, you don't really need to create the variable again in the function. What you are doing here is expecting a variable, named `transaction`, of type `Transaction memory`, to be returned from the function. And again, you are re-declaring the variable, which gives a shadow warning. I would recommend to just remove the variable name from the `returns()` part. Just keep it returns(Transaction memory) {} Also, if you are working with `pure` and `view` functions, you can use `memory` instead of `storage` since you are not going to update your global structs.
stackexchange-ethereum
{ "answer_score": 1, "question_score": 1, "tags": "solidity, compilation, smart contract" }
Please verify azure search service is up, restart the WebApp and try again I am trying to publish my new Knowledgebase from QnAMaker.ai to my Azure app service. All the set up is done in Azure, and actually I have already published 2 Knowledgebase without any issue. Now this message keeps poping up. "Restart the WebApp and try again" doesn't help. ![enter image description here](
Looking through your question I see you have published 2 KBs sucessfully. I would recommend you to check Search Tier. You are likely to encounter this issue if you are exceeding the limit. The maximum number of knowledge bases is based on Azure Cognitive Search tier limits. ![enter image description here]( Reference : < If this is your case,you could consider for an Upgrade the Azure Cognitive Search service
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "azure, botframework, qnamaker" }
Overlay on full video length when making video from images sequence using ffmpeg I am facing a issue when I overlay watermark image on video (I am making video from images sequence).The issue is that the overlay image only append on first image and ignoring all other images in video. I want to overlay this image on whole video. Possibly I am wrongly applying -filter_graph to input stream. I am executing below mentioned script. I searched online but did not find any relevant answer. ffmpeg -r 1/5 -i img%2d.jpeg -i watermark.png -i music.mp3 -filter_complex "[0:v][1:v] overlay=x=10:y=10" video.mp4
Different resolution images causing the issue. Issue resolved after resizing images to same resolution.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ffmpeg" }
I am receiving a JSON.parse error on valid JSON I am parsing some JSON. My JSON is valid, because when I run it through JSONLint, I get the green label saying Valid JSON, yet for some reason I still cannot parse the JSON via my Angular Controller. JSON code can be found here. **Controller Code:** savvyApp.controller('ProductsCtrl', function($scope) { var apiJSONResult = '<linked json here>'; $scope.apiResult = JSON.parse(apiJSONResult); });
JSON.parse string with quotes That should be the answer. In short you cannot just copy paste JSON and quote it in single quotes and expect it to work. You would also need to make sure the backslashes are encoded. So the JSON _is_ in fact valid. But it is no longer valid if you copy paste it into a js file. It has to do with how javascript encodes backslashes in strings.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "json, angularjs" }
Save model without training in Tensorflow 2.0 with Keras I use Tensorflow 2.0 and the Keras sequential API to build a model. I would like to save an untrained model for baseline comparison. How do I do that? I tried to set `epochs=0` and `period=0` which did not work. Here is my code: network = NeuralNetwork() # sequential neural network cp_callback = tf.keras.callbacks.ModelCheckpoint(filepath='./models/', save_weights_only=False, period=0) network.fit(x_train, y_train, epochs=0, callbacks=[cp_callback]) How can I save an untrained model?
You simply have to call model.save after instanciation of your model : network = NeuralNetwork() # sequential neural network network.save("/your/path/.h5") ModelCheckpoint can only be called as a callback, so during the training.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "python, tensorflow, keras, tensorflow2.0" }
How do I make a long sequence of chained as_ref().unwrap()s more meaningful? What's the idiomatic way in Rust to re-order sequence on `as_ref.unwrap()` in something more meaningful? I have a set of values returned from a database and handle them in a following way: pub fn get_results(result: &Result<Option<Vec<Node>>, error::Error>) -> &Vec<Vec<Value>> { &result .as_ref() .unwrap() .as_ref() .unwrap() .first() .unwrap() .series .as_ref() .unwrap() .first() .as_ref() .unwrap() .values } Maybe I can iterate with higher-over function or something else?
If you do not want this boilerplate, you can add more boilerplate to not see it, with the try operator (`?`). See this proof of concept: #![feature(try_trait)] use std::fmt; use std::error::Error; #[derive(Debug)] struct MyError; impl Error for MyError { // } impl fmt::Display for MyError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { write!(f, "MyError") } } impl From<std::option::NoneError> for MyError { fn from(_: std::option::NoneError) -> MyError { MyError } } impl<'a> From<&'a std::io::Error> for MyError { fn from(_: &'a std::io::Error) -> MyError { MyError } } fn foo(i: &Result<Option<i32>, std::io::Error /* for example */>) -> Result<&i32, MyError> { Ok(i.as_ref()?.as_ref()?) } Unfortunately, I think that you cannot remove the `as_ref` calls.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "error handling, rust" }
Feature from workbench maybe? I'm trying to create a table in workbench, and I don't know why theses names can be set up. It ask me to change it. Maybe it concern features that I would like to disable. create table net_shows( title VARCHAR(100) ,rating VARCHAR(100) ,ratingLevel VARCHAR(100) ,ratingDescription INT(10) ,release year INT(4) ,user rating score FLOAT(4) ,user rating size FLOAT(4) ); release , user appear in blue like a special command.
A column name is an _identifier_ , and those can't include unless it's a _delimited identifier_ (sometimes called quoted identifier.) Also reserved words need to be delimited. (en.wikipedia.org/wiki/SQL_reserved_words.) In MySQL you use back-ticks to delimit an identifier. <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql, mysql workbench" }
Group or Aggregate functions (min(),max(),sum(),count(),...etc.,) cannot be used within the Group by/Order by/Where/ON clause It seems that I can not order by the count of a column which is odd because I have seen plenty of examples where the count() is used in the ORDER BY statement. I am using Zoho Analytics. Here is my query: SELECT "Lead Owner Name", "Lead Source", count("Lead Source") FROM "Leads" group by "Lead Owner Name", "Lead Source" order by count("Lead Source") DESC;
Try using an alias: SELECT "Lead Owner Name", "Lead Source", count("Lead Source") as cnt FROM "Leads" GROUP BY "Lead Owner Name", "Lead Source" ORDER BY cnt DESC; Most databases support arbitrary expressions in the `ORDER BY`. However, some require that the sorting expression actually be a column -- and they don't detect when a `SELECT` expression is the same as the `ORDER BY` expression. I've hit this problem before (I think with Hive) and just thought this might work in your environment.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "sql, zoho" }
How to test for live wire in a car using an analog multimeter? Let's say I cut my headlight harness off. Inside the wire loom, there are three orange wires, like this: !enter image description here I know one of them is for low beam, one for high beam and one for ground. I have an analog multimeter I just bought. How can I use it to determine which wire is for low, which is for high, and which is ground?
Don't try measuring current and don't allow any of the three wires to short or you'll blow a fuse or melt a wire... Don't try measuring ohms. Set the meter to read DC volts (not AC) Connect one lead of your multimeter to the battery ground terminal (presumably the negative terminal) and turn your lights on as if to activate the normal beam (low). One of the three wires should read +12V dc. Check that the other ones don't because if they do then you may have to try a different approach. Hopefully one wire is registering +12V. Next put lightswitch onto full beam and check which one of the three wires registers positive 12V - it shouldn't be the same as the wire that went positive on the low beam test.
stackexchange-electronics
{ "answer_score": 2, "question_score": 0, "tags": "automotive, multimeter" }
How to view Azure Service Principal Group Memberships in Azure AD? I can't find a way to view all the group memberships of a service principal in Azure. I can of course see the service principal in the list of "Direct Members" from the perspective of the group. For example: myGroup123 has members -> Rob, John, and servicePrincipal9 If I look at "servicePrincipal9", I can't see that it is a member of "myGroup123" Is there a way to find this info in the Portal? Via powershell? Via CLI?
Powershell approach via a MSFT support engineer: Get-AzureADServicePrincipalMembership -ObjectId <String> [-All <Boolean>] Documentation: <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "azure, azure active directory" }
Calculation of variance beta hat I have a regression setting of 1 covariate where $\sigma^2= 4$ and $$(X^TX)^{-1} = \begin{pmatrix} 0.2 & 0.05 \\\ 0.05 & 0.14 \\\ \end{pmatrix} $$ How can I get $Var(\hat{\beta_1})$ and $Var(\hat{\beta_0} - 0.5 \hat{\beta_1})$
All you need for this problem is that in the standard homoskedastic error setting, the covariance matrix of $\hat\beta = (\hat\beta_0, \hat\beta_1)$ is given by $$\mathsf{Cov}(\hat\beta) = \begin{pmatrix} \mathsf{Var}(\hat\beta_0) & \mathsf{Cov}(\hat\beta_0, \hat\beta_1) \\\ \mathsf{Cov}(\hat\beta_0, \hat\beta_1) & \mathsf{Var}(\hat\beta_1) \end{pmatrix} = \sigma^2 (X^\top X)^{-1}.$$ You can directly read off $\mathsf{Var}(\hat\beta_1)$; for the latter, use \begin{align*} \mathsf{Var}(\hat\beta_0 - 0.5\hat\beta_1) &= \mathsf{Var}(\hat\beta_0) + 0.5^2 \mathsf{Var}(\hat\beta_1) - 2\cdot 0.5 \mathsf{Cov}(\hat\beta_0, \hat\beta_1) \\\ &= \mathsf{Var}(\hat\beta_0) + 0.25\mathsf{Var}(\hat\beta_1) - \mathsf{Cov}(\hat\beta_0, \hat\beta_1). \end{align*}
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "variance, linear regression" }
Verb synonyms for 'come/spring to mind' What are some more formal synonyms in the form of a verb, preferably one word? thesarus.com produced 'strike', but it is transitive and sounds too grating. 'Arrive' sounds noncontextual.
> occurs > > It _occurs_ to me that 'occurs' is the word that you are looking for.
stackexchange-english
{ "answer_score": 3, "question_score": 1, "tags": "synonyms" }
Multiple entities in one UITableview I have a data model with two entitys with relationship one to many. Lets call them City<\-->>Person. In my tableview Im currently displaying each City, seperated by sections (currently one cell in each section). Is there any way for me to add each Person connected to the specific city in the corresponding section? (adding as many cells as number of persons connected to the city) Im using two different fetchedResultsControllers to access the Entities but cant quite figure out how to do this. Ultimately Id like each sections first cell to be a city, followed by all the persons in that city. Any help or pointer in the right direction would be highly appreciated.
As Michal mentioned in comments. A cleaner design would be for your City entities to be displayed in the section headers (pretty easy) and have your person objects in the sections as rows. To do that you need to add a unique identifier from the city as your section path of your `NSFetchedResultsController`. Since that attribute takes a key path you can specify something like `city.name` and it will resolve through the relationship from person to city and get that value. Your only other option would be to manually fetch the city objects and build your `UITableViewDatasource` to talk to your own construct of data. Doable but far, far more difficult than what Michal suggested.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "xcode, core data, nsfetchedresultscontroller, uitableview" }
Which of the following quadratic forms defines a non-singular conic? Which of the following quadratic forms defines a non-singular conic? (1). $x_{0}^{2}-2x_{0}x_{1}+4x_{0}x_{2}-8x_{1}^{2}+2x_{1}x_{2}+4x_{2}^{2}$. (2). $x_{0}^{2}-4x_{0}x_{1}+x_{1}^{2}-2x_{0}x_{2}$. What is a good way to solve this problem? Thanks a lot.
The matrix for the first conic is $$ \begin{bmatrix} 1 & -1 & 2 \\\ -1 & -8 & 1 \\\ 2 & 1 & 4 \end{bmatrix} $$ which has determinant $-9$. The matrix for the second conic is $$ \begin{bmatrix} 1 & -2 & -1 \\\ -2 & 1 & 0 \\\ -1 & 0 & 0 \end{bmatrix} $$ which has determinant $-1$. So neither is singular.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "geometry, projective geometry" }
The next generation of puzzle ![The image shows the puzzle. I can't describe it without giving it away! Sorry.]( Who or what is or are depicted above?
Well, I'm getting > Ensign Ro (Laren), from the row of Red Ensign flags, The blue guys could be: > Column-Meanies (Colm Meaney's).
stackexchange-puzzling
{ "answer_score": 8, "question_score": 7, "tags": "rebus" }
storing a js value from 1 ActionResult to use in another ActionResult I've got a Controller, and in one of the `ActionResult`s, there is a javascript value being returned that I can access via: Request.QueryString["frequency"] But I need to use that same variable in another `ActionResult`. How can I do this? I know that I can't set a string frequency = ""; at the top of the Controller, and then just set in the 1st `ActionResult`.
HTTP is stateless, every request has it's own state and Controller instance. You can use `TempData` which use `Session` but delete the value after you read it.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "c#, javascript, jquery, asp.net mvc, asp.net mvc 3" }
Project Reactor. Mono.map() vs Mono.flatMap() What is the principal difference between these in terms of `Mono`? From the documentation, I read that `flatMap` acts asynchronous and `map` synchronous. But that doesn't really make sense for me b/c Mono is all about parallelism and that point isn't understandable. Can someone rephrase it in a more understandable way? Then in the documentation for `flatMap` stated (< Transform the item emitted by this Mono asynchronously, returning the value emitted by another Mono (possibly changing the value type). Which another Mono is meant there?
`Mono#flatMap` takes a `Function` that transforms a value into another `Mono`. That Mono could represent some asynchronous processing, like an HTTP request. On the other hand, `Mono#map` takes a `Function` that transforms a value of type `T` into _another value, of type`R`_. That transformation is thus done imperatively and synchronously (eg. transforming a `String` into an `URL` instance). The other subtlety with `flatMap` is that the operator subscribes to the generated `Mono`, unlike what would happen if you passed the same `Function` to `map`.
stackexchange-stackoverflow
{ "answer_score": 26, "question_score": 16, "tags": "spring webflux, project reactor" }
How to remove lines with repeated value from a text file i have a text file with various codes (one code per line) in a column and some of them appear more than once (always in order). I would like to know how can i remove those lines with repeated values. Example: File1.dat 84578 84581 84627 84761 84761 84792 84792 84792 84886 84886 84905 84905 84905 I would like the output to be: 84578 84581 84627 84761 84792 84886 84905 Note: In my file there are no empty spaces between lines. Any solution would do, scripts, terminal commands, etc. Thanks in advance.
Since the duplicate lines are consecutive, With Linux/MSYS you can simply use `uniq` Output with your data: $ uniq lines.txt 84578 84581 84627 84761 84792 84886 84905 Python solution using generator comprehension to check if first line or line different from previous to issue the line in the output file: with open("lines.txt") as fr,open("uniq.txt","w") as fw: for line in (x for i,x in enumerate(fr) if i==0 or lines[i-1]!=x): fw.write(line)
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, bash, shell" }
Set a TeamCity parameter to a date variable I have a TeamCity build that passes some arguments to an .exe and runs it daily. One argument is for a date parameter, currently set to a static date. It now needs to be dynamic, passing in the current date. I tried setting the value to %env.BUILD_START_DATE% but this makes all my agents incompatible because of an implicit requirement for that env variable. I also tried setting the date in the DOS command line script, skipping TC params altogether, but it still ends up with that implicit requirement.
The top answer here: TeamCity Current Date variable in MMdd format indicated need for a TC plugin, the second answer, however, did not require a plugin and is mostly complete. How I made it work on a variation of that second answer: 1.) Add a powershell build step to run the following: echo "##teamcity[setParameter name='env.BUILD_START_DATE' value='$([DateTime]::Now)']" 2.) Give env.BUILD_START_DATE a default value in the Environment Variables section. Without the default value TC thinks having this value is an implicit requirement of a build agent, rendering all of them incompatible.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "teamcity" }
Show another activity in a layout in Android? I have an application that displays contacts from the contact book. This isnt hard: Intent intent = new Intent(Intent.ACTION_VIEW, Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, ""+contactId)); startActivity(intent); However, I would like my apps banner to still be showing on the top of the screen. Is there any way to show this new activity as part of my own layout, so I can have my banner and some buttons, and then show the contact in a FrameLayout at the bottom? Cheers,
The answer is: It is impossible. A securityException is always thrown because my app does not have the correct process ID to run that intent within my own activity.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, android activity" }
how to add modifier passed as parameter to the end of Modifier? I have a function: @Composable fun sendNewSmsText(passedModifier: Modifier){ Text(text = stringResource(R.string.when_sms_not_received), style = Typography.body2.copy(), modifier = Modifier.padding(4.dp) ) } how to add a passedModifier to the text's end? like: @Composable fun sendNewSmsText(modifier: Modifier){ Text(text = stringResource(R.string.when_sms_not_received), style = Typography.body2.copy(), modifier = Modifier.padding(4.dp).passedModifier ) }
Using `Modifier.then()` < Modifier.padding(4.dp).then(passedModifier)
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 3, "tags": "android jetpack compose" }
how to convert numpy array of arrays into array of matrices? I have a numpy array of arrays (it's the list of pictures and each picture is flattened and represented as 1x784). I want to get array of matrices (each matrix should be represented as 28x28) how can I do it?
`whatever-your-array-of-arrays-is-called.reshape(-1,28,28)` will reshape. If that does not yield the correct representation, you'll still be able to figure it out using reshapes, but then for example by looping and reshaping individual array.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "python, arrays, numpy, matrix" }
How to calculate (a*b*c*d/e)%m f a,b,c,d,e are of order 10^18? I want to calculate `(a*b*c*d/e)%m` where my `a,b,c,d,e` are of order `10^18` . `e` perfectly divides `a*b*c*d`. The problem is that I cannot multiply them, as I won't be able to store them as they would be of the range(10^72). Again, I can't take modulus first either? What should I do?
Using the modular arithmetic properties and that `e` divide `a*b*c*d`. Also assuming that `m*m` don't overflow in the type of data used. As modular arithmetic state: if `a1 = b1 mod n` and `a2 = b2 mod n` then: a1 + a2 = b1 + b2 mod n a1 - a2 = b1 - b2 mod n a1 * a2 = b1 * b2 mod n The **division** is not here. By this you could **not** use: `((a%m)*(b%m)*(c%m)*(d%m)/(e%m))%m` Code. gcd_value = gcd(a, e); result = (a / gcd_value) % m; e /= gcd_value; gcd_value = gcd(b, e); result *= (b / gcd_value) % m; e /= gcd_value; gcd_value = gcd(c, e); result *= (c / gcd_value) % m; e /= gcd_value; gcd_value = gcd(d, e); result *= (d / gcd_value) % m; result = result % m;
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 4, "tags": "c, algorithm" }
SQL - Select Uppercase fields i have a table, that has a column (SQL_Latin1_General_CP1_CI_AI), and has a couple of hundred rows where that column is filled in all uppercase. I would like to know if it is possible to select all the rows that have that field in uppercase and, ultimately if i can make an update to capitalize the fields. I'm using SQL Management Studio on MSSQL 2005 Thanks
DECLARE @T TABLE ( col VARCHAR(3) COLLATE SQL_Latin1_General_CP1_CI_AI ) INSERT INTO @T SELECT 'foo' UNION ALL SELECT 'BAR' UNION ALL SELECT '' UPDATE @T SET col = STUFF(LOWER(col),1,1,LEFT(col,1)) WHERE col = UPPER(col) COLLATE SQL_Latin1_General_CP1_CS_AS AND LEN(col) >1 SELECT * FROM @T Returns (1 row(s) affected) col ---- foo Bar (3 row(s) affected)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "sql, sql server, sql server 2005" }
I want to look up a unique number in a table and get row and column name I have a two table in Excel. I want to search for the code in column B in the first table. I want to write row and column names in column C when I find this value in the array in the second table. Excel screenshot - More details are included in the screenshot. [![\[1\]: Thank you!
In cell C2 and copied down: =IF(COUNTIF($F$2:$I$3,B2)=0,"",INDEX($1:$1,,SUMPRODUCT(($F$2:$I$3=B2)*COLUMN($F$2:$I$3)))&"-"&INDEX($E:$E,SUMPRODUCT(($F$2:$I$3=B2)*ROW($F$2:$I$3))))
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "excel, excel formula" }
Is it possible to purchase the OEM USB sync cable? Is it possible to buy the genuine Apple USB sync cable for iPad/iPhone/iPod? I know there are many aftermarket cables available, but most of them seem inferior.
Yes \- look for Apple USB to dock connector in the store. It also comes with most chargers and dock accessories if you want a bundle.
stackexchange-apple
{ "answer_score": 3, "question_score": 2, "tags": "ipad" }
Pandas Panel : How To Iterate Over the Minor Axis? What is the preferred way to iterate over all the items (which are dataframes) in a Panel's Minor Axis? At the moment I am using pnl = pd.Panel( ... ) for key, df in pnl.transpose(2,1,0).iteritems(): print( key ) but it looks ugly and unpythonic.
In [27]: for key in pnl.minor_axis : ....: print key ....: print pnl.minor_xs (key)
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "python, python 3.x, pandas" }
the witcher 2: kayran infinite healing bug When I fight the first boss, **Kayran** (difficulty: **Dark** , version: **3.3.3.1** , no mods), I attack the tentacles but they don't get cut. The life of the monster goes down a bit with each attack until disappointingly the bar returns full or almost full, in an infinite cycle. Nothing else happens. How can I defeat Kayran?
Solution: I was about to give up when I tried to see what would happen fighting the boss without wearing anything except for the silver sword and the eventual kayran trap. For me it works **but** if i can't cut a tentacle the at the first try then I have to restart the fight, possibly restarting the game entirely.
stackexchange-gaming
{ "answer_score": 3, "question_score": 0, "tags": "the witcher 2" }
Entity Framework CodeFirst Move Data From One table To another I'm using Entity Framework(4.3) Code First Method For My Asp.Net Mvc3 Application.I want to do:Data of table A must be copied (along with some other data) to table B after that when Click Save Button Tabla A Data will be Removed how to implement this?
Here are the logical steps to take. Add the following to the Save button's click event: 1. Use a loop to iterate over each row in table A. 2. While looping, add the row information from table A, along with the other data that must be copied, to table B. 3. Verify that the data in table B contains the information you need 4. Use a loop to iterate over each row in table A again, but this time remove each row. Hope this helps.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": ".net, asp.net mvc 3, linq, c# 4.0, entity framework 4.3" }
APN Switch for sprint devices I have used APNDroid on many of my phones in the past. I have recently started using some sprint devices and noticed that this APN toggle widget will not disable the network connection on these devices. I don't know if it is something because of the different network type, or some other reason. Can anyone point me to another application that you've had luck using to turn off the data connection on sprint phone?
APNDroid doesn't work on CDMA phones. This appears to be the case with most such apps. Internet Scheduler and GreenPower claim to work on them if you have Gingerbread, though. There are some other solutions you can try in this Google Groups thread.
stackexchange-android
{ "answer_score": 1, "question_score": 1, "tags": "internet, apn, cdma" }
Tool to measure system uptime minus locked time from windows logs Please let me know if you have come across a tool with this capability for Windows 7 1) read system start up and shut down times from the windows event log 2) subtract the time while the system was locked or logged off Or if there is nothing like above, at least anything partial like parsed output of item (1) alone above, so that I can build on that
If you want CLI, you can use the Get-WinEvent cmdlet in Windows PowerShell (free, included in Windows XP and later): * read system start up times: `Get-WinEvent -FilterHashtable @{L ogname='System';ID=6005}`. Event 6005 is logged at boot time noting that the Event Log service was started. It gives the message "The Event log service was started". !enter image description here * read system shut down times: `Get-WinEvent -FilterHashtable @{L ogname='System';ID=6006}`. Event 6006 is logged as a clean shutdown. It gives the message "The Event log service was stopped". !enter image description here * read system log off times: `Get-WinEvent -FilterHashtable @{L ogname='System';ID=4634}`. !enter image description here and so on. FYI List of all Windows 7 Event IDs and Sources?.
stackexchange-softwarerecs
{ "answer_score": 2, "question_score": 4, "tags": "windows, logs, system monitor" }
What does "resignation" mean in this extract? What does "resignation" mean in the text below? > There were many others who were alarmed by the drive to self-fulfillment Jane exhibited; The Spectator in April 1860 deplored the "pale, clever, and sharp-spoken young woman" who had become the fashion; the Saturday Review pretended **resignation** to the dominance of "glorified governesses in fiction," who, like the poor, would be always with them, since literature had "grown to be a woman's occupation." > > — A Literature of Their Own by Elaine Showalter I looked it up in a few dictionaries, but I think none of them fits this context. According to The Free Dictionary, "resignation" means > 1. The act or an instance of resigning > 2. An oral or written statement that one is resigning a position or office > 3. Unresisting acceptance of something as inescapable; submission. >
It's meaning No. 3. They pretended to be resigned to the fact that the spirited governess had become a favourite character in fiction.
stackexchange-english
{ "answer_score": 3, "question_score": 0, "tags": "meaning in context" }
Distance between two alphabets in a string I have a string CNCCN and I need to find the index distance between the two Ns. I know there are some ways to do this but involves writing many lines of code. Is there is a one-liner that could do this?
You can just use the `str.index(char, [beg, end])` method to retrieve the position of a character inside a string. The method allows you to add a beginning and end position that you can use to check for the different occurrences. Here the code: s="CNCCN" dist = s.index('N', s.index('N') + 1) - s.index('N') And its output: print(dist) 3 Using multiple lines you could avoid calling the `s.index(...)` method multiple times but you requested one-liner.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -5, "tags": "python, string, list" }
preventing deletion of tmp files by Git I would like to use IntelliJ as a diff tool at Cygwin. But before IDEA is showing up the diff screen, the tmp file which is created under `/tmp` is being deleted. My question is how can I prevent deletion of tmp files? Is there any config at git for this? Edit: [difftool "ideadiff"] cmd = echo \"$(cygpath -wla $LOCAL)\" \"$(cygpath -wla $REMOTE)\" When you echo paths, I can see paths but there is not any file in this path. I have also `cat` files in console which is perfectly showing content. But after exiting from difftool command I can not see any file at under `/tmp`? Why?
My conjecture is that IDEA «detaches» itself (by forking and exiting). You can easily check if it's true by launching it from a terminal — if the prompt is shown right after the launch, then it's true. To git it looks like your diff tool has exited, and so it cleans up the temporary files. I can see two possible solutions: 1. Perhaps IDEA has a flag which prevent detaching. For instance. there is such a flag for gvim — `-f`. 2. If not, than you may wrap IDEA in a shell script that would copy the files and then launch IDEA itself with your copies (which git knows nothing about). Then again you have to think about when to delete them. You may copy them again to `/tmp` and then hope that your OS will clean them up.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "git, cygwin" }
Reordering Pandas Table Headers I am working with a Pivot Table in Pandas and I am facing an issue with the order of multi-level column headers. Currently, I have the following column headers. !enter image description here And, I want to reorder them to look like this !enter image description here Is there any way to do this? TIA!
Use `DataFrame.swaplevel` with `DataFrame.sort_index`: df = df.swaplevel(1, 0, axis=1).sort_index(axis=1)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "python, pandas, dataframe, datatables, pivot table" }
Let $H = \{\alpha^2 : \alpha \in S_4\}$. Show that $H = A_4$. > Let $H = \\{\alpha^2 : \alpha \in S_4\\}$. Show that $H = A_4$. * Suppose $x \in H$. Then $x = \alpha^2$, where $\alpha \in S_4$. Since elements of $S_4$ takes on the form of 2-cycles, 3-cycles, product of two 2-cycles, and 4-cycles, we look at their individual squares. If $\alpha = (a b)$, then $\alpha ^2 = \epsilon \in A_4$ (identity). If $\alpha = (a b c)$, then $\alpha ^2 = (a c b) = (c b )(a b) \in A_4$. If $\alpha = (ab)(cd)$ or $(ac)(bd)$ or $(ad)(bc)$, then $\alpha^2 = \epsilon \in A_4$. If $\alpha = (abcd)$, then $\alpha ^2 = (ac)(bc) \in A_4$. Hence, $ H \subseteq A_4$. Is this direction correct? Also, how can I prove the other inclusion? Do I look at each element $y \in A_4$ and try to find some element $x \in S_4$ such that $x^2 = y$? Is there another way to do this?
Your proof is correct. For the reverse inclusion, I will show that for each $y\in A_4$, there exists $x\in S_4$ such that $y=x^2$. This can be done similarly by considering the cycle structure of elements in $A_4$. (i) If $y=\epsilon$, then $y=(12)^2$. (ii) If $y=(ab)(cd)$, then $y=(acbd)^2$. (iii) If $y=(abc)$, then $y=(acb)^2$.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "abstract algebra, group theory, symmetric groups" }
Teapot Riddle no.25 (fan made) Teapot riddle rules: I have one word which has several (2 or more) meanings. Each of the meanings is a teapot (first, second ...) You try to figure out the word with my Hints. First: > My first teapot could be almost anything. Second: > My second teapot is very specific. Third: > My third teapot is quite the contrary.
Would you happen to be: > Object _My first teapot could be almost anything._ > **Object** is a generic term for just about anything. **_Can you hand me that object on the table?_** _My second teapot is very specific._ > An **object** is also classified as a _goal_ or _purpose_ , though typically referred to as an **objective** , it can be the former: **_The object of my reality is to become Hokage!_** _My third teapot is quite the contrary._ > To **object** to something is to disagree with, which is quite the contrary.
stackexchange-puzzling
{ "answer_score": 9, "question_score": 7, "tags": "riddle, word, wordplay" }
Laravel Eloquent: Get current id from inner function I know, we can do this in the controller: User::with('post')->get(); It will get every user's post from the database, based on `users.id`. But the problem is, I want to do this: User::with(['post' => function($query) { # Throw users.id here... }])->get(); How to do that?
You should get the users first, and then load related posts with a separate query and merge them manually. $users = User::get(); $posts = Post::whereIn('user_id', $users->pluck('id'))->get(); // Get your additional data in this query $users->each(function ($user) use ($posts) { $user->posts = $posts->where('user_id', $user->id); }); **Note:** I did not test the code above. It's just an example to show you how to accomplish what you are trying to do.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "laravel 5, eloquent" }
Is it possible for a multicellular organism to evolve a capacitor? Is it possible for an organism to evolve a capacitor if the conditions were right (carnivore that stuns fish, living in complete darkness, etc.)? What kind of challenges would there be to evolve something like this? What fluid would it most likely be present in? I was looking at Wikipedia's page on electric eels and was just wondering about this. I'm learning about electrical fields and voltages in my college classes right now.
A capacitor is, in its bare components, a dielectric separating two opposite charges. An electric eel creates its discharge by separating ions via an energy pump and opening the channel on demand. Therefore, in a way, living organisms have already evolved a capacitor. It doesn't come with the package we see in printed boards, it has no color coding, but it does its job.
stackexchange-worldbuilding
{ "answer_score": 8, "question_score": 6, "tags": "science based, evolution, electricity" }
How to avoid displaying the leading and trailing spaces in vs code ![enter image description here]( Attached is the picture where the leading spaces are visible higlighted with red color. How to avoid displaying these whitespaces ? I have tried delete whitespaces extension. On saving the file they again come back.
What you see is changes since the last commit if your code is under version control system like git. Probably when you save your file auto code formatter restore this space according to your code format settings. You can try to disable "Format on save" option in VSCode settings.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "visual studio code" }
Multiple detail band in JasperReports I want to show multiple detail section in my jasper report. How to add multiple detail bands in JasperReports? For details band I am passing collection from my java class. So if I have multiple detail band how to pass the different collections to different detail band. Can some one provide help on this
Multiple "Detail" bands is not possible. You can add "Group Bands" before and after the Detail band though. **UPDATE** For the upper part of the report: * The Detail Band is the one with the Product Line, Name, Amount ... etc. * The Group surrounding the Detail, containing the Branch is one level upper group. * The Group surrounding the Branch Group is the State Bang, its the top level. First make two groups, call one of them "State" and the other "Branch", When writing your query make sure you order the results by State, then Branch. If you do that, Jasper will make sure to group the results exactly as in the snapshot. Check this snapshot, you should make the report something like this: ![alt text](
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 5, "tags": "jasper reports, ireport" }
Formal word for "Home Made" I'm seeking a more professional replacement for the word "home made". I'm writing my dissertation and I want to explain how I first used a home made code to simulate my project, as apposed to using a built in toolbox that comes with a professional program (which I use later). I cant use the words "custom" or "bespoke", as the toolbox is extremely flexible and can be used to create custom and bespoke simulations (which is the reason I end up using it over my original code), so I don't want to cause confusion by using these words. I basically just want a word that distinguishes the difference between a simulation I made myself from scratch, and a simulation made using a professional program.
I would say "I authored custom source code to simulate…"
stackexchange-english
{ "answer_score": 1, "question_score": 4, "tags": "single word requests, terminology" }
Dot initialization struct after malloc I'm trying to allocate a structure with malloc and then initialize it with the dot syntax. I tried some things, but it seems to be impossible. #include <stdlib.h> #include <stdio.h> struct t { int nb; }; struct t *foo() { struct t *f = malloc(sizeof(struct t)); *f = { .nb = 0 }; return f; } int main(void) { printf("%d\n", foo()->nb); return 0; } The compiler says : $ gcc -Wall -Werror -std=c99 -Wextra -pedantic test.c test.c:11:8: error: expected expression *f = { .nb = 0 }; ^ 1 error generated. I tried the assignation without the dereferencement to make another error, I was expecting an incompatible assignation of pointer and non-pointer variable, but the message was the same. Do you have some tricks to afford this ? BR.
Your code doesn't work because it's not initialization, strictly speaking, but assignment. You need a valid object expression on the right hand side for it to work, and a brace enclosed initializer is simply not that. But that can be amended rather easily by making the rhs a compound literal: *f = (struct t){ .nb = 0 };
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "c, memory, memory management, struct" }
Can anyone explain the meaning of this statement " var upload_file_count_text = +filenames.length + +upFiles;" I came across a piece of code written in below format in a .js file. I am wondering what would it actually do. Just trying to understanding the purpose of this statement. var upload_file_count_text = +filenames.length + +upFiles;
The `+` prefix on the variable names is the 'unary' operator. In JavaScript it is in effect shorthand for `Number()`. The code is changing both `filenames.length` and `upFiles` to ints from string so their values can be added instead of concatenated. The code is equivalent to: var upload_file_count_text = Number(filenames.length) + Number(upFiles);
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "javascript, jquery" }
Using 28 AWG flat/ribbon cable for LEDs I want to control a lot of LEDs (like 128) in an area of about 1 m2. Instead of using separate wires, could I use a 28 AWG flat cable, and split/cut it wherever needed? E.g. split it in two wire groups and cut it wherever I want to place a LED? Btw, I'm intending to use two MAX7219 ICs to control them using multiplexing. According to the AWG table, I can use 0.226 A for each wire, which is enough (the LEDs I used are simple 3 mm LEDs and not intending to give them more than 0.2 A of current).
I think that you will be fine. You should expect a voltage drop of ~90mV/meter at 0.2A. According to : Fermi National Accelerator Laboratory **Ampacity Test of 28 AWG Ribbon Cables (1990)** lss.fnal.gov/archive/test-tm/1000/fermilab-tm-1657.pdf 28AWG Ribbon cable with parallel runs has been tested to 2.5A per conductor in free air, leveling off at about 40C. Try it and find out for yourself. Add a sprinkling of multiplexing to reduce the duty-cycle, and even more headroom is added. Go for it.
stackexchange-electronics
{ "answer_score": 1, "question_score": 0, "tags": "led, wire, awg" }
Encoding byte data and storing as TEXT vs storing in BYTEA in PostgreSQL I have some byte data(millions of rows), and currently, I am converting to base64 first, and storing it as TEXT. The data is indexed on a row that contains base64 data. I assume Postgres does the conversion to base64 itself. Will it be faster if I store using BYTEA data type instead? How will the indexed queries be affected on two data types?
Converting bytes to text using Base64 will consume 33% more space than bytes. Even this _would_ be faster, you will use quite more space on disk. Loading and storing data should be slower as well. I see no advantage in doing that. Postgres supports indices on `BYTEA` columns. Since the bytes are shorter than the text, byte columns with indexes should be faster than text columns with indices as well.
stackexchange-stackoverflow
{ "answer_score": 16, "question_score": 6, "tags": "sql, postgresql" }
Terminal Server 2008: Installing 16-bit Application (FoxPro 2.6) I have one physical Windows 2008 R2 server running Hyper-V. Running under Hyper-V I have a virtual Windows Server 2008 R2 server running Remote Desktop Services (Terminal Services). I'm preparing my applications using the "Install Application on Remote Desktop..." control panel app. So far so good. However, I am now trying to install FoxPro 2.6 which is a 16-bit windows application. When I try to install it I receive the message: "The version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need an x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher". Is there any way around this? I'm in the middle of a large migration to thin-clients and foxpro 2.6, while it won't be around forever, is a very integral application for our data-entry personnel. How can I get this to work? Thanks in advance!
The only way you can simulate this is to setup a 32-bit machine in a VM and install the Remote App extensions and run them through your TS. It's a very round-about way of doing it, but it'll get the programs on there until you can replace them.
stackexchange-serverfault
{ "answer_score": 3, "question_score": 3, "tags": "windows server 2008, terminal server, 64 bit, remote desktop services" }