qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
28,372,424
I can't understand the following behavior of ranges in Haskell. Enumerating 1 to 1 gives me a list contain only 1, and 2 to 2 gives me a list contain only 2 as given below. ``` Prelude> [1..1] [1] Prelude> [2..2] [2] ``` But enumerating infinity to infinity gives me a list which is infinite in length and all the ele...
2015/02/06
[ "https://Stackoverflow.com/questions/28372424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2148851/" ]
As Luis Wasserman and Tikhon Jelvis have indicated, the basic problem is that the `Num` and `Enum` instances for `Float` and `Double` are *weird*, and really should not exist at all. In fact, the `Enum` class itself is pretty weird, as it attempts to serve several different purposes at once, none of them well—it is pro...
I believe the implementation of `[a..b]` continues incrementing `a` by one until it is greater than `b`. This is never going to happen with infinity, so it goes forever. I believe your code will probably default to `Double` the way you've written it, which has well-defined semantics for infinity. IIRC, Haskell follows...
74,541,684
I am using Webview\_Flutter. The header of the site overlaps the position of the statusbar and I would like to add padding to avoid this. This is the process of inserting padding to avoid the statusbar if the webview is opened or if there is a scroll position at the top. ``` body: Padding( padding: (con...
2022/11/23
[ "https://Stackoverflow.com/questions/74541684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18096205/" ]
To detect WebView scroll event, you can use the [`flutter_inappwebview`](https://github.com/pichillilorenzo/flutter_inappwebview) plugin (I'm the author) and implement the `InAppWebView.onScrollChanged` event. However, probably you don't need to add top padding for your WebView. You can set the `AppBar.toolbarHeight` ...
I tried to find the listener of the webView scroll, I couldn't find it , you're right. There is a solution ^^, it's simple, we could wrap WebView in ListView then we could use scrollListener(1) or notificationListener(2) and don't forget to use setState to update Padding values ``` class _HomeScreenState extends State...
170,885
The following integral can be obtained using the [online Wolfram integrator](http://integrals.wolfram.com/index.jsp?expr=1%2F%281%2BCos%5Bx%5D%5E2%29): $$\int \frac{dx}{1+\cos^2 x} = \frac{\tan^{-1}(\frac{\tan x}{\sqrt{2}})}{\sqrt{2}}$$ Now assume we are performing this integration between $0$ and $2\pi$. Hence the ...
2012/07/14
[ "https://math.stackexchange.com/questions/170885", "https://math.stackexchange.com", "https://math.stackexchange.com/users/19717/" ]
Quite simple: the $\arctan$ function is multivalued, so you have to add the appropriate multiples of $\pi$ to the function to get at the right result; i.e., $\sqrt{2}\pi$
The antiderivative you are using is not continuous from $0$ to $2\pi$. Ask Wolfram to graph it. Then try to see if you can adjust it by constants on various intervals to make it continuous, and you will see that the integral is quite far from $0$.
66,431,744
Suppose I have a 3D array, how can I fill the diag of the first two dimensions to zero. For example ``` a = np.random.rand(2,2,3) for i in range(3): np.fill_diagonal(a[:,:,i], 0) ``` Is there a way to replace the for loop?
2021/03/02
[ "https://Stackoverflow.com/questions/66431744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14513243/" ]
The following is one of the solution ``` a = np.random.rand(2,2,3) np.einsum('iij->ij',a)[...] = 0 ```
The np.diag function returns a 2D diagonal matrix. ``` a[:,:,0] = np.diag((1,1)) ```
5,137
Hey, so I'm just playing around with a usb cable and an LED. I plugged in the usb to my computer and connected ground with the LED ground and the last usb pin (+) to the LED. It stays lit bright. I moved the wire from the usb power pin to the D+ pin. Is it possible that I could send a bit stream through usb that would...
2010/12/25
[ "https://unix.stackexchange.com/questions/5137", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/3170/" ]
Another alternative might be a usb-serial or usb-parrallel port dongle. Note you will need a resistor in series with your LED to limit the current to suitible amount to avoid burning out something (either the LED or the interface). Another option is, there are off the shelf devices available that do something like wh...
If you have an old-style parallel or serial port, this is much easier.
31,809,201
Here's my current code: ``` private void searchTextBox_TextChanged(object sender, EventArgs e) { (dataGridView1.DataSource as DataTable).DefaultView.RowFilter = string.Format("Name='{0}'", searchTextBox.Text); } ``` However my data grid table filters everything and becomes blank whenever I type some...
2015/08/04
[ "https://Stackoverflow.com/questions/31809201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5169032/" ]
The *likely* reason you are seeing a blank `DataGridView` is due to your filter string searching for exact matches to the `TextBox` text. > > > ``` > "Name='{0}'" > > ``` > > Because you are updating this filter in the `TextBox.TextChanged` event, the first time you enter a character - no matches are found. For ...
OhBeWise answer is the best but until i add something to get points i'm not allowed to like it. so i'll add this, remember in OhBeWise's answer that your filtering the rows to be listed but using the column name from the query. the query used to set the datasource of the datagridview. For Instance in my example "Log...
36,772,523
My method interface is ``` Boolean isAuthenticated(String User) ``` I want to compare from list of values if any of the users are passed in the function from the list, then it should return true. ``` when(authService.isAuthenticated(or(eq("amol84"),eq("arpan"),eq("juhi")))).thenReturn(true); ``` I am using addit...
2016/04/21
[ "https://Stackoverflow.com/questions/36772523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/157704/" ]
`or` does not have a three-argument overload. ([See docs.](http://site.mockito.org/mockito/docs/current/org/mockito/AdditionalMatchers.html#or(T,%20T))) If your code compiles, you may be importing a different `or` method than `org.mockito.AdditionalMatchers.or`. `or(or(eq("amol84"),eq("arpan")),eq("juhi"))` should wor...
For me this works: ``` public class MockitoTest { Mocked mocked = Mockito.mock(Mocked.class); @Test public void test() { Mockito.when(mocked.doit(AdditionalMatchers.or(eq("1"), eq("2")))).thenReturn(true); Assert.assertTrue(mocked.doit("1")); Assert.assertTrue(mocked.doit("2")); ...
3,671,062
I don't want to deal with users who have javascript turned off, so I want to just prevent them from using my application. I want to detect if the user has javascript turned on so I can redirect them to a page that tells them they need to use javascript. I'm sure its in the request header. Anyone have any ideas how I ca...
2010/09/08
[ "https://Stackoverflow.com/questions/3671062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43792/" ]
The `noscript` tag is the easiest solution, though not exactly whay you're looking for. ``` <noscript>Get outta here.</noscript> ```
You can't. The server has no idea what the client has enabled. You can't even "detect" if Javascript is disabled from the client (because what would you use to do so?). You can use tricks to show content when Javascript is disabled (for instance, a `<noscript>` tag, or using Javascript to hide content that is meant fo...
2,707,476
How to recover a deleted row from SQL Server 2005 table?
2010/04/25
[ "https://Stackoverflow.com/questions/2707476", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239128/" ]
Rollback the transaction (if you started one). Restore a backup (if you have one). [edit] If you have transaction logs, you should be able to restore the backup of the database to the point roughly just before the row was deleted (assuming you know when that was).
The [ApexSQL Log](http://www.apexsql.com/sql_tools_log.aspx) tool can be the solution for deleted rows. In case the DELETE operation exists (the database was not using the Simple recovery model) in database transaction logs (online, backups), the tool can create an undo T-SQL script for the operation. *Disclaimer: I w...
206,734
I tried this: ``` tcpdump -s 1500 -A -l -i eth0 '(port 6667) and (length > 74)' ``` I need only the ascii part of it. How do I remove the rest?
2010/11/28
[ "https://serverfault.com/questions/206734", "https://serverfault.com", "https://serverfault.com/users/61783/" ]
I feel the most elegant solution is just to ditch tcpdump. No pipes of any kind: ``` tcpflow -c port 6667 ``` And that's it.
I had the same problem last week - I used the wireshark gui instead and did a "copy readable ascii" for the interesting packets. I was (successfully) trying to pin down a problem with a http request to a web-service and its XML-answer.
114,187
I've got an Pentax K-r DSLR camera ([tech specs here](https://www.ricoh-imaging.co.uk/en/digital-slr/pentax-kr.html)). This camera is about 9 years old. And I have the stock 18-55mm lens. I've also got an iPhone 11 Pro ([tech specs here](https://www.apple.com/uk/iphone-11-pro/)). Both have circa 12mp sensors. Which se...
2020/01/18
[ "https://photo.stackexchange.com/questions/114187", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/10167/" ]
Use both. Use whatever is fun right now. Depending on the situation, one or the other will be better. A DSLR tends to give results that are just the photo + very basic and deterministic postprocessing (you are free to postprocess it on a computer), while smartphones cameras try to be smart and sometimes phony with th...
In terms of image quality a larger sensor (of the same generation/technology) always wins because it gets more light (same composition/SS/Ap). It is also less demanding of lens resolution. The I-phone has a sensor that is just over 7mm long edge, the K-r has a sensor that's just under 24mm. That's ~ 9x the size in ar...
99,946
1. In situation when body exposed by light, is 'color' characteristics of a body or characteristics of light? Is there any difference on macro/micro levels? 2. Will exist such term as 'color' in [parallel universe](http://en.wikipedia.org/wiki/Parallel_universe) where electro-magnetic waves doesn't exists?
2014/02/20
[ "https://physics.stackexchange.com/questions/99946", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/40955/" ]
The "color" of a body is not a property of the body nor of the light it reflects or emits, but rather of the human eye and brain that receive and process the light. Of course, this is based on a property of the light, for this is how the eye receives the information that there is some object in there in the first place...
Color is nothing but interpretation of electromagnetic waves into various nerve signals by our brain. It is the property of the object to reflect various wavelengths when photons strike their electrons. Electrons then vibrates up and down atleast 1000 times each second emmiting electromagnetic waves which our eyes rec...
65,957,634
I've searched anywhere for this info, and only found a broken link to an old stockfish support page which doesn't work anymore. I can't seem to figure out how to change the depth parameter at which stockfish minimaxes via my python program. Any help would be truly appreciated.
2021/01/29
[ "https://Stackoverflow.com/questions/65957634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I hope this is right. If I understand your question you just want to count the yes's for each category. I've put it into a function so just change x = Sick to whatever your dataframe is called and run the function. **EDIT** I forget which package the pipe and columns\_to\_rownames comes from, I've added dplyr as a req...
First reshape, then use the [`datasummary` function from the `modelsummary` package](https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html) (self-promotion alert). The benefit of this solution is that you can customize the look of your table and save it to many formats (html, latex, word, markdown...
120,639
Is there another way of saying “less is more" in the following context? > > They changed their packaging and left only the essential branding on it. It epitomizes "*less is more".* > > >
2013/07/28
[ "https://english.stackexchange.com/questions/120639", "https://english.stackexchange.com", "https://english.stackexchange.com/users/48676/" ]
A similar, but less dramatic phrase is *keep it simple*, or the more emphatic *keep it simple, stupid*, often abbreviated to [*KISS*](http://en.wikipedia.org/wiki/KISS_principle). You also might consider *[lean and mean](http://dictionary.cambridge.org/us/dictionary/business-english/lean-and-mean)* > > using only wh...
Instead of "less is more", how about "efficiency"?
168,686
Well,this is a homework problem. I need to calculate the differential entropy of random variable $X\sim f(x)=\sqrt{a^2-x^2},\quad -a<x<a$ and $0$ otherwise. *Just how to calculate* $$ \int\_{-a}^a \sqrt{a^2-x^2}\ln(\sqrt{a^2-x^2})\,\mathrm{d}x $$ I can get the result with Mathematica,but failed to calculate it by ha...
2012/07/09
[ "https://math.stackexchange.com/questions/168686", "https://math.stackexchange.com", "https://math.stackexchange.com/users/5971/" ]
If you let $x = a\sin(\theta)$, your integral becomes $$a^2\int\_{-{\pi \over 2}}^{\pi \over 2} \ln(a\cos(\theta))\cos^2(\theta)\,d\theta$$ $$= 2a^2\int\_0^{\pi \over 2} \ln(a\cos(\theta))\cos^2(\theta)\,d\theta$$ $$= 2a^2\ln(a)\int\_0^{\pi \over 2}\cos^2(\theta)\,d\theta + 2a^2\int\_0^{\pi \over 2} \ln(\cos(\theta))\c...
[Some ideas] You can rewrite it as follows: $$\int\_{-a}^a \sqrt{a^2-x^2} f(x) dx$$ where $f(x)$ is the logarithm. Note that the integral, sans $f(x)$, is simply a semicircle of radius $a$. In other words, we can write, $$\int\_{-a}^a \int\_0^{\sqrt{a^2-x^2}} f(x) dy dx=\int\_{-a}^a \int\_0^{\sqrt{a^2-x^2}} \ln{\sqrt{...
3,601,620
As Title. It's really a two part question. Part one is to show if R is an integral domain and $\omega$ is a primitive n th root unity in R, then for any $a\in R$, Show $x^{n}-a^{n}= \prod\_{k=0}^{n-1}(x-a\omega^{k})$ Which I've already done. I don't see the connection between the two questions, could someone pleas...
2020/03/30
[ "https://math.stackexchange.com/questions/3601620", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
For $n=6$ and $\omega=\zeta\_6$ the complex roots of $X^6+2=0$ are $\xi\_k=\omega^k\sqrt[6]{-2}$ for $k=1,\ldots ,6$. Hence over $\Bbb C$, we have $$ X^6+2=(X-\xi\_1)(X-\xi\_2)\cdots (X-\xi\_6). $$
Over $\Bbb C$ it splits, by the fundamental theorem of algebra. Use a primitive sixth root of unity and $(-2)^{1/6}$, to get the six roots. Over $\Bbb R$, we get quadratic factors. The roots come in conjugate pairs, three times. We get $(x^2+\sqrt[3]2)(x^2-\sqrt[6]2\sqrt3x+\sqrt[3]2)(x^2+\sqrt[6]2\sqrt3x+\sqrt[3]2)$...
65,095
What are the common algorithms being used to measure the processor frequency?
2008/09/15
[ "https://Stackoverflow.com/questions/65095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Intel CPUs after Core Duo support two Model-Specific registers called IA32\_MPERF and IA32\_APERF. MPERF counts at the maximum frequency the CPU supports, while APERF counts at the actual current frequency. The actual frequency is given by: ![freq = max_frequency * APERF / MPERF](https://chart.apis.google.com/char...
I'm not sure why you need assembly for this. If you're on a machine that has the /proc filesystem, then running: ``` > cat /proc/cpuinfo ``` might give you what you need.
26,279,179
I made a Windows Form in VB.NET that has a Panel with a Datagridview on it, and underneath it a FlowLayoutPanel with Save and Close buttons on it, call it frmParent. Then I created frmChild and on it I inherited frmParent. I then hooked up my DataGridView to some data and it worked fine. Next I tried to add code to sa...
2014/10/09
[ "https://Stackoverflow.com/questions/26279179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2551936/" ]
To expose an action on a base class control as an event (another answer shows how to do this via an overridable method): Base Form: ``` Public Event SaveClick As EventHandler Protected Overridable Sub OnSaveClick(ByVal e As EventArgs) RaiseEvent SaveClick(Me, e) End Sub Private Sub Button1_Click(sender As Objec...
Your best bet, both from a functional standpoint and design standpoint, is to create events in your child form, i.e. `OnSaveRequested` and `OnCancelRequested`. In your parent form, declare your child form using `WithEvents` and create handlers for those events. When you want to save from the child form, raise the `OnSa...
8,255,205
How can I write below sql query in linq ``` select * from Product where ProductTypePartyID IN ( select Id from ProductTypeParty where PartyId = 34 ) ```
2011/11/24
[ "https://Stackoverflow.com/questions/8255205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/287100/" ]
Syntactic variations aside, you can write it in practically the same way. ``` from p in ctx.Product where (from ptp in ctx.ProductTypeParty where ptp.PartyId == 34 select ptp.Id).Contains(p.ProductTypePartyID) select p ``` I prefer using the existential quantifier, though: ``` from p in ctx.Product wh...
There is no direct equivalent in LINQ. Instead you can use contains () or any other trick to implement them. Here's an example that uses `Contains`: ``` String [] s = new String [5]; s [0] = "34"; s [1] = "12"; s [2] = "55"; s [3] = "4"; s [4] = "61"; var result = from d in context.TableName where s.C...
7,889,038
**How can i tell my controller/model what kind of culture it should expect for parsing a datetime?** I was using some of [this post](http://blogs.msdn.com/b/stuartleeks/archive/2011/01/25/asp-net-mvc-3-integrating-with-the-jquery-ui-date-picker-and-adding-a-jquery-validate-date-range-validator.aspx) to implement jquer...
2011/10/25
[ "https://Stackoverflow.com/questions/7889038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/665879/" ]
You can create a Binder extension to handle the date in the culture format. This is a sample I wrote to handle the same problem with Decimal type, hope you get the idea ``` public class DecimalModelBinder : IModelBinder { public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingCon...
Why not simply inspect the culture of the data and convert it as such? This simple approach allowed me to use strongly typed dates in models, show action links and edit fields in the desired locale and not have to fuss at all binding it back into a strongly typed DateTime: ``` public class DateTimeBinder : IModelBinde...
46,345,356
I am having trouble understanding how to create a schema for the following type of flatfiles due to the fact that the tag identifier is not on the second field. I removed some extra data from the below example, but my problem is pretty much that the tag identifier (HDR/ODR and END) is preceded by an incremental number...
2017/09/21
[ "https://Stackoverflow.com/questions/46345356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/465651/" ]
If there are only those 3 tags, and the HDR and END only occur once, just create a schema where you have a schema where you have three records, 1 for the HDR, 1 for the ORD which can occur multiple times, and one for the END. You also have to alter the Lookahead depth from the default 3 to 0 (infinite). For example th...
Use Tag Identifier and Tag Offset you achieve your objective: ``` <?xml version="1.0" encoding="utf-16"?> <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://BizTalkMassCopy.FlatFileSchema6" targetNamespace="http://BizTalkMassCopy.FlatFileSchema6" xmlns:xs="http://www.w3.org/2001/XMLSchema"> ...
38,099,195
Is the solution of this exercise the below regular expression? I found it in the internet but I don't believe that this is correct. ``` (1*011*(0+011*))* ``` According to the theory of Chapter 1 in the book "The handbook of computational linguistics and natural language processing", how could I solve this exercise? ...
2016/06/29
[ "https://Stackoverflow.com/questions/38099195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3410338/" ]
You can go with: ``` ^(?!.*00.*)(?=.*0.*0).*$ ``` You can play with it [here](https://regex101.com/r/mY2xD7/5). Explanation: * `(?!.*00.*)` the input can't have two consecutive `0` * `(?=0.*0)` the input have to contains at least two `0` --- If you don't want to use lookaround use Maria's answer
``` 1*01(1|01)*01* ``` I think this would work perfectly
21,611
If I try to draw a grid in Inkscape, there are two different options: 1. `Extensions` -> `Render` -> `Grid` 2. `Extensions` -> `Render` -> `Kartesian Grid` But both of them use pixel-metric(?). Is it possible to use other metrics (e.g. millimeter). As a workaround, I converted pixel->millimeter, but it didn't work....
2013/10/01
[ "https://graphicdesign.stackexchange.com/questions/21611", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/15720/" ]
Sadly, menu **Extensions -> Render -> Grids > Grid..**. does only take pixels as the measurement. So I am pretty sure conversion is the way to do it. I find the easiest, most accurate way to do conversion calculations for Inkscape is to do it in Inkscape. Use the rectangle tool to draw a rectangle on the canvas, then...
I don't know if the answer is to specific, but since their is no general solution to this problem, I cloned Inkscape and patched the grid functionality. I'll try to improve my patch, so it will be maybe in a release version one day (so please don't down-vote instantly). Until then, one has to clone [my repository](htt...
874,316
A couple of weeks ago, I wrote a simple Ruby script to test a couple of FTP commands in a Windows XP environment. Everything worked as expected, and I wasn't even aware of the time taken for the code to run (I'd guess 3-4 seconds at the very most.) A few days ago, a much more involved Ruby application I'm developing s...
2009/05/17
[ "https://Stackoverflow.com/questions/874316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74598/" ]
I had a similar issue and found Passive mode increased the speed, eg. `ftp.passive=true`.
Try removing the `#sort!` (just `puts "files = #{files}"`) since that can be fairly expensive if there's a bunch of files in the directory. This would account for the large lag around the `#nlst` and the `#ls`
31,339
I'm interested in computer music, where there are approaches to treat pieces of music as sentences in generative grammars or L-systems. Instead of composing, one could then specify a grammar and let the computer generate the music. E.g. the Yale group around the late Paul Hudak are very strong in that. It has struck m...
2015/05/01
[ "https://cstheory.stackexchange.com/questions/31339", "https://cstheory.stackexchange.com", "https://cstheory.stackexchange.com/users/32941/" ]
Yes, there are n-dimensional grammars and in some cases specifically applied to music, see for example [Grammar-based music composition by Jon McCormack](http://users.monash.edu/~jonmc/research/Papers/L-systemsMusic.pdf), which talks about parametric extensions to L-grammars, or more generally, [Regulated Array Grammar...
there is some theoretical/ scientific/ applied research into modelling music with CS formal grammars. see eg * [Formal Grammars for Computational Musical Analysis](http://homepages.inf.ed.ac.uk/steedman/papers/music/slides5.pdf) / Steedman * [Musical grammars and computer analysis: a Review](http://www.jstor.org/stabl...
42,624,680
Build Unity project, add other libraries, Xcode return error. How fix it? ![Screenshot](https://i.stack.imgur.com/gVbmA.png)
2017/03/06
[ "https://Stackoverflow.com/questions/42624680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7637668/" ]
Make sure you're opening the .xcworkspace and not the .xcproject file in Xcode. Close the project and open .xcworkspace
![screenshot error code](https://i.stack.imgur.com/zqa1P.png) I also had such a problem, but only Xcode 10.2.1 had a problem, and Xcode 11.1 had no such problems. I solved this problem Select Target, go to BuildSettings and Search for Enable Bitcode flag and set it to No. ![screenshot xcode](https://i.stack.imgur.co...
8,489,557
I have the following code ``` $(function() { $('.apply').click(function(e) { var z = $(this).attr('z-id'); var r = $(this).attr('r-id'); $.post( "/r-set-z", "z_id=" + z + "&r_id=" + r, function(data) { alert(data); } );...
2011/12/13
[ "https://Stackoverflow.com/questions/8489557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396862/" ]
> > > > > > For system block was set to 32. I tried SET RMS/BLOCK=32/BUF=8. That already gave an improvement. > > > > > > > > > [edit: If there is no process setting, then the system setting us used. So the test done added buffers, but did not make them bigger] 32 is just 16KB. Great for 1992, lame for 2012....
Use C. Bypass RMS. **fopen** the file. **fseek** to end. **ftell** to get file size **malloc** a chunk of memory that size **fread** it in one go. One might suspect if your file is a lot larger than your working set, that paging may be what is eating your wall clock.
125,343
I would like to understand the term "system call". I am familiar that system calls are used to get kernel services from a userspace application. The part i need clarification with is the difference between a "system call" and a "C implementation of the system call". Here is a quote that confuses me: > > On Unix-li...
2014/04/18
[ "https://unix.stackexchange.com/questions/125343", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/29436/" ]
A *system call* is a way to ask your operating system (kernel) to do some operation on behalf of your program, that the program can't do by itself (or is just inconvenient). The reason for not being able to do some operation is normally that allowing a random program to do them might compromise the integrity of the sys...
In Linux at least the system call mechanism works under most architectures by placing some specifically formatted data (usually some kind of c struct) in either some registers or predefined memory addresses. The issue comes however in actually forcing the CPU to do the switch into kernel space so it can run the privil...
41,807,364
I'm using promises inside express middleware. I want to use the async/await methods. ``` app.get('/data1',async function(req,res) { data = await getData1(); // This line throw an error, res.send(data) }) app.get('/data2',async function(req,res) { data = await getData2(); // This line throw an error r...
2017/01/23
[ "https://Stackoverflow.com/questions/41807364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1229624/" ]
Now I found a way how to do it, I'm still keep the question open for more suggestions ``` app.get("/data1", wrap_middleware(async (req, res) => { data1=await getData1() res.send(data1) }) } app.get("/data1", wrap_middleware(async (req, res) => { data2=await getData2() }) } fu...
I don't understand the use of sending the same error for different function but I think the handling error code could be write in more readable way (just catch the error and do with them what you want the same way you catch errors in any route middleware): ``` function getData1(){ return new Promise( (resolve,reje...
15,140,206
I'm working on a theme using Twitter Bootstrap, and I'm trying to get the drop down navigation to be centered instead of left-aligned. To be clear: I'm talking about centering the whole drop down box relative to its parent, not about centering the text inside the box. The markup looks like this: ``` <ul id="nav" clas...
2013/02/28
[ "https://Stackoverflow.com/questions/15140206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1199685/" ]
I solved this using jQuery, calculating and adjusting the margin-left of every sub menu. This way my navigation items have the same space between each other. ``` document.onreadystatechange = function() { if (document.readyState === 'complete') { $("ul.ww-nav ul.dropdown-menu").each(function(){ ...
Jsfiddle [Demo in browser](http://jsfiddle.net/shail/h56LW/show/) What you can do is set the width to the main nav element and than to the drop down : like following : ``` .navbar .nav > li { width: 116px; } .dropdown-menu { display:none; width:116px; min-width:116px; margin:0 aut...
9,913,151
Good day, I am trying to copy files back and forth to my Xyboard from my Ubuntu machine. From my understanding, Motorola only allows this to happen via the USB cable if Motocast is running on the computer which is currently only available for Windows and Mac. I had to create a file sharing service and then download an ...
2012/03/28
[ "https://Stackoverflow.com/questions/9913151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1226843/" ]
On my `Droid Razr`, I just use `ES File Explorer`. It lets me browse and copy any shared Samba network files, or folders, just like any other computer. The Droid Razr is a Linux machine, and it works just like any other Linux machine. You just need to set permissions on your shared folders to write or whatever. On my h...
I installed mtpfs from synaptic. I restarted my computer and my tablet but I don't think you have to. Worked perfect. EDIT: only works for camera mode. not MTP. :-(
129,456
I was looking at my bank website's certificate and discovered that it's issued to multiple websites, and the bank's domain name is only listed among many other domains in the 'alternative names' field. Is this considered a bad practice? What risks are their customers subjected to? (man in the middle? impersonation?) ...
2016/07/07
[ "https://security.stackexchange.com/questions/129456", "https://security.stackexchange.com", "https://security.stackexchange.com/users/116881/" ]
Notice `incapsula.com` in the subject. [Incapsula](https://www.incapsula.com/) is a company that offers web application security that includes WAF, DDOS protection and a few more services. My guess is that your banks website is actually proxied through their server and so are all those other sites. That server gives o...
I'm with the Imperva Incapsula Team. There seem to be a lot of confusion, so I'd like to point out a few facts: 1. The vast majority of all websites use a CDN. 2. We are PCI-certified and SOC2-certified company, all data processing, access and any other compliance-related issue is tightly regulated, audited and logge...
157,329
There is apparently a vulnerability (CVE-2014-6271) in bash: [Bash specially crafted environment variables code injection attack](https://securityblog.redhat.com/2014/09/24/bash-specially-crafted-environment-variables-code-injection-attack/) I am trying to figure out what is happening, but I'm not entirely sure I unde...
2014/09/24
[ "https://unix.stackexchange.com/questions/157329", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/16841/" ]
bash stores exported function definitions as environment variables. Exported functions look like this: ```none $ foo() { bar; } $ export -f foo $ env | grep -A1 foo foo=() { bar } ``` That is, the environment variable `foo` has the literal contents: ```none () { bar } ``` When a new instance of bash launches, i...
*I wrote this as a tutorial-style recasting of the excellent answer by Chris Down above.* --- In bash you can have shell variables like this ``` $ t="hi there" $ echo $t hi there $ ``` By default, these variables are not inherited by child processes. ``` $ bash $ echo $t $ exit ``` But if you mark them for exp...
141,413
Should the sole user of a \*nix (particularly Linux and MacOS) have two accounts, one with sudo privileges and one without? Years ago I read that on your personal computer you should do your daily tasks as an unprivileged user and switch to a privileged user for administration tasks. Is this true? Note: I am *not* ref...
2016/10/31
[ "https://security.stackexchange.com/questions/141413", "https://security.stackexchange.com", "https://security.stackexchange.com/users/129232/" ]
Every machine needs a admin account, whatever the OS. Ok, most Linux flavours *hide* root user by giving it an inexistant password - in the sense that any input will return false - but root does exist and has user id 0. That admin account can change anything to the system, including things that are not allowed to norm...
Aren't backups the solution to this problem? Backing up the entire hard drive on a regular basis looks like a good idea in general for various reasons, the possibility of screwing up .bashrc is one of them.
543
While most of the gyms and dojos where I've trained so far had mirrors to help you work on your technique I think videos are underused. In my opinion, taking a video of e.g. a sparring session or while training technique is much better than looking at a mirror, because you can fully concentrate on what you are doing an...
2012/02/19
[ "https://martialarts.stackexchange.com/questions/543", "https://martialarts.stackexchange.com", "https://martialarts.stackexchange.com/users/129/" ]
A tool is only as dangerous as its user. Analyzing yourself is only as good as you are able to be objective, and **only as good as you will be at analyzing yourself**. Sending a video to a teacher because of geographical reasons is a good idea, if the teacher agrees to it. The teacher can make corrections.
There is a huge problem with videotaping yourself and playing it back for your own purposes, in my experience. When I was first starting out, I would often times (along with another *buyu*) film classes and go back and review the footage, especially what I was doing, and correct my technique based on that while I pract...
20,041,931
I need to modify Dijkstra's algorithm so that if there are several shortest paths I need to find the one with minimum number of edges on the path. I've been stuck on how to use Dijkstra's method to find multiple shortest paths, how do you do that? doesn't it always output only 1 shortest path? pseudo code or any gener...
2013/11/18
[ "https://Stackoverflow.com/questions/20041931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2321926/" ]
Instead of assigning every node with the distance from source you can assign the number of edges traversed so far also. So each node will have `(distance,edges)` instead of `distance` only. Everything else works as usual and for every terminal node you record the one with minimum value of `(distance,edges)`.
Another option would be to add some small number `ε` to the weight of every edge, where `ε << edgeWeights` *(for integer edge-weights you can choose `ε < gcd(edgeWeights)/numberOfEdges`)* The advantage of this approach is that you don't need to write your own pathfinder, you can just use any off-the-shelf implementati...
54,659,491
At my job, I am occasionally tasked with entering data from an HTML page into an excel file manually. This usually details something like a course offering list where I have to get the title, degree type, link to the page, and other information. Is there a way I can programmatically handle this? I have beginner to inte...
2019/02/12
[ "https://Stackoverflow.com/questions/54659491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11053179/" ]
You just need to add parenthesis around the returned object literal. ```js const my_arr = [1,2,3,4,5]; const data = my_arr.map((element, index) => ({ a: element, b:index })); // ^ ^ console.log(data); ``` The reason is that the JavaScript parser r...
So, it works See output: ```js var results = []; [...Array(11).keys()].forEach((el) => { if (el % 2 === 0) { results.push({ a: el, b: el + 1 }) } }) console.log('results',results) ```
38,555,588
according to Aamir in [When to use an interface instead of an abstract class and vice versa?](https://stackoverflow.com/questions/479142/when-to-use-an-interface-instead-of-an-abstract-class-and-vice-versa) > > When you derive an Abstract class, the relationship between the > derived class and the base class is 'is ...
2016/07/24
[ "https://Stackoverflow.com/questions/38555588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872912/" ]
If you have some common abilities, like move, you can have an interface of those and have the abstract class implement those methods (if animals are the only thing you'll work with, then you wouldn't really gain much by having that interface I believe). If you are having specific abilities that would apply only on cert...
The ability to do something would probably be best suited to an interface, unless you are looking to provide some default behaviour if the method is not implemented. Keep in mind that C# does not support inheriting from multiple classes, but does support implementing multiple interfaces. This allows for some flexibili...
419,331
There seems to be two (main) ways of pronouncing "Los Angeles": 1. Los An-jel-eeze 2. Los An-jel-ess It's clearly Spanish, and my limited Spanish skills suggest option 2, but I've heard many people use option 1 (including commercial aircraft pilots over the intercom). Which is "correct"? --- ### Update: In the cl...
2017/11/22
[ "https://english.stackexchange.com/questions/419331", "https://english.stackexchange.com", "https://english.stackexchange.com/users/12060/" ]
According to *Oxford Dictionaries Online,* the [British pronunciation](https://en.oxforddictionaries.com/definition/los_angeles) rhymes with *cheese* (as the comments say, it's closer to the last syllable of Hercules), while the [American pronunciation](https://en.oxforddictionaries.com/definition/us/los_angeles) does ...
It depends on what you *want* it to rhyme with. From ["Coming Into Los Angeles"](https://www.youtube.com/watch?v=q9xL_OVvPn0) by Arlo Guthrie: "Coming into Los Angeles, Bringing in a couple of keys, Don't touch my bags if you please, Mr. Customs man." It really doesn't work very well if you rhyme with "mess".
4,974,238
Python has this beautiful function to turn this: ``` bar1 = 'foobar' bar2 = 'jumped' bar3 = 'dog' foo = 'The lazy ' + bar3 + ' ' + bar2 ' over the ' + bar1 # The lazy dog jumped over the foobar ``` Into this: ``` bar1 = 'foobar' bar2 = 'jumped' bar3 = 'dog' foo = 'The lazy {} {} over the {}'.format(bar3, bar2, ba...
2011/02/11
[ "https://Stackoverflow.com/questions/4974238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/464744/" ]
Taken from YAHOOs library: ``` YAHOO.Tools.printf = function() { var num = arguments.length; var oStr = arguments[0]; for (var i = 1; i < num; i++) { var pattern = "\\{" + (i-1) + "\\}"; var re = new RegExp(pattern, "g"); oStr = oStr.replace(re, arguments[i]); } return oStr; } ``` C...
JavaScript does not have a string formatting function by default, although you can create your own or use one someone else has made (such as [sprintf](http://www.diveintojavascript.com/projects/javascript-sprintf))
43,313,071
``` INSERT INTO EMP_1 (EMP_NUM, EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_HIREDATE, JOB_CODE) VALUES ('101', 'News', 'John', 'G', '08-Nov-00', '502'), ('102', 'Senior', 'David', 'H', '12-Jul-89', '501'); ``` I've been searching for quite some time and most people say to but the comma between the two sets but when I do t...
2017/04/09
[ "https://Stackoverflow.com/questions/43313071", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3681583/" ]
MS Access does not permit multiple rows being inserted with a single `insert . . . values`. I think the "typical" MS Access solution is: ``` INSERT INTO EMP_1 (EMP_NUM, EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_HIREDATE, JOB_CODE) VALUES ('101', 'News', 'John', 'G', '08-Nov-00', '502'); INSERT INTO EMP_1 (EMP_NUM, EM...
The link you have given already state that you CANNOT do ``` insert into foo (c1, c2, c3) values ("v1a", "v2a", "v3a"), ("v1b", "v2b", "v3b"), ("v1c", "v2c", "v3c") ``` Which is exactly the way you are doing it now. Try ``` INSERT INTO EMP_1 (EMP_NUM, EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_HIREDATE,...
1,866,100
I have just sucessfully tested my Zend based application on the localhost.When I deployed it on a shared hosting site I got the error below.It happens whenever I try navigate to protected pages of my application. ``` Warning: include(/home/davidkag/public_html/prototype/application/models/DbTable//Users.php) [function...
2009/12/08
[ "https://Stackoverflow.com/questions/1866100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197208/" ]
This doesn't answer the question, just wanted to share something. From [PHP Manual: String Operators](http://php.net/manual/en/language.operators.string.php), someone posted this which I find rather interesting. Notice how the space plays a part in the output. **Excerpt:** If you attempt to add numbers with a conc...
While this isn't the historical reason it maybe show you why it is good to have a separate operator for addition and concatenation in the case of PHP. The reason is what we see in JavaScript. We use the `+` character for concatenation and addition too. In PHP we have a separate operator for the two which is important ...
14,507,370
I got a WebView that load an HTML file with a text. The problem is that the color inside the html and outside isn't the same. Here is a screenshot: ![The Activity With the WebView](https://i.stack.imgur.com/fVOcdl.png) The HTML FIle is: ``` <html dir="rtl"> <head> <title>About</title> <meta content="text/htm...
2013/01/24
[ "https://Stackoverflow.com/questions/14507370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1621927/" ]
**To change your background (if this is in fact what you are looking to do):** in styles.xml ``` <style name = "MyDefaultStyle" parent = "@android:style/Theme"> <item name = "android:windowBackground">@drawable/default_drawable_bg</item> </style> ``` and in your manifest ``` <application android:name="MyAp...
Default color is black. If you use style, go to "values/styles.xml" and there is solution of you issue. Now you can check bg color. About themes and styles : <http://developer.android.com/guide/topics/ui/themes.html> **EDIT :** Layout background color changing - [Setting background colour of Android layout element]...
53,432,596
I'm new Asp.Net.I have input type="text" also I have css class for input[type="text"]. So I have an asp:textbox. How can I write css class for my asp:textbox which is a different css class then the one for input? My asp:textbox takes properties from .login-box input[type=text], input[type=password] ``` <div class=...
2018/11/22
[ "https://Stackoverflow.com/questions/53432596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10552187/" ]
You want to use a label, literal or panel all can be used with asp: prefix to show some message in ASP.Net Web Form. You don't add messages in input fields like in your example ``` <asp:Label ID="txtError" CssClass="text-hide" runat="server" Text="Incorrect username or password!"></asp:Label> ``` After this you c...
Username ``` <input id="username" type="text" name="username" placeholder="Enter Username" runat="server"/> <p>Password</p> <input type="password" name="password" placeholder="Enter Password"/> <asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click"/> <asp:TextBox ID="txtErro...
14,475,797
I know this is a very basic problem, but I cannot move forward without it and its not clearly explained elsewhere. Why is this programming giving me so many errors of undeclared identifier? I have declared it, though. These are the error i am getting. ```none Error 2 error C2143: syntax error : missing ';' befo...
2013/01/23
[ "https://Stackoverflow.com/questions/14475797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1482108/" ]
C is a case sensitive language. `ptr=(contactInfo)malloc(2*sizeof(contactInfo));` which should be: `ptr=malloc(2*sizeof(ContactInfo));`
``` struct contactInfo nom,*ptr; ptr=(contactInfo*)malloc(2*sizeof(contactInfo)); ``` here you are using contactInfo to typcast where as it should be struct contactInfo. and as you have typedef it into ContactInfo you can use that also. ``` struct contactInfo nom,*ptr; ptr=(ContactInfo*)malloc(2*sizeof(Conta...
1,714
I edit novels (among other works). I was having a discussion with someone (not an editor) who didn't understand my technique. What I do is read through the document, and the moment something occurs to me — whatever reaction I'm having for good or ill, whatever I catch, any questions I have, mistakes I spot, delightfu...
2011/02/22
[ "https://writers.stackexchange.com/questions/1714", "https://writers.stackexchange.com", "https://writers.stackexchange.com/users/553/" ]
I will pile onto the "both methods will work" bandwagon, with a qualification. **Your first impressions are important enough that they should be preserved if possible, even if any concerns are addressed later.** For example, you provide a comment that you struck once the question was answered: > > "Is there a reaso...
My process is to only mark things that interfere with the reading process on the first pass. This is that I try to read for pleasure, and anything that reminds me that the world actually exists out side of the story gets marked now. The second pass is for plot, the third pass is for story telling, the forth is for gram...
179,984
I have some cronjob that sometimes gets stuck in running status. That makes me think that for some reason they produce an error but I cannot find any related log. ( the column messages in `cron_schedule` is empty ) How can I be sure cron execution produces logs in case of errors? How can I proceed to debug this is...
2017/06/21
[ "https://magento.stackexchange.com/questions/179984", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/70/" ]
you can try as following : ``` /rest/V1/orders?searchCriteria[filterGroups][0][filters][0][field]=status&searchCriteria[filterGroups][0][filters][0][value]=complete&searchCriteria[filterGroups][0][filters][0][conditionType]=eq ``` There is ?searchCriteria before SearchCriteria filters. For more information you can ...
I was looking around and I believe the issue is `[conditionType]=eq`, which seems to only compare ints and not Strings. Instead, try `[conditionType]=like`, which worked for me. The request would look like: ``` rest/V1/orders?searchCriteria?searchCriteria[filterGroups][0][filters][0][field]=status& ...
17,751,168
I have amended your fiddle a little [link](http://jsfiddle.net/dipens/5rwcB/2/). What I am trying to do is NOT to load both images in at the start - just the first one. Then when the user clicks on the house loaded in - I want to, at this point, load in the second house. I am trying to mimick this behaviour using ...
2013/07/19
[ "https://Stackoverflow.com/questions/17751168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1486303/" ]
**Loading a new image from your server & using it to replace an existing image object's image** The key is to wait until the new image (house3) has been fully loaded before trying to do the swap. ``` function swap(){ // get the image object from the selected group var ImageObjects = group.get("Im...
You just had to rearrange your `newImage.onload` function: ``` var newImage = new Image(); newImage.onload = function() { // keep the Kinetic.Image object // but replace its image ImageObject.setImage(newImage); layer.draw(); }; newImage.src = newHouse; ``` [JSFiddle](http://jsfiddle.net/projeqht/cMLB4/...
2,458,839
would it be possible to bind a Java application to a Cocoa graphical interface? I'm working in Eclipse right now, on my mac, and am wondering if Interface Builder could be used to construct a new interface so that I don't have to look at Swing all day. Any ideas/suggestions? Thanks!
2010/03/16
[ "https://Stackoverflow.com/questions/2458839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38776/" ]
Check out [Rococoa](http://code.google.com/p/rococoa/). It's a great Java-Cocoa compatibility layer that's built on top of [JNA](https://github.com/twall/jna/). If you don't find what you are looking for in the documentation, try the mailing list. The Rococoa developers are very helpful. P.S. I'm not a Cocoa/Objectiv...
Some good (ANCIENT) historical info here (written 2002): <http://cocoadevcentral.com/articles/000024.php> The original Java/Cocoa bridge (since Mac OS X 10.0) became marked deprecated in 10.4, and is considered unusable. The Rococoa answer above is basically your best bet. Just thought I'd chime in with the historica...
35,178,153
I'm trying to open a **MD Date Picker** from my Controller when click on a single element but it's not working, I'm using the last version of [Angular Material](https://material.angularjs.org) > `1.0.4` I've tried to $inject the **$mdDatePicker** but it says that couldn't find the module. ``` MyController.$inject = [...
2016/02/03
[ "https://Stackoverflow.com/questions/35178153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/580325/" ]
I managed to hack this added functionality in with an extending directive: ``` .directive('mdDatepickerAutoopen', function ($timeout) { return { restrict: 'A', require: 'mdDatepicker', link: function (scope, element, attributes, DatePickerCtrl) { element.find('input').on('click', function (e) { ...
Here's another hacky way to do it if you only need the dialog itself and not the date field. Add the datepicker to a directive template, but hide it: ``` <md-datepicker id="datepicker" ng-model="selectedDate" ng-change="dateChanged()" style="position: absolute; visibility:...
100,953
Ok, according to the ERD workbadge has a lookup to workbadgedefinition: <https://developer.salesforce.com/docs/atlas.en-us.198.0.object_reference.meta/object_reference/sforce_api_erd_badge.htm#topic-title> So why can't I get this simple query to work: ``` Select Id, Description, WorkBadgeDefinition.Name from WorkBadg...
2015/11/30
[ "https://salesforce.stackexchange.com/questions/100953", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/26333/" ]
I wish there was concept like merge field in Lightning components where some functions were global and directly accessible but looks like only way to do this will be code with server side call. Below is sample code ``` public with sharing class SimpleServerSideController { //Use @AuraEnabled to enable client- and s...
We can fetch from email field if it is 'FirstName.LastName@company.com on user profile without server call. Lightning Component : ``` <aura:component implements="flexipage:availableForRecordHome> <aura:attribute name="UserName" type="String" default=""/> </aura:component> ``` javaScript controller : ``` ({ doInit ...
6,916,250
When using snipmate + vim, is it possible to have many snippet files load for a given language/filetype? Ex: snipmate comes with `javascript.snippets` I've also loaded the mootools snippets and added this to my vimrc: `autocmd FileType javascript set ft=javascript.mootools` Now I can use * the stock js snippets * ...
2011/08/02
[ "https://Stackoverflow.com/questions/6916250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123781/" ]
Create a snippets folder inside your .vim directory and place your snippets there. Create a file called javascript.snippets in there and you should have both the snipmate snippets and your custom ones available.
Since you are using pathogen than all you need do is add a custom Snippets folder to the bundles directory. For example: `~/.vim/bundles/mySnippets/snippets/php.snippets`
3,991,806
My coworker is trying to register some COM components (which I wrote) via RegAsm.exe and it says he needs Administrator privileges. His account has admin privileges but he is not logged in as Administrator. Is there a way to use his regular user account and succeed at this task?
2010/10/21
[ "https://Stackoverflow.com/questions/3991806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73804/" ]
Admin privileges are required to allow Regasm.exe to update the registry. If this is a UAC restriction then create a shortcut on the desktop for cmd.exe and check the "Run this program as an administrator" checkbox. Or change this setting on the Visual Studio Command Prompt shortcut, that's easier.
I think this question belongs elsewhere, but Windows uses least privilege so if he is a user that is both a normal user and an Administrator than he gets normal user privileges. Use runas to make this work or right click the item and "run as administrator"
13,934,711
I'm trying to use autohotkey to simulate elements of Mac keyboard on a PC (Windows) keyboard. My muscle memory reaches for the Command key for simple tasks like copying and pasting, so I'd like to remap the left alt+letter key combinations to appropriate ctrl+letter. ``` <!c::Send ^c ``` Most of the time it works fi...
2012/12/18
[ "https://Stackoverflow.com/questions/13934711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34704/" ]
This prevents the left-hand side Alt key from activating the menu bar for most applications (under Windows 7 and AutoHotkey 1.1.11.01): ``` ~LAlt Up:: return ``` It doesn't work with Internet Explorer but I don't use IE often anyway. :) BTW, I also killed the annoying start menu popup via: ``` ~LWin Up:: return ~R...
you could also swap the two buttons. Something like: ``` LAlt::LCtrl LCtrl::LAlt ``` In the limited testing I did, it works, but you might need to relearn some of your window key shortcuts. It basically just swaps the two buttons.
51,558,483
I can't use two cursors in a page on the different elements can anyone help me why is happening? ```css .c-scrolldown{ cursor:pointer; } .c-scrolldown2{ cursor:pointer; } ``` ```html <div class="c-scrolldown2" id="pointer-cursor"> <div class="c-line2"></div> </div> <div cl...
2018/07/27
[ "https://Stackoverflow.com/questions/51558483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8430293/" ]
Just add some content inside divs and change cursor that you need. ```css .c-scrolldown{ cursor: pointer; } .c-scrolldown2{ cursor: progress; } ``` ```html <div class="c-scrolldown2" id="pointer-cursor"> Test 1 <div class="c-line2"></div> </div> <div class="c-scrolldown"> Test 2 <di...
Sure you can. You just need either some content or a defined height for your DIVs (in your code the DIVs have zero height): ```css .c-scrolldown, .c-scrolldown2 { height: 200px; background: #ddd; } .c-scrolldown { cursor: pointer; } .c-scrolldown2 { cursor: crosshair; } ``` ```html <div class="c-...
52,046,815
Suppose I have an expression of the form ![First Form](https://latex.codecogs.com/gif.latex?a%5Ccdot%20x%20+%20b%5Ccdot%20x%20-%20c%5Ccdot%20x%20-%20a%5Ccdot%20y-b%5Ccdot%20y+c%5Ccdot%20y%20+%20d). I know that I can simplify the expression like so: ![Second Form](https://latex.codecogs.com/gif.latex?%28x-y%29%28a+b-c%2...
2018/08/27
[ "https://Stackoverflow.com/questions/52046815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9235907/" ]
[This similar question](https://stackoverflow.com/questions/40620585/expression-simplification-in-sympy/40643065) has an answer involving the `func` parameter to `collect()`. It seems to work in this particular case as well, although you have to explicitly mention `d`: ``` from sympy import * a, b, c, d, x, y = symbol...
It's hard to suggest a strategy of "partial factoring" that works most of the time. Here is a thing to try, devised with your example in mind (a polynomial of several variables). Given an expression: Attempt to factor it. If unsuccessful, look at the coefficient of each symbol that it contains; the method `Expr.coeff...
19,904,636
I have horizontal news which look like this: [DEMO](http://jsfiddle.net/9nn29/) If you run this fiddle in Firefox, it displays different then in other browsers. On my webpage it position random position (always same). I have to use `position: absolute;` because I want to keep the date and buttons at the same level in...
2013/11/11
[ "https://Stackoverflow.com/questions/19904636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2978769/" ]
Looks like: <http://bugzil.la/203225> It was logged over 10 years ago. As a workaround you could use a div within the TD and set that to position:relative instead of setting it on the TD directly.
try this one, ``` .col { width: 235px; margin: 0px; border: 0px; padding: 0px; vertical-align: top; background-color: white; display: table-cell; position: relative; float:left; } ``` <http://jsfiddle.net/9nn29/3/>
4,507,149
My Rails views and controllers are littered with `redirect_to`, `link_to`, and `form_for` method calls. Sometimes `link_to` and `redirect_to` are explicit in the paths they're linking (e.g. `link_to 'New Person', new_person_path`), but many times the paths are implicit (e.g. `link_to 'Show', person`). I add some sing...
2010/12/22
[ "https://Stackoverflow.com/questions/4507149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/336563/" ]
Use *type* in the routes: ``` resources :employee, controller: 'person', type: 'Employee' ``` <http://samurails.com/tutorial/single-table-inheritance-with-rails-4-part-2/>
You can create method that returns dummy Parent object for routing purpouse ```html class Person < ActiveRecord::Base def routing_object Person.new(id: id) end end ``` and then simply call form\_for @employee.routing\_object which without type will return Person class object
4,124,810
In the book [Coders at Work](http://apress.com/book/view/1430219483) (p355), Guy Steele says of C++: > > I think the decision to be > backwards-compatible with C is a fatal > flaw. It’s just a set of difficulties > that can’t be overcome. **C > fundamentally has a corrupt type > system**. It’s good enough to hel...
2010/11/08
[ "https://Stackoverflow.com/questions/4124810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/201665/" ]
You'd have to ask him what he meant to get a definitive answer, or perhaps provide more context for that quote. However, it is pretty clear that if this is a fatal flaw for C++, the disease is chronic, not acute - C++ is thriving, and continually evolving as evidenced by ongoing Boost and C++0x efforts. I don't even...
Here, "corrupt" means that it is not "strict", leading to never-ending delight in C++ (because of the many custom types (objects) and overloaded operators, casting becomes a superior nuisance in C++). The attack against C comes in regard to its MISPLACED USAGE as a strict OOP basis. C has never been designed to limit...
133,848
Publish...Publish, I am worried about publications as I don't have any yet, I just have few in masters, but was not a good quality, now in Ph.D., I am working on a new topic and to get a significant and validated results it takes times, I focused on developing a model that could really explain the phenomena which are n...
2019/07/26
[ "https://academia.stackexchange.com/questions/133848", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/-1/" ]
Until your supervisor starts worrying, I wouldn't start worrying. Pure paper count isn't the best measure because some topics yield more papers and others much less. For example 2018 Nobel Laureate in Physiology & Medicine, [James Allison](https://scholar.google.com/citations?user=Vq6NVkAAAAAJ&hl=en), has a h-index of ...
A question you might ask yourself: Do you really need to have publications for your goals? (If it is not a requirement for your phd or supervisor or if you don't want to stay in academia, maybe you don't need any.) If no, you can just work on your big project (if your supervisor is fine with it) and relax a little bit!...
47,613,271
My code is a dictionary with values that are 2d lists. I need to write a function that will total up all of the same index numbers in each list within the dictionary. Here is what I have so far: ``` def totalQty(theInventory): totalQuantity = 0 for key in theInventory: for book in key: totalQuantity += b...
2017/12/02
[ "https://Stackoverflow.com/questions/47613271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8724001/" ]
In a dict `for key in theInventory` doesn't give you each element but the key for each element, so you have to access the element via `theInventory[key]` you could also use `for key, value in theInentory.items()`. Then you can iterate over `value`. Try: ``` for key, value in theInventory.items(): for book in val...
``` def totalQty(theInventory): totalQuantity = 0 for key in theInventory: totalQuantity += theInventory[key][3] ``` The key variable is a string of the key name not a list
18,889
I remember learning this in high school, but have forgotten it, and can't seem to find it anywhere online. Air travels from areas of high pressure to low pressure...correct? So if I have a cold room in my house, does the air move from the warm rooms to the cold room or the other way around?
2011/12/30
[ "https://physics.stackexchange.com/questions/18889", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/6902/" ]
Air does indeed flow from high pressure to low pressure area (see the wind arrows on a weather chart), but in the case of two rooms the much more important effect is that of warm thinner air rising towards the ceiling when the air from the two rooms gets mixed. Thus, cold air from the cold room will be leaving the roo...
In hot room the air will be much thinner thus reducing the pressure so the air flows from cold room to hot rooms.
257,684
I have two new-ish 1TB hard drives in my server, both running at 38 degrees C at the moment. Should I be worried?
2011/04/09
[ "https://serverfault.com/questions/257684", "https://serverfault.com", "https://serverfault.com/users/77798/" ]
What does the manufacturer's datasheet/documentation have to say about temperature ?
Be careful of the interpretation of your sensors. I have Munin running, and the smartd results shows my drives have "Temperature\_Celcius" of around 230.0 (which if true would probably indicate they were on fire) but another probe called "HDD Temperature" records them around 27 and 29 C, which seems much more likely to...
3,132
![enter image description here](https://i.stack.imgur.com/52NA4.jpg) *Welcome to installment #2 of my "the science of animals falling" series of questions....* I've heard it said many times since childhood that if you are to find a baby bird on the ground which appears to have fallen from the nest you should not pick...
2011/05/12
[ "https://skeptics.stackexchange.com/questions/3132", "https://skeptics.stackexchange.com", "https://skeptics.stackexchange.com/users/486/" ]
From [Fortean Times](http://web.archive.org/web/20140712025704/http://www.forteantimes.com/strangedays/mythbusters/710/abandoned_birds.html): > > **Birds have little or no sense of > smell**, and will be unaware of your > molestation. Besides, they will not > lightly abandon their offspring. > > > From [National ...
Touching the baby bird [will not cause the mother to abandon it](https://skeptics.stackexchange.com/a/3134/21644), but it may be illegal under [the Migratory Bird Treaty Act of 1918](http://www.fws.gov/laws/lawsdigest/migtrea.html), which states: > > Establishment of a Federal prohibition, unless permitted by regulat...
64,549,275
I have async socket server file and client file. When i send something like that "download filename.ex" to the client, this client's code hande my request: ```py try: content = read(sp_data[-1]).decode('utf-8') print(content) msg = json.dumps({'file': sp_data[-1], 'command': data, 'content': content, ...
2020/10/27
[ "https://Stackoverflow.com/questions/64549275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12214758/" ]
You use them to overwrite something you wrote previously. You wouldn't normally use them in the same string, but in different output calls, e.g. ``` printf("hello"); fflush(stdout); // need to flush because we didn't write a newline // do some stuff here printf("\rgoodbye\n"); // This replaces hello ```
\n" for new line "\b" for a backspace, means if u print it, cursor will print and come back 1 character. For example.... cout<<"hello\bHi"; will print "HellHi". because after printing Hello, compiler found a \b escape sequence. so it came 1 character back (at 'o' of Hello) and stat printing Hi from o of Hello..... so u...
31,378
When I restart httpd, I get the following error. What am I missing? ``` [root@localhost ~]# service httpd restart Stopping httpd: [ OK ] Starting httpd: Syntax error on line 22 of /etc/httpd/conf.d/sites.conf: Invalid command 'SSLEngine', perhaps misspelled or defined by a ...
2012/02/10
[ "https://unix.stackexchange.com/questions/31378", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/15401/" ]
On CentOS 7 installing the package "mod\_ssl" and restarting the apache server worked for me: ``` yum install mod_ssl systemctl restart httpd ```
On Ubntu 18.04 bionic. ``` sudo a2enmod ssl sudo service apache2 restart ```
127,602
This might have some duplicated inquiry that [this question](https://physics.stackexchange.com/questions/1586/what-if-physical-constants-were-increased-or-decreased) [or this question](https://physics.stackexchange.com/questions/78684/why-is-it-meaningless-to-speak-about-changes-in-a-dimensional-constant) had, and whil...
2014/07/22
[ "https://physics.stackexchange.com/questions/127602", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/37102/" ]
You are correct in that the core of your question is indeed nontrivial, but you need to be a bit more subtle than that. The fundamental constants don't "take" values - they are what they are, and that's that. It is valid to ask "how did this 3×108 number come about", but the answer lies less with the speed of light tha...
I can always choose units where $c = 1$. This is almost always done in context of General Relativity, Special Relativity and Quantum Field Theory. As ACuriousMind said in the comments above, how we measure quantities tells us nothing useful about the physics of it, since units can be rescaled. As of why the speed of ...
39,001,305
I have a problem with my code that I can't find the solution as well. I ask for questions that has to be valid but the loops just continues, and let me input. ``` print('Do you want to go to the store or woods?') lists = ('woods', 'store') while True: answers = input() if answers == 'store': brea...
2016/08/17
[ "https://Stackoverflow.com/questions/39001305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6715279/" ]
You want to check if the user's answer is not in your list of valid answers. What you're doing is the other way around. Try this: ``` if answers not in lists: print('That is not a valid answer') ``` You'll also want to either `break` at that point, or print your prompt message again.
Try this: ``` print('Do you want to go to the store or woods?') places = ('woods', 'store') while True: answer = input() if answer in places: print ("Going to the {0}...".format(answer)) break else: print('That is not a valid answer') ```
16,300,495
I have a console application that is using a log4net setup for logging information to the console output only at the moment. I have various `log.Debug("Debug info")` statements which I only want to print out to the console if a debug flag within my application is set. The debug variable is set by reading a switch pas...
2013/04/30
[ "https://Stackoverflow.com/questions/16300495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317603/" ]
Yes there is, e.g.: ``` <root> <level value="DEBUG" /> <appender-ref ref="LogFileAppender" /> <appender-ref ref="AdoNetAppender" /> <appender-ref ref="EventLogAppender" /> </root> ```
You can try to create your own appender like this : ``` public class MyAppender : AppenderSkeleton { private static bool TurnDebugOn = false; public static SetDebugLogging(bool toSet){ TurnDebugOn = toSet; } protected override void Append(LoggingEvent loggingEvent) { bool logEv...
4,337,666
I'm searching the best way to do what I'm trying to do, so I ask here... I have a webpage in PHP who's requesting a song by TCP to another server. The song is loaded into a temporary file on the server. While it's loading, I want to play it into the webpage OR into the user's favorite player. Is it possible to simply r...
2010/12/02
[ "https://Stackoverflow.com/questions/4337666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/527315/" ]
It depends what you mean by "it". The iterator knows what index it's reached, yes - in the case of a `List<T>` or an array. But there's no general index within `IEnumerator<T>`. Whether it's iterating over an indexed collection or not is up to the implementation. Plenty of collections don't support direct indexing. (I...
The sequence being iterated in a foreach loop might not support indexing or know such a concept it just needs to implement a method called GetEnumerator that returns an object that as a minimum has the interface of IEnumerator though implmenting it is not required. If you know that what you iterate does support indexin...
172,627
Could you give me a hint on this problem? > > Show that $f:A\subset\mathbb{R}^n\longrightarrow \mathbb{R}^m$ is continuous if and only if for every subset $B$ of $A$ , $f(A\cap\overline{B}) \subset \overline{f(B)}$. > > > Currently I know these definitions of continuity: $(\rm i)$ In terms of pre-image of open s...
2012/07/18
[ "https://math.stackexchange.com/questions/172627", "https://math.stackexchange.com", "https://math.stackexchange.com/users/85162/" ]
HINTS: ($\Rightarrow$) Let $x\in A\cap\operatorname{cl}B$. There is a sequence $\langle x\_n:n\in\Bbb N\rangle$ in $B$ that converges to $x$. What do you know about $\langle f(x\_n):n\in\Bbb N\rangle$? ($\Leftarrow$) Prove the contrapositive: suppose that $f$ is not continuous, and show that there is some $B\subseteq...
To do (⇐) I think it's a bit slicker (and doesn't use the metric structure) to take B to be the preimage of an arbitary closed set in the range. What does the condition tell you?
44,801,649
I just read an ARM instruction book, and I saw one instruction that I couldn't interpret. It says `LDR` loads a 32-bit constant into the `r0` register: ``` LDR r0, [pc, #const_number-8-{pc}] .......... const_number DCD 0xff00ffff ``` I couldn't understand what `[pc, #const_number-8-{pc}]` means. Specifically: 1. W...
2017/06/28
[ "https://Stackoverflow.com/questions/44801649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8225902/" ]
Just change the root selector. **UPDATE** Select every `div` and use the [filter method](http://api.jquery.com/filter/). Clone the `div` you're filtering, select all the children (nested divs), remove them then "come back" to the parent `cloned div` and retrieve the text. Having the text, compare the contents with ...
Since you didn't want to use ids I can suggest you to try this. ``` $('div > div:contains(heinrich)').css("background-color", "limegreen") ``` Working Fiddle: <https://jsfiddle.net/g50cfqzw/>
23,113
If I were to say, > > Can't I just be wearing my swim suit already? > > > Would "be wearing" be improper English?
2011/04/28
[ "https://english.stackexchange.com/questions/23113", "https://english.stackexchange.com", "https://english.stackexchange.com/users/7942/" ]
Your sentence makes perfect sense in this context: > > Parent: You need to wear something warm, and find someplace to change into your swimsuit. > > > Child: If I wear other clothes over it, **can't I just be wearing my swim suit already?** That way I won't have to find a changing room. > > >
Maybe your example sentence would work if you were indicating that you want your character in, say, a novel to "be wearing" a swimsuit in a certain scene: > > You: Can't I just be wearing my swim suit already? My character is just about to go to the beach. > > > Author of the novel: No, your character has to look a...
20,459,668
i have made a program but the output that i'm getting is ``` (<q3v3.Student instance at 0x023BB620>, 'is doing the following modules:', ' <q3v3.Module instance at 0x023BB670> <q3v3.Module instance at 0x023BB698>') ``` For example , the above output should give me Alice is doing following module : biology, chemistry...
2013/12/08
[ "https://Stackoverflow.com/questions/20459668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3072782/" ]
You could define a `__str__` method in your `Student` class, and do something like this: ``` def __str__(self): return self.name # Here the string you want to print ```
Are you using Python 2? If so, `print` is a keyword, not a function. There are two ways to solve your problem: 1. Write `print foo, bar` instead of `print(foo, bar)`. The difference is that `print(foo, bar)` is actually printing out the *tuple* `(foo, bar)`, which uses the `repr()` representation of each element, rat...
31,733,253
I am new to C, now I am making a linked list for face detection. Below is the struct and the method for appending face at the end of linked list. ``` //Structure for storing a face with x, y and window size typedef struct Face { int window; int x; int y; struct Face* next; } Face; //Append face(window...
2015/07/30
[ "https://Stackoverflow.com/questions/31733253", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5054713/" ]
``` if (head == NULL) { printf("Called\n"); head = temp; } ``` The assignment `head = temp` only modifies the *local* copy of the head pointer. So it is not propagated to the code that called `push()`. If `head` was `NULL` in the code that calls `push()`, then it will remain so. You could for example ret...
I believe it is because you are passing in the value of the pointer `head`, which creates a copy of the pointer. By setting `head` to another address, you're not modifying `head` outside of scope, but rather the `head` within the method scope. You'd need to pass in a pointer to the pointer to change it.
749,160
I am having a problem with a regex find and replace in Word 2010 (Windows 7). I want to convert reference citation numbers in parentheses to the same numbers in brackets. For example, (20-23) should become [20-23], (19, 20) should become [19, 20]. I have the following Find what: `\(([0-9], -]*)\)` and Replace with: [...
2014/05/03
[ "https://superuser.com/questions/749160", "https://superuser.com", "https://superuser.com/users/169801/" ]
When you run as `sudo` add `-s` to preserve your environment. It's not maintaining your environment, thus your `HOME` directory is lost. [Emacs looks in](http://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html) `~/.emacs, ~/.emacs.el, or ~/.emacs.d/init.el`, so if you lose HOME, you lose the pathing to ...
You can easily run emacs with the init file of your choice. For example, the following command ``` sudo emacs --load ~/.emacsroot -nw filename.ex ``` Loads emacs * as super user -> `sudo` * with `.emacsroot` init file located in the home directory -> `--load ~/.emacsroot` * in console mode -> `-nw` * opening `filen...
12,377,283
My mind is swimming with all of the options out there for responsive navigation but I'm having a hard time finding what I want that works in IE! I'm hoping somebody out there has used the 'perfect' system for me! What I'm looking for is a navigation that is: 1) built on a simple ul li structure in CSS 2) in smaller...
2012/09/11
[ "https://Stackoverflow.com/questions/12377283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1663141/" ]
The best way to make @media-queries work in IE is [respond.js](https://github.com/scottjehl/Respond). I've tested it in IE8+ and it works great, only that you can't see it locally, you have to upload it. About the navigation, you can adapt the way everything looks using [media queries](http://www.w3.org/TR/css3-media...
I found a great tutorial with the cleanest code I've seen for this responsive menu! <http://webdesign.tutsplus.com/tutorials/site-elements/big-menus-small-screens-responsive-multi-level-navigation/> Hopefully this will help somebody else and save some searching :)
48,355,556
I have a splash screen where I want one textview i.e the name of the app to appear in the center of the screen for 2 seconds and then animate to top of the screen and stay on top until the activity ends.
2018/01/20
[ "https://Stackoverflow.com/questions/48355556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5097842/" ]
This just happened to me as of 23 July, 2019. It looks like Apple is now enforcing TLS 1.2 for the sandbox voip push notification server at ``` gateway.sandbox.push.apple.com - port 2195 feedback.sandbox.push.apple.com - port 2196 ``` I found that I had to check out the latest code from <https://github.com/Redth/Pu...
i think the issue related to the Push Sharp so please try this solution by changeing the SSl3 to Tls in the class called **ApplePushChannel.cs** and here is the change ``` The orginal code in the file is stream.AuthenticateAsClient(this.appleSettings.Host, this.certificates, System.Security.Authentication.SslPro...
67,125,307
I'm learning Golang and as an exercise in using interfaces I'm building a toy program. I'm having some problem trying to use a type that "should implement" two interfaces - one way to solve that in C++ and Java would be to use inheritance(there are other techniques, but I think that is the most common). As I lack that ...
2021/04/16
[ "https://Stackoverflow.com/questions/67125307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59775/" ]
I should go over some prefacing points first: * Interfaces in Go are not the same as interfaces in other languages. You shouldn't assume that every idea from other languages should transfer over automatically. A lot of them don't. * Go has neither classes nor objects. * Go is not Java and Go is not C++. It's type syst...
The go language does not have [subtype polymorsphism](https://en.wikipedia.org/wiki/Subtyping). Therefore, the pattern you want to achieve is not *encouraged* by the very foundations of the language. You may achieve this undesirable pattern by composing structs and interfaces, though.
61,660,933
Context ======= I have a database with a collection of documents using this schema (shortened schema because some data is irrelevant to my problem): ``` { title: string; order: number; ... ... ... modificationsHistory: HistoryEntry[]; items: ListRow[]; finalItems: ListRow[]; ... ...
2020/05/07
[ "https://Stackoverflow.com/questions/61660933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4102561/" ]
Try this: It works fine ``` class MyHomePage extends StatelessWidget { List<UsersData> user = [ UsersData( name: 'Zack Alex', msg: 'Im on my way.', status: '3 hours ago', dp: 'assets/Zack.jpg', seenMsgs: false, unreadMsgs: 12, ), UsersData( name: 'Ali sho', ...
You can make use of operator overloading here. Probably it's not the best way but one of the possible way. ```dart class Item { Item({this.id, this.msg}); String id; int msg; Item operator +(Item other) { return Item(id: "", msg: (this.msg + other.msg)); } } void main() { List<Item> data = [ new ...
11,639,424
I have a `Questions` table which looks like that ![enter image description here](https://i.stack.imgur.com/RGmxl.png) as you see, there are 2 id rows that are nearly same: `id`, `question_id`. `id` - is autoincremented, unique id of each question, and `question_id` - is, for example, course 1 lesson 1 has 5 questions...
2012/07/24
[ "https://Stackoverflow.com/questions/11639424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/978733/" ]
First of all, this is not an optimal database design. Your schema is denormalized, which is not really good. To answer your first question. I would split Lesson, Course, Question and Author into **separate tables**. Then I would add a number field beside the Primary Key for *Course*, *Lesson* and *Question*. The PK w...
1. You should try to get rid of `question_id` and only leave the autoincrement `id` as a primary key. Otherwise inserting will get messy. > > The problem is, now when I want to insert new question with given course\_id, lesson\_id the id field wil auto-increment. > > > I don't understand the problem - auto\_incre...
43,694,560
So I have this class "Member" : ``` package pkgData; import java.io.Serializable; public class Member implements Comparable<Member>, Serializable{ /** * */ private static final long serialVersionUID = 1L; private String name; private String city; public Member(String nameOfMember,String location) { ...
2017/04/29
[ "https://Stackoverflow.com/questions/43694560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7055250/" ]
``` String nameOfMember = (String) memberModel .getSelectedItem();if(nameOfMember==null)throw new Exception("please select a name and a location");else { String[] parts = nameOfMember.split(","); String part1 = parts[0]; // name String part2 = parts[1]; // location Member member=new Member(part1, part2); } ``...
**String split & cast method** What you can do is first of all test if the string you get is null, or if it matches well you format. Then, you can create a new object with these elements. Here's a small example code : ``` String memberData = (String)memberModel.getSelectedItem(); if(memberData == null || memberData...
4,005,663
This is a conic equation: ${4x^{2}−4xy+7y^{2}+12x+6y−9=0}$ I tried a way like this: 1.)${B^{2}-4AC <0} --> ((-4)^2-4x4x7 = 16-112 = -96 < 0)$ "So this is an ellipse" 2.)${Tan2θ = \frac{B}{A-C} = \frac{4}{3} ->θ = 27}$ "degree" 3.) (I saw them using these formulas on a site) There are formulas for ${A^{'}, B^{'},...
2021/01/30
[ "https://math.stackexchange.com/questions/4005663", "https://math.stackexchange.com", "https://math.stackexchange.com/users/880546/" ]
Given a set $X$ and some property elements of $X$ might satisfy, say *is green*. We can filter out the subset of all elements of $X$, which are green by writing $$\{x \in X \mid x \text{ is green}\}.$$ The appearance of $x$ does **not** mean that there can only be one element of $X$, which is green. Rather, if we want ...
In a sense, $S(X)$ "comes prior" to (abstract) groups: are precisely the four properties fulfilled by $S(X)$ endowed with map composition as operation (closure, associativity, identity, inverses), that the definition of (abstract) group just mimics and axiomatizes for any set endowed with a binary operation.
56,681,970
I'm trying to implement React Navigation with AuthLoading, AuthStack, and AppStack. The AppStack will contain a bottomTabNavigator with 2 tabs: Home + Profile. The Profile screen will have an edit button that should route to the EditProfile screen. Here's what it looks like when I navigate from Profile to Edit Profil...
2019/06/20
[ "https://Stackoverflow.com/questions/56681970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9378367/" ]
``` android:layout_margin="15dp" ``` There's your problem, you are adding margin, where you don't want it in your cell's main `LinearLayout`. Remove that line and you should be good. --- Side Note: Since you are using `RecyclerView` instead of using `android:background="@drawable/list_cell_border_main"` to add bo...
The problem is on `android:layout_margin="15dp"` in the `LinearLayout` ;)
12,652,889
I have a table with a couple of thousand rows: from this I need to extract a total for column `WTE` for each value in column `band`, including those where the total is 0. I also need each total to be in a column of its own, so that I can easily update a summary table. The code I have at present returns the values from...
2012/09/29
[ "https://Stackoverflow.com/questions/12652889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/721931/" ]
In this particular case, wouldn't it be easier to use `WHERE`? ``` SELECT SUM(WTE) AS `Band6_WTE` FROM `orthoptists` AS o LEFT JOIN `instances` AS i ON o.instance_FK = i.id WHERE i.region = 14 AND band = "E" ``` For the general case, you could use `GROUP BY` since you say you need the result for each band (each val...
Noody has explained why your original query give you the incorrect result. The original query has an aggregation function in the `SELECT` clause. This tells MySQL that this is an aggregation. There is no `GROUP BY` clause, so it returns one row, treating all rows as a single group. Now, what happens to `band` in this...
59,906,286
I'm trying to understand why my snippet of code ends up with the class "list" as opposed to a Tuple. The way I'd like it to work is to open a CSV, check for the user/password header and use those to append to a tuple so that I can retrieve accounts by doing accounts[1], accounts[2] It's important that the list of acc...
2020/01/25
[ "https://Stackoverflow.com/questions/59906286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5004379/" ]
``` accounts = [] for row in reader: accounts.append((row['user'],row['password'])) ``` You're starting with an empty list `[]` and appending items to it, so you end up with a list. If you want a tuple you could convert the list to one at the end: ``` accounts = [] for row in reader: accounts.append((row['us...
As you already know a tuple is immutable. So you are correct in making `accounts` a list. If you want to store it as a tuple afterwards you can convert it like this: ```py accounts = tuple(accounts) ```
57,715,569
Suppose I've got: “Aliud est grâtiam habêre, aliud grâtiam referre. Nôn omnês quî tibi prô beneficiîs grâtiäs agunt, ipsî posteâ, sî opus fuerit, grâtiam tibi referent. Facile est grâtiäs agere prô beneficiîs, nec vërô quidquam difficilius esse vidētur quam beneficiôrum meminisse.” But I want “Aliud est grātiam habē...
2019/08/29
[ "https://Stackoverflow.com/questions/57715569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/254837/" ]
In many cases it saves a lot of time writing Emacs lisp functions instead of storing kbd-macros etc. Emacs comes with excellent debugging tools. For example call `M-x edebug-eval-top-level-form RET` at your example with solution below: ``` (defun accent-replace () "Does what I want" (interactive "*") (dolist (e...
Inspired by the comments, I came up with this interactive command: ``` (defun tr (from to beg end) "Replace each character in FROM with the character at the same position in TO. Operates from BEG to END, or within the marked region if called interactively. If TO is shorter than FROM, any characters in FROM beyond t...
1,209,383
I've been scouring the web and my textbook to no avail. I understand how to transform a matrix with respect to the standard basis, but not to a basis comprised of matrices. I need to find the matrix of T with respect to a basis. My transformation matrix is: $$ A = \begin{bmatrix} 1 & 2 \\ 0 & 3 \\ \end{bmatrix} $$ ...
2015/03/27
[ "https://math.stackexchange.com/questions/1209383", "https://math.stackexchange.com", "https://math.stackexchange.com/users/226942/" ]
I think your difficulty is purely "conceptual". A vector space is ANY set that obeys the axioms of a vector space (such a definition assumes an associated "field of scalars"). In particular, over a given field $F$, the set: $\text{Hom}\_F(U,V)$ = all linear transformations $U \to V$ is a vector space. So "matrices" a...
From the nature of your question, I'm not sure you've transcribed it correctly for us. I suspect that the answer is this: $$ \begin{bmatrix} {1} & {2} \\ {0} & {3} \\ \end{bmatrix} = 1 \cdot \begin{bmatrix} {1} & {0} \\ {0} & {0} \\ \end{bmatrix} + (-1) \cdot \begin{bmatrix} {0} & {1} \\ {0} & {0} \\ \end{bmatrix...
188,556
Where can I find the syslog config file under SLES 12? `rsyslog` and `syslog-service` are installed according to YaST2 and `rcsyslog status` outputs: ``` ServerName:~ # rcsyslog status Usage: /sbin/rcsyslog {start|stop|status|try-restart|restart|force-reload|reload} rsyslog.service - System Logging Service Loaded...
2015/03/06
[ "https://unix.stackexchange.com/questions/188556", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/94195/" ]
I don't know of a single-command way to do this. The GUI programs are doing a fair bit of interrogation of the disk to take the "right" approach and you'll need to do some of that work yourself. You don't need sudo, though, and I think the resulting sequence of events is relatively painless. The Short Answer ---------...
On Debian you can use the definitions in `/etc/crypttab` and `/etc/fstab`: ``` cryptdisks_start <name> mount <mountpoint> umount <mountpoint> cryptdisks_stop <name> ```
3,173,939
How to split these strings in jquery? * Mode1 * 2Level I want to get only the numbers from the above two strings in jquery... The strings may be `Mode11,Mode111,22Level,222Level` etc the characters `Mode` and `Level` wont change...
2010/07/04
[ "https://Stackoverflow.com/questions/3173939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
var myString="Mode111"; var num =myString.replace(/[a-zA-Z]/g,"");
You could do something like this: ``` var numbers = "Mode111".match(/\d/g).join("") var alpha = "Mode111".match(/[a-z]/gi).join("") ``` I think there is an easier way with match collections but I can't find anything to show whether javascript supports them. I will see if I can find it.
438,014
I have media box in my network that hard coded to use specific DNS servers like Google DNS. But I want force this device to use my own DNS servers instead of hard coded DNS. Only way I think this is possible to mangle the DNS request coming from that media box IP to DNAT to my DNS server IP. but I'm not quite sure how ...
2018/04/16
[ "https://unix.stackexchange.com/questions/438014", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/408254/" ]
I use ``` iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT ``` The redirect just redirects the requests to the router.
Just add `-d a.b.c.d` immediately after `tcp`, to restrict the rule to packets with destination address `a.b.c.d`. And add `-s e.f.g.h` to also restrict by source address.
159,182
If I know the frequency of individual notes being played (let's assume D, F# and A), how do I determine the final frequency if they are played (nearly) simultaneously as a chord. To put the problem in context, I am writing a program where user inputs are classified and chords are played as output. My programming know...
2015/01/13
[ "https://physics.stackexchange.com/questions/159182", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/70683/" ]
A chords does not have a single frequency as it consists of three notes of different frequencies being played at the same time. It may sounds like a single note to you since the three frequencies that make up the chords have to be in harmony. If you wish to play a certain tune or song using only single frequencies I w...
You know that a single note in an instrument contains multiple frequencies and harmonics. The wave shape is never an ideal sine wave carrying one frequency. So combining two notes can be done with a [convolution integral](http://en.wikipedia.org/wiki/Convolution_theorem). You convert each note to the frequency domain ...
6,982,797
``` for ( var i=0; i<MyArrayObj.length; i++ ) { } ``` I am getting an error called, Cannot call MyArrayObj, since its is NULL
2011/08/08
[ "https://Stackoverflow.com/questions/6982797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/733644/" ]
Assuming there isn't a logical error with `MyArrayObj` being null: ``` if(MyArrayObj) { for ( var i=0; i<MyArrayObj.length; i++ ) { } } ```
Did you declare the MyArrayObj and assigned a correct value to it? Could you provide the code where you assign the array to a value? Otherwise check if the array is not null first.
533,863
I migrated an SVN server today and ran into an issue. I have a repo that has an svn:externals property on a trunk subfolder. This folder has been branched a bunch of times and now this svn:externals reference needs updated on every single branch to refer to the new server. Is there an easy way to update all of these p...
2009/02/10
[ "https://Stackoverflow.com/questions/533863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29/" ]
Potentially, make them members of another type. Nested types work well here, too. That makes a lot of sense if they form a logical group, and let you write several methods using the same type. Beyond that, we'd have to know details of what you're doing to comment further I suspect.
Do *not* turn them into member/global variables. They make reasoning about application state an order of magnitude more difficult, even without multithreading - and with it, as you say, it becomes a total nightmare. You might try collapsing them into simple objects and passing those around instead, if you notice that ...
2,119,680
On the client side using jQuery, I want to know if I can just check if a link URL is valid (i.e. doesn't return a 404). This link points to another domain, so if I just use $.get() then I end up with a permission issue. I remember reading something about using a JSONP request, but I don't remember.
2010/01/22
[ "https://Stackoverflow.com/questions/2119680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17635/" ]
JSONP works if the server you are calling on can return JSONP formatted response. Which basically means a script that calls a callback function on your page after getting loaded. see <http://en.wikipedia.org/wiki/JSON#JSONP> In your case it won't work unless the other site is willing to cooperate or you have a proxy ...
You can't make a request like that to another domain. That is a security feature in the browser. You may have to try doing something in an iframe or something and checking that.
12,142,851
i wanna use the back button on the mobile itself to make a dialog box appear to ask me whether am sure i wanna exit or not? ``` public void onBackPressed() { // TODO Auto-generated method stub AlertDialog.Builder dialog=new AlertDialog.Builder(MainActivity.this); dialog.setTitle("Confirm"); dialog.se...
2012/08/27
[ "https://Stackoverflow.com/questions/12142851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1602896/" ]
As i considered your `onBackPressed()` is the override method to handle android back key. Just add `dialog.create().show()` to your `onBackPressed();`. It will display **AlertDialog**.. Also removed `onBackPressed();` from `afterTextChanged(Editable s)` else it will calling every time when user try to enter some cha...
\**First Way :*\*try as by @Override `onKeyDown` method in your Current Activity: ``` public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == event.KEYCODE_BACK) { showAlert("", "Do you really want to exit?"); } return super.onKeyDown(keyCode, e...
22,261,693
All, Does anyone know of a preconfigured Linux-based virtual machine I can use as a Ruby on Rails development environment? My laptop runs Windows 8.1, which is not an ideal platform for Rails development and is not used by professional Rails developers. What I'm specifically looking for is an off-the-shelf Ubuntu VM ...
2014/03/07
[ "https://Stackoverflow.com/questions/22261693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3394524/" ]
You do need a vm. Period. Developing Rails on any type of windows based environment is foolish. You can certainly do your coding there (while running it on a nix box), but Rails is built to be run on a server, virtually no one runs a windows based server for Rails for precisely the reasons you are running into. By far...
Don't get a VM, you don't need it Windows 8.1 works fine with Rails - just use something like [RailsInstaller](http://railsinstaller.org/en) to install Ruby & Rails, and then you'll be able to install as many gems as you want
15,379
My friend and I want to do a hands on tutorial on Bayes theorem for the Seattle [LessWrong](http://lesswrong.com/) group. Neither of us have done this before, so we're searching for prior art; techniques that other people have tried before and descriptions of how they turned out. What are good techniques and resource...
2011/09/09
[ "https://stats.stackexchange.com/questions/15379", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/1146/" ]
The LessWrong website actually has a great visual explanation of Bayes' Theorem: [Bayes' Theorem Illustrated (My Way)](http://lesswrong.com/lw/2b0/bayes_theorem_illustrated_my_way).
Use a deck of cards. What are the chances this card is a spade? What are the chances this card is a spade if I know the card is black? What are the chances this card is a king? What are the chances this card is a king if I know it is a diamond? What are the chances it is a king if I know it is a face card? Show th...
50,195,049
I am new to android and I was able to setup the firebase for my app in kotlin. If i run the app in the **Nexus 5X API 27** emulator I am able to get the database but when i run the app in the actual device **SAMSUNG S5** (Google play Services V 12.5.29, android V 5.0) i don't get the ***addValueEventListener*** call ba...
2018/05/05
[ "https://Stackoverflow.com/questions/50195049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/740972/" ]
Make sure in your Manifest file for the app (the Main manifest file) that you have: `<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.INTERNET"/>`
It may happen if you are using release build on the device. Make sure you have added your release sha1 in your firebase app console. [![enter image description here](https://i.stack.imgur.com/OmNwk.png)](https://i.stack.imgur.com/OmNwk.png) Click on Add Fingerprint to enter your release sha1. In your emulator maybe ...
26,516,965
I am new to c# and have gotten stuck on an assignment. The idea is to create an Arraylist with multiple arguments from another class. I am supposed to sort only one of the arguments in a list. If there is only one argument there is no problem´, but I have 5. What do I do? ``` ArrayList people = new ArrayList(); people...
2014/10/22
[ "https://Stackoverflow.com/questions/26516965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4171590/" ]
Instead of an Arraylist consider a generic list List. Then use LINQ to sort your list. ``` List<Student> people = new List<Student>(); people.Add(new Student("Maria", "Svensson", "1989-06-14", "C#Programming", 7)); people.Add(new Student("Bahar", "Nasri", "1992-08-04", "C#Programming", 5)); people.Add(new Student("Ken...
Thanks for all the advice. I ended up doing a generic list List and everything worked smoothly in the end. For the assignment I was supposed to do one with ArrayList, but in the end the generic one seemed way better. I am hoping that it will be ok!