qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
10,786,951
I'm working with omnidirectional point lights. I already implemented shadow mapping using a cubemap texture as color attachement of 6 framebuffers, and encoding the light-to-fragment distance in each pixel of it. Now I would like, if this is possible, to change my implementation this way: * 1) attach a depth cubemap ...
2012/05/28
[ "https://Stackoverflow.com/questions/10786951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/637430/" ]
So, the solution was to convert the light-to-fragment vector to a depth value, instead of converting the depth read from the cubemap into a distance. Here is the modified shader code: ``` float VectorToDepthValue(vec3 Vec) { vec3 AbsVec = abs(Vec); float LocalZcomp = max(AbsVec.x, max(AbsVec.y, AbsVec.z)); ...
I would like to add more details regarding the derivation. Let **V** be the light-to-fragment direction vector. As Benlitz already said, the **Z** value in the respective cube side frustum/"eye space" can be calculated by taking the max of the absolute values of **V**'s components. ``` Z = max(abs(V.x),abs(V.y),abs(...
9,576
I have edited [this closed question](https://worldbuilding.stackexchange.com/questions/220638/our-missing-sense-what-is-it-and-how-does-it-work) to provide some details that a few commentators mentioned were missing and submitted it for reopening. The reopen was rejected and the feedback is insufficient for me to work ...
2021/12/24
[ "https://worldbuilding.meta.stackexchange.com/questions/9576", "https://worldbuilding.meta.stackexchange.com", "https://worldbuilding.meta.stackexchange.com/users/23756/" ]
Let's clear up some doubts here : Why didn't I vote to reopen the question ---------------------------------------- It's simple : Because I wasn't aware of the edit until you posted here and that I got through end-of-year-family-time downtime :). Otherwise the vote to reopen would have happened sooner. The edit you ...
From what I see, the question has been closed with the following motivation > > This question is opinion-based. It is not currently accepting answers. > > > Update the question so it can be answered with facts and citations. > > > The edit that you have done doesn't seem to do anything to solve that problem.
40,830,714
I have to create code that merges two arrays together with all elements in order, lowest to highest. If an out of order element is found, I'm supposed print the message “ERROR: Array not in correct order”. I have all the code working, except I don't know where or how I can add this error message. An example error out...
2016/11/27
[ "https://Stackoverflow.com/questions/40830714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7216637/" ]
Since a matrix multiplication is just a table of dot products, we can just perform the specific dot products we need, in a vectorized fashion. ``` import numpy as np import scipy as sp iX, iY = sp.nonzero(W) values = np.sum(A[iX]*B[:, iY].T, axis=-1) #batched dot product C = sp.sparse.coo_matrix(values, np.asarray([i...
First, get the indexes of the non zero places in W, and then you can just get the `(i,j)` element of the result matrix by multiplying the i-th row in A with the j-th column in B, and save the result as a tuple `(i,j,res)` instead of saving it as a matrix (this is the right way to save sparse matrices).
40,830,714
I have to create code that merges two arrays together with all elements in order, lowest to highest. If an out of order element is found, I'm supposed print the message “ERROR: Array not in correct order”. I have all the code working, except I don't know where or how I can add this error message. An example error out...
2016/11/27
[ "https://Stackoverflow.com/questions/40830714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7216637/" ]
Since a matrix multiplication is just a table of dot products, we can just perform the specific dot products we need, in a vectorized fashion. ``` import numpy as np import scipy as sp iX, iY = sp.nonzero(W) values = np.sum(A[iX]*B[:, iY].T, axis=-1) #batched dot product C = sp.sparse.coo_matrix(values, np.asarray([i...
Here's one approach using [`np.einsum`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.einsum.html) for a vectorized solution - ``` from scipy import sparse from scipy.sparse import coo_matrix # Get row, col for the output array r,c,_= sparse.find(W) # Get the sum-reduction using valid rows and correspon...
2,502,678
Find the limit of $$\begin{equation\*} \lim\_{x \rightarrow 0} \frac{(x-1)^5 + (1 + 5x)}{x^2 + x^5} \end{equation\*}$$ Shall I use the binomial theorem? Any hint will be appreciated!
2017/11/03
[ "https://math.stackexchange.com/questions/2502678", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Ok, now that OP's conditions are better known, let's try again. Numerator is $$(x-1)^5+(1+5x)\equiv x^5-5x^4+10x^3-10x^2+5x-1+(1+5x)$$$$\equiv x^5-5x^4+10x^3-10x^2+10x$$ so the given expression is $$\frac{x^5-5x^4+10x^3-10x^2+10x}{x^5+x^2}\equiv\frac{x^4-5x^3+10x^2-10x+10}{x^4+x}.$$ Now, numerator does not approac...
Divide top and bottom by $x^2$ to get $$\lim\_{x \to 0} \frac{\frac{1}{x^2}(1+5x) + \frac{1}{x^2}(x-1)^5}{1+x^3}$$ This is a quotient where the denominator has limit $1$, so the limit exists iff the following limit exists, and it has the same value as this limit: $$\lim\_{x \to 0} \left[\frac{1}{x^2}(1+5x) + \frac{1}{...
2,502,678
Find the limit of $$\begin{equation\*} \lim\_{x \rightarrow 0} \frac{(x-1)^5 + (1 + 5x)}{x^2 + x^5} \end{equation\*}$$ Shall I use the binomial theorem? Any hint will be appreciated!
2017/11/03
[ "https://math.stackexchange.com/questions/2502678", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Ok, now that OP's conditions are better known, let's try again. Numerator is $$(x-1)^5+(1+5x)\equiv x^5-5x^4+10x^3-10x^2+5x-1+(1+5x)$$$$\equiv x^5-5x^4+10x^3-10x^2+10x$$ so the given expression is $$\frac{x^5-5x^4+10x^3-10x^2+10x}{x^5+x^2}\equiv\frac{x^4-5x^3+10x^2-10x+10}{x^4+x}.$$ Now, numerator does not approac...
Considering $$\frac{(x-1)^5 + (1 + 5x)}{x^2 + x^5}$$ the $1$ will cancel out (because of power $5$ in numerator) and you are left with terms in $x$ for the lowest degree in numerator. So $$\frac{(x-1)^5 + (1 + 5x)}{x^2 + x^5}\sim \frac{kx+\cdots}{x^2}\sim \frac k x$$
29,986,328
How do I implement temporary threads in java, such that they invoke a function in a separate thread(communicate/send packet to another thread) and then terminate while the other threads keep running?
2015/05/01
[ "https://Stackoverflow.com/questions/29986328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4804039/" ]
Try This one ``` Thread t = new Thread(){ public void run(){ //Thread Implmentation code here } } t.start(); ```
The api for creating a thread is using the class Thread. you can override the `run` method or you can pass a Object that implements the `Runnable` interface and pass to a thread when creating it. `Thread.start` schedules the thread for execution. Threads in the same JVM can communicate via shared objects; i.e. **you p...
11,939,509
I have a string with the text precisely spaced the way I want it displayed. It's sort of an ascii art project. I want to convert this text to a pdf so I can print a poster with the text at my local printshop. The font needs to be fixed width and there are no tabs or anything like that. The lines end in the '\n' charac...
2012/08/13
[ "https://Stackoverflow.com/questions/11939509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415766/" ]
Try the module [pyPdf](http://pybrary.net/pyPdf/), might do the trick for you! Or [pyfPdf](http://code.google.com/p/pyfpdf/), that allows you to set the font when you create new PDF-files ([setFont example](http://code.google.com/p/pyfpdf/wiki/SetFont)) From [pyfPdf Tutorial Page](https://code.google.com/p/pyfpdf/wik...
Try [report lab](http://www.reportlab.com/software/opensource/rl-toolkit/) It has some cool features like 1. Supports embedded Type-1 or TTF fonts 2. Supports Asian, Hebrew and Arabic characters 3. Supports bitmap images in any popular format 4. Supports vector graphics
11,939,509
I have a string with the text precisely spaced the way I want it displayed. It's sort of an ascii art project. I want to convert this text to a pdf so I can print a poster with the text at my local printshop. The font needs to be fixed width and there are no tabs or anything like that. The lines end in the '\n' charac...
2012/08/13
[ "https://Stackoverflow.com/questions/11939509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415766/" ]
Try the module [pyPdf](http://pybrary.net/pyPdf/), might do the trick for you! Or [pyfPdf](http://code.google.com/p/pyfpdf/), that allows you to set the font when you create new PDF-files ([setFont example](http://code.google.com/p/pyfpdf/wiki/SetFont)) From [pyfPdf Tutorial Page](https://code.google.com/p/pyfpdf/wik...
There are several more methods which could create a printable file from your ASCII art. First, ImageMagick: ------------------- To demonstrate the method... * ...first, create a text file named `my.mvg` and put the following content in: ``` text 8,8 " _ ____ ____ ___ ___ _ _ / \ / __...
11,939,509
I have a string with the text precisely spaced the way I want it displayed. It's sort of an ascii art project. I want to convert this text to a pdf so I can print a poster with the text at my local printshop. The font needs to be fixed width and there are no tabs or anything like that. The lines end in the '\n' charac...
2012/08/13
[ "https://Stackoverflow.com/questions/11939509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415766/" ]
There are several more methods which could create a printable file from your ASCII art. First, ImageMagick: ------------------- To demonstrate the method... * ...first, create a text file named `my.mvg` and put the following content in: ``` text 8,8 " _ ____ ____ ___ ___ _ _ / \ / __...
Try [report lab](http://www.reportlab.com/software/opensource/rl-toolkit/) It has some cool features like 1. Supports embedded Type-1 or TTF fonts 2. Supports Asian, Hebrew and Arabic characters 3. Supports bitmap images in any popular format 4. Supports vector graphics
53,479,402
I'm currently using this code to autocolour font based on its origin: ``` Sub Auto_Colour_Numbers() Dim rng As Range, rErr As Range On Error Resume Next For Each rng In Intersect(ActiveSheet.UsedRange, Selection) If rng.HasFormula Then Set rErr = Range(Mid(rng.Formula, 2, Len(rng.Formula) - ...
2018/11/26
[ "https://Stackoverflow.com/questions/53479402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10584845/" ]
CF is probably the way to go, but if you want a VBA solution try using the sheet change event so the code is run whenever you change a cell. Put the code in the sheet module (right-click the sheet tab, View Code, and paste the code). ``` Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range For Each r...
Here's a no-VBA solution using conditional formatting. 1. To format the cells with a formula that points to another worksheet, create a format condition with the rule `=IFERROR(FIND("!",FORMULATEXT(A1)),FALSE)` (substituting the start of your actual data range for A1). 2. To format the hardcoded values, create another...
53,479,402
I'm currently using this code to autocolour font based on its origin: ``` Sub Auto_Colour_Numbers() Dim rng As Range, rErr As Range On Error Resume Next For Each rng In Intersect(ActiveSheet.UsedRange, Selection) If rng.HasFormula Then Set rErr = Range(Mid(rng.Formula, 2, Len(rng.Formula) - ...
2018/11/26
[ "https://Stackoverflow.com/questions/53479402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10584845/" ]
Here's a no-VBA solution using conditional formatting. 1. To format the cells with a formula that points to another worksheet, create a format condition with the rule `=IFERROR(FIND("!",FORMULATEXT(A1)),FALSE)` (substituting the start of your actual data range for A1). 2. To format the hardcoded values, create another...
If you're using a version earlier than 2013 here's a solution that doesn't use `FormulaText`: ``` Public Function RefDifSheet(Target As Range) As Boolean If Target.HasFormula Then RefDifSheet = InStr(Target.Formula, "!") <> 0 Else RefDifSheet = False End If End Function Public Function ...
53,479,402
I'm currently using this code to autocolour font based on its origin: ``` Sub Auto_Colour_Numbers() Dim rng As Range, rErr As Range On Error Resume Next For Each rng In Intersect(ActiveSheet.UsedRange, Selection) If rng.HasFormula Then Set rErr = Range(Mid(rng.Formula, 2, Len(rng.Formula) - ...
2018/11/26
[ "https://Stackoverflow.com/questions/53479402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10584845/" ]
CF is probably the way to go, but if you want a VBA solution try using the sheet change event so the code is run whenever you change a cell. Put the code in the sheet module (right-click the sheet tab, View Code, and paste the code). ``` Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range For Each r...
If you're using a version earlier than 2013 here's a solution that doesn't use `FormulaText`: ``` Public Function RefDifSheet(Target As Range) As Boolean If Target.HasFormula Then RefDifSheet = InStr(Target.Formula, "!") <> 0 Else RefDifSheet = False End If End Function Public Function ...
27,309,833
In relation to this post [Stream read selected listbox item query](https://stackoverflow.com/questions/27286081/stream-read-selected-listbox-item-query/27286284#27286284) I am reading a SEGY file (Seismic data) and with the post above I am managing to read the first 3200 bytes which is the Textual File Header of a SEG...
2014/12/05
[ "https://Stackoverflow.com/questions/27309833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4153300/" ]
The `Read` method does not work like that. You've tried this: ``` readBinary.Read(binary, 3200, 400); ``` This will read the 400 bytes *at the current file pointer* but then start at offset 3200 *in the array*. This is not what you want according to your description. Instead, skip the first 3200 bytes manually, t...
I think you need to read carefully the definition of the 400-byte Binary File Header record: They are defined as two-byte or four-byte, two's complement integers. such as 3201-3204,this is four-byte, 3213-3214,this is two-byte. Other than that, the segy file is a IBM's big-endian data. I think you need to convert big-e...
27,309,833
In relation to this post [Stream read selected listbox item query](https://stackoverflow.com/questions/27286081/stream-read-selected-listbox-item-query/27286284#27286284) I am reading a SEGY file (Seismic data) and with the post above I am managing to read the first 3200 bytes which is the Textual File Header of a SEG...
2014/12/05
[ "https://Stackoverflow.com/questions/27309833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4153300/" ]
The `Read` method does not work like that. You've tried this: ``` readBinary.Read(binary, 3200, 400); ``` This will read the 400 bytes *at the current file pointer* but then start at offset 3200 *in the array*. This is not what you want according to your description. Instead, skip the first 3200 bytes manually, t...
I am not a real programmer, I was messing around with c# and wrote the following code to read the binary header of a SEGY file, I hope this can give you some hints: ``` namespace SEGY_TEST { class BinaryHeader { string fname; public int si; public int spt; public int fc; ...
31,293,514
I am currently developing an Android app which prompts the user to enable GPS if it's not on and I have used AlertDialog for this purpose. After I enable the GPS from settings and come back to my app by pressing back button, the mapView doesn't reflect my current location. Although If I have my GPS on before running th...
2015/07/08
[ "https://Stackoverflow.com/questions/31293514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5093990/" ]
You just need to initialize this ``` gps = new GPSTracker(LocationActivity.this); ``` at onResume() and at onCreate() and if needed then at onRestart() too. This is not the correct way but for making it working you can do this.
you`re probably interest in 'onResume' method. After getting back to Activity this one is invoked. Sho in there you should update the position
5,497,021
I have a regular expression that breaks html into necessary for me peaces. I will not present the whole regex, because it's too long. In a nutshell, its a multi-line table cells row-by-row parser. Recently i've ran into a trouble: the layout of parsing pages has changed, so I started remastering the regex to fit new la...
2011/03/31
[ "https://Stackoverflow.com/questions/5497021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/485676/" ]
This should help :) ``` <td class='(?:class1|class2)'>\s*((?=\w).*)\s*</td> ```
**Edited:** took over regexhacks expression, as it is a solution that is better. Not sure, but maybe you are looking for `non-capturing` groups used as (?:). Thus you could do ``` <td class='class(?:1|2)'>\s*((?=\w).*)\s*</td> ``` Well, in this example you would not need the groups: ``` <td class='class[12]'>\s*(...
28,403,782
What is the difference between back-propagation and feed-forward neural networks? By googling and reading, I found that in feed-forward there is only forward direction, but in back-propagation once we need to do a forward-propagation and then back-propagation. I referred to [this link](http://www.nnwj.de/backpropagati...
2015/02/09
[ "https://Stackoverflow.com/questions/28403782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2028043/" ]
* A [Feed-Forward Neural Network](http://en.wikipedia.org/wiki/Feedforward_neural_network) is a type of Neural Network **architecture** where the connections are "fed forward", i.e. do not form cycles (like in recurrent nets). * The term "Feed forward" is also used when you input something at the input layer and it *tr...
There is no pure backpropagation or pure feed-forward neural network. Backpropagation is algorithm to train (adjust weight) of neural network. Input for backpropagation is output\_vector, target\_output\_vector, output is adjusted\_weight\_vector. Feed-forward is algorithm to calculate output vector from input vector...
28,403,782
What is the difference between back-propagation and feed-forward neural networks? By googling and reading, I found that in feed-forward there is only forward direction, but in back-propagation once we need to do a forward-propagation and then back-propagation. I referred to [this link](http://www.nnwj.de/backpropagati...
2015/02/09
[ "https://Stackoverflow.com/questions/28403782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2028043/" ]
There is no pure backpropagation or pure feed-forward neural network. Backpropagation is algorithm to train (adjust weight) of neural network. Input for backpropagation is output\_vector, target\_output\_vector, output is adjusted\_weight\_vector. Feed-forward is algorithm to calculate output vector from input vector...
Neural Networks can have different architectures. The connections between their neurons decide direction of flow of information. Depending on network connections, they are categorised as - Feed-Forward and Recurrent (back-propagating). **Feed Forward Neural Networks** In these types of neural networks information flo...
28,403,782
What is the difference between back-propagation and feed-forward neural networks? By googling and reading, I found that in feed-forward there is only forward direction, but in back-propagation once we need to do a forward-propagation and then back-propagation. I referred to [this link](http://www.nnwj.de/backpropagati...
2015/02/09
[ "https://Stackoverflow.com/questions/28403782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2028043/" ]
There is no pure backpropagation or pure feed-forward neural network. Backpropagation is algorithm to train (adjust weight) of neural network. Input for backpropagation is output\_vector, target\_output\_vector, output is adjusted\_weight\_vector. Feed-forward is algorithm to calculate output vector from input vector...
To be simple: Feed-foward is an architecture. The contrary one is Recurrent Neural Networks. Back Propagation (BP) is a solving method. BP can solve both feed-foward and Recurrent Neural Networks.
28,403,782
What is the difference between back-propagation and feed-forward neural networks? By googling and reading, I found that in feed-forward there is only forward direction, but in back-propagation once we need to do a forward-propagation and then back-propagation. I referred to [this link](http://www.nnwj.de/backpropagati...
2015/02/09
[ "https://Stackoverflow.com/questions/28403782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2028043/" ]
* A [Feed-Forward Neural Network](http://en.wikipedia.org/wiki/Feedforward_neural_network) is a type of Neural Network **architecture** where the connections are "fed forward", i.e. do not form cycles (like in recurrent nets). * The term "Feed forward" is also used when you input something at the input layer and it *tr...
Neural Networks can have different architectures. The connections between their neurons decide direction of flow of information. Depending on network connections, they are categorised as - Feed-Forward and Recurrent (back-propagating). **Feed Forward Neural Networks** In these types of neural networks information flo...
28,403,782
What is the difference between back-propagation and feed-forward neural networks? By googling and reading, I found that in feed-forward there is only forward direction, but in back-propagation once we need to do a forward-propagation and then back-propagation. I referred to [this link](http://www.nnwj.de/backpropagati...
2015/02/09
[ "https://Stackoverflow.com/questions/28403782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2028043/" ]
* A [Feed-Forward Neural Network](http://en.wikipedia.org/wiki/Feedforward_neural_network) is a type of Neural Network **architecture** where the connections are "fed forward", i.e. do not form cycles (like in recurrent nets). * The term "Feed forward" is also used when you input something at the input layer and it *tr...
To be simple: Feed-foward is an architecture. The contrary one is Recurrent Neural Networks. Back Propagation (BP) is a solving method. BP can solve both feed-foward and Recurrent Neural Networks.
28,403,782
What is the difference between back-propagation and feed-forward neural networks? By googling and reading, I found that in feed-forward there is only forward direction, but in back-propagation once we need to do a forward-propagation and then back-propagation. I referred to [this link](http://www.nnwj.de/backpropagati...
2015/02/09
[ "https://Stackoverflow.com/questions/28403782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2028043/" ]
To be simple: Feed-foward is an architecture. The contrary one is Recurrent Neural Networks. Back Propagation (BP) is a solving method. BP can solve both feed-foward and Recurrent Neural Networks.
Neural Networks can have different architectures. The connections between their neurons decide direction of flow of information. Depending on network connections, they are categorised as - Feed-Forward and Recurrent (back-propagating). **Feed Forward Neural Networks** In these types of neural networks information flo...
13,595,741
In my current VBA code, I have a query in which I am using `Chr(34)` to put quotation marks between some of my variables. I was wondering what alternatives exist to this. This is a simple question, i know, but I haven't had any success with repeating quotation marks like this > > `"` & variable string here & `"` > ...
2012/11/28
[ "https://Stackoverflow.com/questions/13595741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343626/" ]
This: ``` comboService = """ & Me.Combo8.Value & """ ``` is what you posted, but you need to add an extra quotation mark in order to add a literal quotation mark: ``` comboService = """" & Me.Combo8.Value & """" ``` Double-quotes within a string are what you are looking for. ``` aVar = "This: "" is a literal quo...
I took a page from MS (the old `vbCRLF`) a while back, and just define any "tricky" characters I'll need as a string at the top of my code ... ``` Dim vbDblQuote As String vbDblQuote = Chr(34) ``` Now you can just use that pseudo-constant as you build strings ... ``` strMyString = "Just another string " & vbDblQuot...
13,595,741
In my current VBA code, I have a query in which I am using `Chr(34)` to put quotation marks between some of my variables. I was wondering what alternatives exist to this. This is a simple question, i know, but I haven't had any success with repeating quotation marks like this > > `"` & variable string here & `"` > ...
2012/11/28
[ "https://Stackoverflow.com/questions/13595741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343626/" ]
This: ``` comboService = """ & Me.Combo8.Value & """ ``` is what you posted, but you need to add an extra quotation mark in order to add a literal quotation mark: ``` comboService = """" & Me.Combo8.Value & """" ``` Double-quotes within a string are what you are looking for. ``` aVar = "This: "" is a literal quo...
I have found the same behavior if I output to a file using the Write command. Any double quotes get repeated. However, if you construct the string and then output to file using the Print command, this does not happen and all works as expected.
13,595,741
In my current VBA code, I have a query in which I am using `Chr(34)` to put quotation marks between some of my variables. I was wondering what alternatives exist to this. This is a simple question, i know, but I haven't had any success with repeating quotation marks like this > > `"` & variable string here & `"` > ...
2012/11/28
[ "https://Stackoverflow.com/questions/13595741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343626/" ]
I took a page from MS (the old `vbCRLF`) a while back, and just define any "tricky" characters I'll need as a string at the top of my code ... ``` Dim vbDblQuote As String vbDblQuote = Chr(34) ``` Now you can just use that pseudo-constant as you build strings ... ``` strMyString = "Just another string " & vbDblQuot...
I have found the same behavior if I output to a file using the Write command. Any double quotes get repeated. However, if you construct the string and then output to file using the Print command, this does not happen and all works as expected.
34,378,724
**Environment :** Spring 4 Hibernate 4 MySQL Spring MVC REST Issue : I am writing a simple REST based application for CRUD operations. The architecture/components is below : [![enter image description here](https://i.stack.imgur.com/64eSR.png)](https://i.stack.imgur.com/64eSR.png) I have below design issue...
2015/12/20
[ "https://Stackoverflow.com/questions/34378724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1281182/" ]
I think it is totally unnecessary to create separate contexts for your `Controllers` and `Service`/`Repository` classes unless you were thinking of having multiple Dispatchers or something like that. Generally you should keep it simple and have as few contexts as possible.
The answers to this question will be subjective, but as mentioned in other threads and in the [Spring MVC docs](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html) two contexts are typical, but not the only way to do it. I think the main reason is to separate them is when you have UI an...
28,927,821
I am using pydicom for extracting image data out of a dicom file. Unfortunately pydicom fails to directly extract a numpy array of data I can directly use, but I get a data string containing all values in hex (i.e. f.eks. `\x03\x80\x01\x0c\xa0\x00\x02P\x00\x04@\x00\t\x80\x00\x03...`. I know that the image data is encod...
2015/03/08
[ "https://Stackoverflow.com/questions/28927821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2546099/" ]
Second parameter (size) to `Image.fromstring` should be 2-tuple with height and width: ``` :param size: A 2-tuple, containing (width, height) in pixels. ```
Unfortunately pydiacom has issues with JPEG compression. Is there no way of making the images TIFF or some other uncompressed format? Is it scan data?
13,729,719
> > **Possible Duplicate:** > > [How to show a image in database in the image control of Asp.net?](https://stackoverflow.com/questions/2482104/how-to-show-a-image-in-database-in-the-image-control-of-asp-net) > > > I am returning a list of products from a database. Inside this list i am saving database images a...
2012/12/05
[ "https://Stackoverflow.com/questions/13729719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1094514/" ]
If your using Mvc its rather simple Simply write an action such as the following ``` public FileContentResult Image() { //Get the Byte Array for your image byte[] image = FilesBLL.GetImage(); //Return a jpg //Note the second parameter is the files mime type return File(image, "image/jpeg"); } ``` ...
A generic ASP.NET Handler (\*.ashx) could load the image from the database and stream it as a normal image to the browser. May this <http://coffeedrivendevelopment.net/2012/10/26/sharing-image-resources-between-wpf-and-asp-net/> will help you. It is about images in ressources, but the way is the same.
13,729,719
> > **Possible Duplicate:** > > [How to show a image in database in the image control of Asp.net?](https://stackoverflow.com/questions/2482104/how-to-show-a-image-in-database-in-the-image-control-of-asp-net) > > > I am returning a list of products from a database. Inside this list i am saving database images a...
2012/12/05
[ "https://Stackoverflow.com/questions/13729719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1094514/" ]
You likely have a few issues here: 1. You are referencing an asp.net Image object (`System.Web.UI.WebControls.Image`) not the GDI+ `System.Drawing.Image` object that you want. Clarify your namespace. 2. You can't dispose the stream on the image. Drop the using block. <https://stackoverflow.com/a/13696705/64262> 3. You...
A generic ASP.NET Handler (\*.ashx) could load the image from the database and stream it as a normal image to the browser. May this <http://coffeedrivendevelopment.net/2012/10/26/sharing-image-resources-between-wpf-and-asp-net/> will help you. It is about images in ressources, but the way is the same.
13,729,719
> > **Possible Duplicate:** > > [How to show a image in database in the image control of Asp.net?](https://stackoverflow.com/questions/2482104/how-to-show-a-image-in-database-in-the-image-control-of-asp-net) > > > I am returning a list of products from a database. Inside this list i am saving database images a...
2012/12/05
[ "https://Stackoverflow.com/questions/13729719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1094514/" ]
If your using Mvc its rather simple Simply write an action such as the following ``` public FileContentResult Image() { //Get the Byte Array for your image byte[] image = FilesBLL.GetImage(); //Return a jpg //Note the second parameter is the files mime type return File(image, "image/jpeg"); } ``` ...
You likely have a few issues here: 1. You are referencing an asp.net Image object (`System.Web.UI.WebControls.Image`) not the GDI+ `System.Drawing.Image` object that you want. Clarify your namespace. 2. You can't dispose the stream on the image. Drop the using block. <https://stackoverflow.com/a/13696705/64262> 3. You...
23,801,438
I'm trying to find ZipCryto Password from this execute, but when I open it in ollydbg and it always return to close programs because IsDebuggerPresent module. I find the solution on the internet and try to - Use ollydbg plugins (Hide debugger and IsDebugPresent) - Try to NOP in IsDebuggerPresent module - Try to force ...
2014/05/22
[ "https://Stackoverflow.com/questions/23801438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3664005/" ]
You should open the file in a dissembler, find where it makes the call to `IsDebuggerPresent` and then ultimately closes the application (or shows an error or what ever), this piece of code you can NOP in order to disable the check. You can read the ASM code with dissemblers like [IDA](https://www.hex-rays.com/product...
/GS- on the cl command line will remove this dependency.
23,801,438
I'm trying to find ZipCryto Password from this execute, but when I open it in ollydbg and it always return to close programs because IsDebuggerPresent module. I find the solution on the internet and try to - Use ollydbg plugins (Hide debugger and IsDebugPresent) - Try to NOP in IsDebuggerPresent module - Try to force ...
2014/05/22
[ "https://Stackoverflow.com/questions/23801438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3664005/" ]
suppose your exe file name is a1.exe do this: * press `Alt+E` to go `Executable modules` window. * Select a1.exe * press `Ctrl+N` * find `IsDebuggerPresent` in importes and select it. * right click and click `Follow import in Disassembler` * press `F2` on this opcode. * Run Program and wait for break point. * press s...
You should open the file in a dissembler, find where it makes the call to `IsDebuggerPresent` and then ultimately closes the application (or shows an error or what ever), this piece of code you can NOP in order to disable the check. You can read the ASM code with dissemblers like [IDA](https://www.hex-rays.com/product...
23,801,438
I'm trying to find ZipCryto Password from this execute, but when I open it in ollydbg and it always return to close programs because IsDebuggerPresent module. I find the solution on the internet and try to - Use ollydbg plugins (Hide debugger and IsDebugPresent) - Try to NOP in IsDebuggerPresent module - Try to force ...
2014/05/22
[ "https://Stackoverflow.com/questions/23801438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3664005/" ]
suppose your exe file name is a1.exe do this: * press `Alt+E` to go `Executable modules` window. * Select a1.exe * press `Ctrl+N` * find `IsDebuggerPresent` in importes and select it. * right click and click `Follow import in Disassembler` * press `F2` on this opcode. * Run Program and wait for break point. * press s...
/GS- on the cl command line will remove this dependency.
9,917
We have implemented/are implementing a network vulnerability scanning process, and we have chosen to use Qualysguard. Qualys supply a scanner appliance for the internal network scanning, which obviously connects to the network. Our internal network is segmented into multiple subnets, each firewalled from the others. W...
2011/12/20
[ "https://security.stackexchange.com/questions/9917", "https://security.stackexchange.com", "https://security.stackexchange.com/users/1064/" ]
I have not used QualysGuard however using a vendor agnostic approach I would consider the following. **Indirect connection through firewall:** This can be a good option if you are unable to connect to the subnet for some reason (not enough connections, physically not accessible, etc...). Some types of active scans d...
I am not sure that you will be able to get away with not adding rules to your firewalls to allow the traffic from the scanner. You will not need to open them up globally, just for the scanner's IP. If you are using stateful inspection, the scanners should be on the untrusted side of the firewall anyway so that the st...
9,917
We have implemented/are implementing a network vulnerability scanning process, and we have chosen to use Qualysguard. Qualys supply a scanner appliance for the internal network scanning, which obviously connects to the network. Our internal network is segmented into multiple subnets, each firewalled from the others. W...
2011/12/20
[ "https://security.stackexchange.com/questions/9917", "https://security.stackexchange.com", "https://security.stackexchange.com/users/1064/" ]
I have not used QualysGuard however using a vendor agnostic approach I would consider the following. **Indirect connection through firewall:** This can be a good option if you are unable to connect to the subnet for some reason (not enough connections, physically not accessible, etc...). Some types of active scans d...
It's highly recommended that you work with your network group to determine where to place Scanner Appliances in an enterprise network environment. Some things to consider: place Scanner Appliances as close to target machines as possible, and make sure to monitor and identify any bandwidth restricted segments or weak po...
56,235,514
I am trying to do function chaining in a Javascript class by returning this after each method, but somehow, it does not work..: ``` let sql = require('mssql'); let {logger} = require('../utils/logger'); let config = require('config'); //mssql_stellenanzeigen_config = config.get('stellenanzeigen'); mssql_doublettenchec...
2019/05/21
[ "https://Stackoverflow.com/questions/56235514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2774480/" ]
I use this code for send data to `activity`. ``` Intent intent = new Intent(this, MainActivity.class) .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("from", "notification"); pIntent = PendingIntent.getActivi...
Sending data. ``` Intent intent = new Intent(getApplicationContext(), simplestop.class); intent.putExtra("lable", lable); PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); final RemoteViews contentView = new RemoteViews(getPackageName(), R...
6,872,228
I am trying to get the main Window of an application written C#. Application.MainWindow Property does not work :( uses: ``` using System; using System.Windows; using System.Windows.Forms; using System.ComponentModel; using System.Drawing; using System.Collections.Generic; using My; using MyDialogs; using System.X...
2011/07/29
[ "https://Stackoverflow.com/questions/6872228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/817285/" ]
Sorry, it was my fault. I registered area routes calling `context.Routes.MapRoute()` instead of `context.MapRoute()` method.
Have you created a folder with the same name as your controller (without the Controller bit) underneath Views and put your view in there? So, not: ``` Areas AreaName Views MyView.aspx ``` but... ``` Areas AreaName Views ControllerNameWithoutControllerOnTheEnd ...
6,872,228
I am trying to get the main Window of an application written C#. Application.MainWindow Property does not work :( uses: ``` using System; using System.Windows; using System.Windows.Forms; using System.ComponentModel; using System.Drawing; using System.Collections.Generic; using My; using MyDialogs; using System.X...
2011/07/29
[ "https://Stackoverflow.com/questions/6872228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/817285/" ]
Have you created a folder with the same name as your controller (without the Controller bit) underneath Views and put your view in there? So, not: ``` Areas AreaName Views MyView.aspx ``` but... ``` Areas AreaName Views ControllerNameWithoutControllerOnTheEnd ...
Searches tend to take people here, so I'd like to shard another related item. I've had issues where the **view won't be returned** due to an **unexpected miss-match of the overloaded method** I meant to be calling, and the actual **method signature match**. For example, if you have Id as a string, then View("Somethin...
6,872,228
I am trying to get the main Window of an application written C#. Application.MainWindow Property does not work :( uses: ``` using System; using System.Windows; using System.Windows.Forms; using System.ComponentModel; using System.Drawing; using System.Collections.Generic; using My; using MyDialogs; using System.X...
2011/07/29
[ "https://Stackoverflow.com/questions/6872228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/817285/" ]
Sorry, it was my fault. I registered area routes calling `context.Routes.MapRoute()` instead of `context.MapRoute()` method.
Idsa, You may find that a similar question that I had today (which I figured out) may help: [goin back to my 'routes' - issue with partialviews and areas??](https://stackoverflow.com/questions/6866866/goin-back-to-my-routes-issue-with-partialviews-and-areas) basically, in your views web.config file(s), reference the...
6,872,228
I am trying to get the main Window of an application written C#. Application.MainWindow Property does not work :( uses: ``` using System; using System.Windows; using System.Windows.Forms; using System.ComponentModel; using System.Drawing; using System.Collections.Generic; using My; using MyDialogs; using System.X...
2011/07/29
[ "https://Stackoverflow.com/questions/6872228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/817285/" ]
Idsa, You may find that a similar question that I had today (which I figured out) may help: [goin back to my 'routes' - issue with partialviews and areas??](https://stackoverflow.com/questions/6866866/goin-back-to-my-routes-issue-with-partialviews-and-areas) basically, in your views web.config file(s), reference the...
Searches tend to take people here, so I'd like to shard another related item. I've had issues where the **view won't be returned** due to an **unexpected miss-match of the overloaded method** I meant to be calling, and the actual **method signature match**. For example, if you have Id as a string, then View("Somethin...
6,872,228
I am trying to get the main Window of an application written C#. Application.MainWindow Property does not work :( uses: ``` using System; using System.Windows; using System.Windows.Forms; using System.ComponentModel; using System.Drawing; using System.Collections.Generic; using My; using MyDialogs; using System.X...
2011/07/29
[ "https://Stackoverflow.com/questions/6872228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/817285/" ]
Sorry, it was my fault. I registered area routes calling `context.Routes.MapRoute()` instead of `context.MapRoute()` method.
Searches tend to take people here, so I'd like to shard another related item. I've had issues where the **view won't be returned** due to an **unexpected miss-match of the overloaded method** I meant to be calling, and the actual **method signature match**. For example, if you have Id as a string, then View("Somethin...
12,535,812
Is this: ``` [self showInWindow:window]; ``` what get called after `delay` by this code: ``` [self performSelector:@selector(showInWindow:) withObject:window afterDelay:delay]; ``` or am I misunderstanding the method? **Edit**: the problem I'm having is that the method `showInWindow` get ca...
2012/09/21
[ "https://Stackoverflow.com/questions/12535812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/756339/" ]
Yes, that's what gets called. (After the delay, of course.) [The documentation](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/nsobject_Class/Reference/Reference.html#//apple_ref/occ/instm/NSObject/performSelector:withObject:afterDelay:) doesn't really explain what it means t...
Yes, that's what it does... Although keep in mind that it may take longer than the delay to execute. This method basically sets up an `NSTimer` in the current thread's run loop, so if your thread gets busy doing heavy duty work and the run loop takes longer than your delay to come back, your method will get executed la...
35,299,351
I'm trying really hard, but I can't find where is my problem. I created a custom directive and it should iterate some HTML to draw the right content on the screen. The problem is that my ng-repeat does not iterate my array. I search on stackoverflow but what I found didn't help me. Here is my directive (it's in an e...
2016/02/09
[ "https://Stackoverflow.com/questions/35299351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2117899/" ]
This is because you have two separate array **references**. The equality operator is checking that the references are equal, not the content of the arrays.
One of the puzzling things about JavaScript is how equality is dealt with. I will do my best to explain this. The equality rules can be quite hard to grasp. Generally speaking, you can compare by relative equality (`==`) or strict equality `(===)`. **relative equality**: This compares by value only and does not car...
122,466
My hard drive had some bad sectors recently, so I backed up, re-formatted, and clean installed Mavericks. Everything seemed to work fine until couple days ago when I tried to look at some photos I recently imported to iPhoto, things got stuck and sometimes wouldn't move at all for up to 40 seconds, I knew it was a har...
2014/02/27
[ "https://apple.stackexchange.com/questions/122466", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/71588/" ]
I had the same problem as you few years ago. You definitely have the sympthoms of bad sectors. If you can't backup with Time Machine I advise you to back your data from the finder by yourself and skipping the files that can't be read. --- Edit : You won't be able to backup all your files. You can't retrieve the da...
Open Console in your Utility folder. Type "disk" in the search (Filter) window Look if you have disk I/O errors. If you do see them (like a lots of them), your disk is bad, so back up, and get new disk.
9,436,885
How can I create an array with Ruby (on Rails) in this form: ``` [[0,5], [1,5], [3,7]] ``` Edit: I know how to define simple array and add some data: ``` posts = Array[] # or Array.new posts << data.id # e.g. posts[1,2,3,4] ``` BUT i wanna know how to add (push) data to the array that is more complexive like in ...
2012/02/24
[ "https://Stackoverflow.com/questions/9436885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1215938/" ]
`num = [[0,5], [1,5], [3,7]]` isn't working?
There is a lot of ways to resolve your issue. You're looking for an array of arrays. I think you're confused by how an array can be inside an array. You should keep in mind that an array is just an ordered list of objects. So storing in array in each index is not as foreign as a concept as it may seem. ``` A = [] #an ...
57,914,193
i am doing this online course on udemy and everything works fine but when i try to intialize the first hidden layer it gave the following error ``` TypeError: __init__() missing 1 required positional argument: 'units'. ``` then I did the ctrl+I on the spyder and chnged the output\_dim and init arguments but i dont ...
2019/09/12
[ "https://Stackoverflow.com/questions/57914193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7317985/" ]
You can use window functions: ``` select subject from (select subject, count(*) as cnt, max(count(*)) over () as max_cnt, min(count(*)) over () as min_cnt from t group by subject ) s where cnt not in (max_cnt, min_cnt); ```
Another approach: ``` SELECT SUBJECT FROM STUDENTS GROUP BY SUBJECT HAVING COUNT(*) > 1 AND COUNT(*) < 3 ```
21,945,874
I've looked at a lot of the git repositories, but I'm not sure which one to start with (and they're fairly large, so I want to avoid scanning 25 gig of data). Where would I find the code to handle CVS and Subversion integration?
2014/02/21
[ "https://Stackoverflow.com/questions/21945874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25308/" ]
You can browse all of the git repositories at <http://git.eclipse.org/c/> . The one you want is <http://git.eclipse.org/c/platform/eclipse.platform.team.git/> (cloning URLs are shown at the bottom).
You can install the core Eclipse source including the CVS code in to Eclipse from `Help > Install New Software`. Work with `http://download.eclipse.org/eclipse/updates/4.3` for Eclipse 4.3 (Kepler) and choose `Eclipse SDK`. You can also download this as base Eclipse install (which is what I usually do). Once you have ...
21,945,874
I've looked at a lot of the git repositories, but I'm not sure which one to start with (and they're fairly large, so I want to avoid scanning 25 gig of data). Where would I find the code to handle CVS and Subversion integration?
2014/02/21
[ "https://Stackoverflow.com/questions/21945874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25308/" ]
You can install the core Eclipse source including the CVS code in to Eclipse from `Help > Install New Software`. Work with `http://download.eclipse.org/eclipse/updates/4.3` for Eclipse 4.3 (Kepler) and choose `Eclipse SDK`. You can also download this as base Eclipse install (which is what I usually do). Once you have ...
Update 2022: as illustrated by [gitlab.eclipse.org/eclipsefdn/helpdesk issue 1100](https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/1100), and [issue 915](https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/915), everything is in the process to be transferred to GitHub. The old (2014-2021) [`git.eclipse.org...
21,945,874
I've looked at a lot of the git repositories, but I'm not sure which one to start with (and they're fairly large, so I want to avoid scanning 25 gig of data). Where would I find the code to handle CVS and Subversion integration?
2014/02/21
[ "https://Stackoverflow.com/questions/21945874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25308/" ]
You can browse all of the git repositories at <http://git.eclipse.org/c/> . The one you want is <http://git.eclipse.org/c/platform/eclipse.platform.team.git/> (cloning URLs are shown at the bottom).
Update 2022: as illustrated by [gitlab.eclipse.org/eclipsefdn/helpdesk issue 1100](https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/1100), and [issue 915](https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/915), everything is in the process to be transferred to GitHub. The old (2014-2021) [`git.eclipse.org...
11,110,571
If I use `(body).height();` to calculate a windows height, is there a way to calculate the height -100px. Is there a way to do this as part of the `(body).height();` query rather than calculating it later on ?
2012/06/19
[ "https://Stackoverflow.com/questions/11110571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1183150/" ]
``` ($(body).height() - 100) ``` Just... subtract?
If you don't want to calculate it each time and deducting 100, you can define a custom function that will do it for you: ``` function bodyHeight() { return $("body").height()-100; } ``` And then just call `bodyHeight()` instead of `$("body").height()`.
11,110,571
If I use `(body).height();` to calculate a windows height, is there a way to calculate the height -100px. Is there a way to do this as part of the `(body).height();` query rather than calculating it later on ?
2012/06/19
[ "https://Stackoverflow.com/questions/11110571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1183150/" ]
``` ($(body).height() - 100) ``` Just... subtract?
The fastest way would be : ``` var H = $(body).height() - 100 + 'px'; console.log(H); ```
71,784,153
I have a data frame with the following properties: ``` Column Non-Null Count Dtype --- ------ -------------- ----- 0 Date 226611 non-null object 1 Time 226611 non-null object 2 Code 226611 non-null object 3 Message 226611 non-null object ``` `Date` column has values as ...
2022/04/07
[ "https://Stackoverflow.com/questions/71784153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15718805/" ]
Iterating over a range like that isn't very efficient because once you get past the square root of n, any further tests are redundant. I found a splendid implementation of a function that derives all factors of a given number [here](https://stackoverflow.com/questions/6800193/what-is-the-most-efficient-way-of-finding-...
When you do ``` for i in range(n ,0 , -1): if n % i == 0: sumlist.append(i) n -= 1 ``` n is being included. Thus, ``` print(sum_divisors(3)) # Should sum of 1 = 1 ``` will also include the 3 in the check, giving a result greater than what you want. For some thing closer to what you want: ``` for i in range(...
71,784,153
I have a data frame with the following properties: ``` Column Non-Null Count Dtype --- ------ -------------- ----- 0 Date 226611 non-null object 1 Time 226611 non-null object 2 Code 226611 non-null object 3 Message 226611 non-null object ``` `Date` column has values as ...
2022/04/07
[ "https://Stackoverflow.com/questions/71784153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15718805/" ]
Lesson in debugging of *your* approach - there are better ones: ``` def sum_divisors(n): sumlist = [] for i in range(n ,0 , -1): if n % i == 0: sumlist.append(i) # n -= 1 # this does nothing valuable # elif n % i != 0: # this does nothing # pass # this d...
When you do ``` for i in range(n ,0 , -1): if n % i == 0: sumlist.append(i) n -= 1 ``` n is being included. Thus, ``` print(sum_divisors(3)) # Should sum of 1 = 1 ``` will also include the 3 in the check, giving a result greater than what you want. For some thing closer to what you want: ``` for i in range(...
71,784,153
I have a data frame with the following properties: ``` Column Non-Null Count Dtype --- ------ -------------- ----- 0 Date 226611 non-null object 1 Time 226611 non-null object 2 Code 226611 non-null object 3 Message 226611 non-null object ``` `Date` column has values as ...
2022/04/07
[ "https://Stackoverflow.com/questions/71784153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15718805/" ]
Iterating over a range like that isn't very efficient because once you get past the square root of n, any further tests are redundant. I found a splendid implementation of a function that derives all factors of a given number [here](https://stackoverflow.com/questions/6800193/what-is-the-most-efficient-way-of-finding-...
You should start your range ( in line 3 ) from n-1 , and then do it again whilst removing unnecessary code ( as mentioned in above answers ) . Try this : ``` def sum_divisor(num): # Define your function here factors_list = [] # Create an empty list here for i in range(1,num): # Start your range from 1 and tak...
71,784,153
I have a data frame with the following properties: ``` Column Non-Null Count Dtype --- ------ -------------- ----- 0 Date 226611 non-null object 1 Time 226611 non-null object 2 Code 226611 non-null object 3 Message 226611 non-null object ``` `Date` column has values as ...
2022/04/07
[ "https://Stackoverflow.com/questions/71784153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15718805/" ]
Two problems: * `n -= 1` is wrong and ultimately leads to i and n always being equal, therefore `n % i == 0` always being true (therefore the large numbers you get) => delete this line * `i` shouldn't start from `n`, since based on your expected results you don't want the number itself to be included in the sum of div...
Iterating over a range like that isn't very efficient because once you get past the square root of n, any further tests are redundant. I found a splendid implementation of a function that derives all factors of a given number [here](https://stackoverflow.com/questions/6800193/what-is-the-most-efficient-way-of-finding-...
71,784,153
I have a data frame with the following properties: ``` Column Non-Null Count Dtype --- ------ -------------- ----- 0 Date 226611 non-null object 1 Time 226611 non-null object 2 Code 226611 non-null object 3 Message 226611 non-null object ``` `Date` column has values as ...
2022/04/07
[ "https://Stackoverflow.com/questions/71784153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15718805/" ]
This should work. ``` def sum_divisors(n): sum_divs = [] for i in range(1, n): if n % i == 0: sum_divs.append(i) return sum(sum_divs) print(sum_divisors(0)) # sum of 0 = 0 print(sum_divisors(3)) # Should sum of 1 = 1 print(sum_divisors(36)) # Should sum of 1+2+3+4+6+9+12+18 = 55 print(...
Iterating over a range like that isn't very efficient because once you get past the square root of n, any further tests are redundant. I found a splendid implementation of a function that derives all factors of a given number [here](https://stackoverflow.com/questions/6800193/what-is-the-most-efficient-way-of-finding-...
71,784,153
I have a data frame with the following properties: ``` Column Non-Null Count Dtype --- ------ -------------- ----- 0 Date 226611 non-null object 1 Time 226611 non-null object 2 Code 226611 non-null object 3 Message 226611 non-null object ``` `Date` column has values as ...
2022/04/07
[ "https://Stackoverflow.com/questions/71784153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15718805/" ]
Two problems: * `n -= 1` is wrong and ultimately leads to i and n always being equal, therefore `n % i == 0` always being true (therefore the large numbers you get) => delete this line * `i` shouldn't start from `n`, since based on your expected results you don't want the number itself to be included in the sum of div...
As always when you work with divisors, you can speed up things a lot by just looping up to the square root of `n`. When you find a divisor `i` lower than the square root you know `n // i` is a divisor too. This leaves us with some special cases to handle - especially so since you want to consider `1` as a divisor whil...
71,784,153
I have a data frame with the following properties: ``` Column Non-Null Count Dtype --- ------ -------------- ----- 0 Date 226611 non-null object 1 Time 226611 non-null object 2 Code 226611 non-null object 3 Message 226611 non-null object ``` `Date` column has values as ...
2022/04/07
[ "https://Stackoverflow.com/questions/71784153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15718805/" ]
Two problems: * `n -= 1` is wrong and ultimately leads to i and n always being equal, therefore `n % i == 0` always being true (therefore the large numbers you get) => delete this line * `i` shouldn't start from `n`, since based on your expected results you don't want the number itself to be included in the sum of div...
Lesson in debugging of *your* approach - there are better ones: ``` def sum_divisors(n): sumlist = [] for i in range(n ,0 , -1): if n % i == 0: sumlist.append(i) # n -= 1 # this does nothing valuable # elif n % i != 0: # this does nothing # pass # this d...
71,784,153
I have a data frame with the following properties: ``` Column Non-Null Count Dtype --- ------ -------------- ----- 0 Date 226611 non-null object 1 Time 226611 non-null object 2 Code 226611 non-null object 3 Message 226611 non-null object ``` `Date` column has values as ...
2022/04/07
[ "https://Stackoverflow.com/questions/71784153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15718805/" ]
Two problems: * `n -= 1` is wrong and ultimately leads to i and n always being equal, therefore `n % i == 0` always being true (therefore the large numbers you get) => delete this line * `i` shouldn't start from `n`, since based on your expected results you don't want the number itself to be included in the sum of div...
You should start your range ( in line 3 ) from n-1 , and then do it again whilst removing unnecessary code ( as mentioned in above answers ) . Try this : ``` def sum_divisor(num): # Define your function here factors_list = [] # Create an empty list here for i in range(1,num): # Start your range from 1 and tak...
71,784,153
I have a data frame with the following properties: ``` Column Non-Null Count Dtype --- ------ -------------- ----- 0 Date 226611 non-null object 1 Time 226611 non-null object 2 Code 226611 non-null object 3 Message 226611 non-null object ``` `Date` column has values as ...
2022/04/07
[ "https://Stackoverflow.com/questions/71784153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15718805/" ]
Lesson in debugging of *your* approach - there are better ones: ``` def sum_divisors(n): sumlist = [] for i in range(n ,0 , -1): if n % i == 0: sumlist.append(i) # n -= 1 # this does nothing valuable # elif n % i != 0: # this does nothing # pass # this d...
As always when you work with divisors, you can speed up things a lot by just looping up to the square root of `n`. When you find a divisor `i` lower than the square root you know `n // i` is a divisor too. This leaves us with some special cases to handle - especially so since you want to consider `1` as a divisor whil...
71,784,153
I have a data frame with the following properties: ``` Column Non-Null Count Dtype --- ------ -------------- ----- 0 Date 226611 non-null object 1 Time 226611 non-null object 2 Code 226611 non-null object 3 Message 226611 non-null object ``` `Date` column has values as ...
2022/04/07
[ "https://Stackoverflow.com/questions/71784153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15718805/" ]
This should work. ``` def sum_divisors(n): sum_divs = [] for i in range(1, n): if n % i == 0: sum_divs.append(i) return sum(sum_divs) print(sum_divisors(0)) # sum of 0 = 0 print(sum_divisors(3)) # Should sum of 1 = 1 print(sum_divisors(36)) # Should sum of 1+2+3+4+6+9+12+18 = 55 print(...
You should start your range ( in line 3 ) from n-1 , and then do it again whilst removing unnecessary code ( as mentioned in above answers ) . Try this : ``` def sum_divisor(num): # Define your function here factors_list = [] # Create an empty list here for i in range(1,num): # Start your range from 1 and tak...
159,456
I am not a physicist, but this question came to me and I need to answer it, and I think that you guys can help me. Is it possible to calculate the energy in a spark? For example in a lighter with an 'electric ignition'. If it is, how can I do that?
2015/01/14
[ "https://physics.stackexchange.com/questions/159456", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/70783/" ]
When you create a spark you generate a voltage, $V$, between the two electrodes and a current, $I$, flows between them. Both the voltage and the current vary with time, so we need to write them as functions of time: $V(t)$ and $I(t)$. If we have a current $I$ flowing across a voltage $V$, then the power is given by: ...
One way is to connect the ignition to a high voltage (10kV) capacitor. Then the energy is: $$E = \int VI d t = \frac{CV^2}{2},$$ where $C$ is its capacitance and $V$ its voltage, assuming that you connected it and did the measurements so that energy losses are negligible.
18,484,654
I have a form with inputs laid out correctly using ID's etc. I have deployed a little jQuery function to calculate the form variables. In essence I want to calculate the total VAT and then the Grand Total. The code example was taken from <http://forum.jquery.com/topic/calculation-on-form-fields> and that works OK. How...
2013/08/28
[ "https://Stackoverflow.com/questions/18484654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1785484/" ]
Try using [parseFloat()](http://www.w3schools.com/jsref/jsref_parsefloat.asp) or [parseInt(](http://www.w3schools.com/jsref/jsref_parseint.asp)) functions whle performing calculations in javascript becasue + is the opertaor for concatanation in javascript So `var grandTotal = parseFloat(a) + parseFloat(d);`
The fields `a` and `b` are of type string, so it does a string concatenation. Try ``` var grandTotal = parseFloat(a) + parseFloat(d); ```
18,484,654
I have a form with inputs laid out correctly using ID's etc. I have deployed a little jQuery function to calculate the form variables. In essence I want to calculate the total VAT and then the Grand Total. The code example was taken from <http://forum.jquery.com/topic/calculation-on-form-fields> and that works OK. How...
2013/08/28
[ "https://Stackoverflow.com/questions/18484654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1785484/" ]
try this : ``` function compute() { var a = parseFloat($('#siteFee').val()); var b = parseFloat($('#qty').val()); var c = parseFloat($('#vat').val()); var d = parseFloat($('#incVAT').val()); var totalVAT = (a * b * c) / 100; var grandTotal = a + d; $('#incVAT').val(totalVAT)...
The fields `a` and `b` are of type string, so it does a string concatenation. Try ``` var grandTotal = parseFloat(a) + parseFloat(d); ```
18,484,654
I have a form with inputs laid out correctly using ID's etc. I have deployed a little jQuery function to calculate the form variables. In essence I want to calculate the total VAT and then the Grand Total. The code example was taken from <http://forum.jquery.com/topic/calculation-on-form-fields> and that works OK. How...
2013/08/28
[ "https://Stackoverflow.com/questions/18484654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1785484/" ]
The fields `a` and `b` are of type string, so it does a string concatenation. Try ``` var grandTotal = parseFloat(a) + parseFloat(d); ```
You could create the variables as numbers initially as well, which may be cleaner for any more calculations you need to do. ``` var num = new Number(value); ```
18,484,654
I have a form with inputs laid out correctly using ID's etc. I have deployed a little jQuery function to calculate the form variables. In essence I want to calculate the total VAT and then the Grand Total. The code example was taken from <http://forum.jquery.com/topic/calculation-on-form-fields> and that works OK. How...
2013/08/28
[ "https://Stackoverflow.com/questions/18484654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1785484/" ]
Try using [parseFloat()](http://www.w3schools.com/jsref/jsref_parsefloat.asp) or [parseInt(](http://www.w3schools.com/jsref/jsref_parseint.asp)) functions whle performing calculations in javascript becasue + is the opertaor for concatanation in javascript So `var grandTotal = parseFloat(a) + parseFloat(d);`
Try replacing ``` var grandTotal = a + d; ``` with ``` var grandTotal = Number(a) + Number(d); ```
18,484,654
I have a form with inputs laid out correctly using ID's etc. I have deployed a little jQuery function to calculate the form variables. In essence I want to calculate the total VAT and then the Grand Total. The code example was taken from <http://forum.jquery.com/topic/calculation-on-form-fields> and that works OK. How...
2013/08/28
[ "https://Stackoverflow.com/questions/18484654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1785484/" ]
try this : ``` function compute() { var a = parseFloat($('#siteFee').val()); var b = parseFloat($('#qty').val()); var c = parseFloat($('#vat').val()); var d = parseFloat($('#incVAT').val()); var totalVAT = (a * b * c) / 100; var grandTotal = a + d; $('#incVAT').val(totalVAT)...
Try replacing ``` var grandTotal = a + d; ``` with ``` var grandTotal = Number(a) + Number(d); ```
18,484,654
I have a form with inputs laid out correctly using ID's etc. I have deployed a little jQuery function to calculate the form variables. In essence I want to calculate the total VAT and then the Grand Total. The code example was taken from <http://forum.jquery.com/topic/calculation-on-form-fields> and that works OK. How...
2013/08/28
[ "https://Stackoverflow.com/questions/18484654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1785484/" ]
Try replacing ``` var grandTotal = a + d; ``` with ``` var grandTotal = Number(a) + Number(d); ```
You could create the variables as numbers initially as well, which may be cleaner for any more calculations you need to do. ``` var num = new Number(value); ```
18,484,654
I have a form with inputs laid out correctly using ID's etc. I have deployed a little jQuery function to calculate the form variables. In essence I want to calculate the total VAT and then the Grand Total. The code example was taken from <http://forum.jquery.com/topic/calculation-on-form-fields> and that works OK. How...
2013/08/28
[ "https://Stackoverflow.com/questions/18484654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1785484/" ]
Try using [parseFloat()](http://www.w3schools.com/jsref/jsref_parsefloat.asp) or [parseInt(](http://www.w3schools.com/jsref/jsref_parseint.asp)) functions whle performing calculations in javascript becasue + is the opertaor for concatanation in javascript So `var grandTotal = parseFloat(a) + parseFloat(d);`
try this : ``` function compute() { var a = parseFloat($('#siteFee').val()); var b = parseFloat($('#qty').val()); var c = parseFloat($('#vat').val()); var d = parseFloat($('#incVAT').val()); var totalVAT = (a * b * c) / 100; var grandTotal = a + d; $('#incVAT').val(totalVAT)...
18,484,654
I have a form with inputs laid out correctly using ID's etc. I have deployed a little jQuery function to calculate the form variables. In essence I want to calculate the total VAT and then the Grand Total. The code example was taken from <http://forum.jquery.com/topic/calculation-on-form-fields> and that works OK. How...
2013/08/28
[ "https://Stackoverflow.com/questions/18484654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1785484/" ]
Try using [parseFloat()](http://www.w3schools.com/jsref/jsref_parsefloat.asp) or [parseInt(](http://www.w3schools.com/jsref/jsref_parseint.asp)) functions whle performing calculations in javascript becasue + is the opertaor for concatanation in javascript So `var grandTotal = parseFloat(a) + parseFloat(d);`
You could create the variables as numbers initially as well, which may be cleaner for any more calculations you need to do. ``` var num = new Number(value); ```
18,484,654
I have a form with inputs laid out correctly using ID's etc. I have deployed a little jQuery function to calculate the form variables. In essence I want to calculate the total VAT and then the Grand Total. The code example was taken from <http://forum.jquery.com/topic/calculation-on-form-fields> and that works OK. How...
2013/08/28
[ "https://Stackoverflow.com/questions/18484654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1785484/" ]
try this : ``` function compute() { var a = parseFloat($('#siteFee').val()); var b = parseFloat($('#qty').val()); var c = parseFloat($('#vat').val()); var d = parseFloat($('#incVAT').val()); var totalVAT = (a * b * c) / 100; var grandTotal = a + d; $('#incVAT').val(totalVAT)...
You could create the variables as numbers initially as well, which may be cleaner for any more calculations you need to do. ``` var num = new Number(value); ```
12,719,187
I read some questions here but they all can be defined as separate variables but I think mine is little bit different: ``` var sliderRecordList = this._sliderService.GetAllAsQueryable(); var sliderModelList = sliderRecordList.Select(record => new SliderModel() { Id = record.Id, SlideNam...
2012/10/04
[ "https://Stackoverflow.com/questions/12719187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44852/" ]
Materalize the query first, then setup the UI concerns. ``` var sliderRecordList = this._sliderService.GetAllAsQueryable().ToList(); var sliderModelList = sliderRecordList .Select(record => new SliderModel { Id = record.Id, SlideName = record.SlideName, SlideOrder = record.SlideOrder, ...
This is because the function `Url.Content` can not translated to its SQL equivalent function. Use `AsEnumerable` function to the list and give it a try ``` var sliderModelList = sliderRecordList.AsEnumerable.Select(record => new SliderModel() { Id = record.Id, SlideName = record.SlideName, ...
59,694,493
I try to add a CSS file in my node js project based on the EJS Template Engine, it does not work, the file cannot be found. > > GET <http://localhost/css/bulma.css> net::ERR\_ABORTED 404 (Not Found) > > > **my project folder structure** ``` ./index.js ./views /partials /header.ejs ./public /css ...
2020/01/11
[ "https://Stackoverflow.com/questions/59694493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10314944/" ]
You just forward `/` but no sub directory/paths. Therefore nginx trys to find the `/css/bulma.css` in his `root /home/nodejsproject/` Try something like this: ``` location ~/(.*)$ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass ...
Hello I did the similar thing using class `hello` it works. **my project folder structure** ``` ./index.js ./views /partials /header.ejs /pages /index.ejs /home.ejs ./public /css /bulma.css ``` **bulma.css** ``` .hello { background-color: blue; } ``` **home.ejs** ``...
18,205,627
I have a website in asp.net. I have hosted it on my server. My server has 3 directories named C,D,E. My Asp.net Application is in C drive. In a module I have uploaded Some Images which is stored in My Server's D directory. Now I want to Access it from asp.net Code but it display a error message as : "asp.net is a phys...
2013/08/13
[ "https://Stackoverflow.com/questions/18205627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2231834/" ]
Use [Server.MapPath](http://msdn.microsoft.com/en-us/library/ms524632%28v=vs.90%29.aspx) for specifying the relative or virtual path to map to a physical directory. ``` string FilePath; FilePath = Server.MapPath("/MyWebSite"); ```
Lets say you have URL ``` www.mydomain.com/D/images/MyMegaImage.jpg ``` File System ``` c:\inetpub\mywebsite\wwwroot\D\images\MyMegaImage.jpg ``` in code you would have something like ``` string imageFileName = "MyMegaImage.jpg"; string FullFilePath = HttpContext.Current.Server.MapPath("/D/images/" + imageFile...
11,172,993
I was looking at some code in Python (I know nothing about Python) and I came across this portion: ``` def do_req(body): global host, req data = "" s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, 80)) s.sendall(req % (len(body), body)) tmpdata = s.recv(8192) while len...
2012/06/23
[ "https://Stackoverflow.com/questions/11172993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1250458/" ]
It is not really the modulus operator (technically it is since strings simply implement [`__mod__`](http://docs.python.org/reference/datamodel.html#object.__mod__)) but the [python2-style string formatting operator](http://docs.python.org/library/stdtypes.html#string-formatting-operations). > > Given `format % values...
No, body is not reduced here, because % is format operator, when operates on strings. <http://docs.python.org/release/2.5.2/lib/typesseq-strings.html> All the data is sent by sendall method by parts. socket.sendall works like that: ``` do { n = sendsegmented(s->sock_fd, buf, len, flags); len -= n; ...
75,498
The "ninth chord" that Rameau, Kirnberger, Marpurg or Koch (inter alia) discuss during the 18th century is the chord formed by a triad and an added ninth, and its explanation is always through a "chord of supposition", i.e., the supposed root is a third above the lowest note of the chord, since chords that spanned more...
2018/10/17
[ "https://music.stackexchange.com/questions/75498", "https://music.stackexchange.com", "https://music.stackexchange.com/users/52903/" ]
In addition to Reber and Richter that you mention, I know that Fétis (1844), Durand (1881), and Dubois (1889, 1921) also discussed ninth chords. But the earliest theorist that I know of, not including theorists like Sorge that fall into the fundamental-bass camp with Rameau and Marpurg (it was this group, by the way, ...
It first gained common usage in the late baroque, its origin was through intervallic supposition and accidental harmonic forms.
53,348,216
Newbie to pandas, after searching I found pandas is very suitable to make my data divided by parts for further display on charts. Here is what I do with it: ``` print pd.cut(data_lst, 5).value_counts() ``` the `data_lst` is a list of numbers and above line of code give a pretty neat result like this which is exact...
2018/11/17
[ "https://Stackoverflow.com/questions/53348216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2288944/" ]
After getting `value_counts`, convert the index of the resulting `Series` to `str`. ``` vc = pd.cut(data_lst, 5).value_counts() vc.index = vc.index.astype(str) print vc.to_dict() ``` For my toy example, this printed ``` {'(5.0, inf]': 4, '(2.0, 5.0]': 3, '(-inf, 2.0]': 3} ``` which I believe is the format you're ...
I believe this will help.. Just taking an example DataFrame using.. See this [Documentation pandas.DataFrame.to\_dict](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_dict.html) ``` >>> df = pd.DataFrame({'a': ['red', 'yellow', 'blue'], 'b': [0.5, 0.25, 0.125]}) >>> df a b 0 ...
53,348,216
Newbie to pandas, after searching I found pandas is very suitable to make my data divided by parts for further display on charts. Here is what I do with it: ``` print pd.cut(data_lst, 5).value_counts() ``` the `data_lst` is a list of numbers and above line of code give a pretty neat result like this which is exact...
2018/11/17
[ "https://Stackoverflow.com/questions/53348216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2288944/" ]
save the printed item to a variable and convert that dataframe to dict. df=( pd.cut(data\_lst, 5).value\_counts()) dict\_n=df.to\_dict()
I believe this will help.. Just taking an example DataFrame using.. See this [Documentation pandas.DataFrame.to\_dict](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_dict.html) ``` >>> df = pd.DataFrame({'a': ['red', 'yellow', 'blue'], 'b': [0.5, 0.25, 0.125]}) >>> df a b 0 ...
53,348,216
Newbie to pandas, after searching I found pandas is very suitable to make my data divided by parts for further display on charts. Here is what I do with it: ``` print pd.cut(data_lst, 5).value_counts() ``` the `data_lst` is a list of numbers and above line of code give a pretty neat result like this which is exact...
2018/11/17
[ "https://Stackoverflow.com/questions/53348216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2288944/" ]
After getting `value_counts`, convert the index of the resulting `Series` to `str`. ``` vc = pd.cut(data_lst, 5).value_counts() vc.index = vc.index.astype(str) print vc.to_dict() ``` For my toy example, this printed ``` {'(5.0, inf]': 4, '(2.0, 5.0]': 3, '(-inf, 2.0]': 3} ``` which I believe is the format you're ...
save the printed item to a variable and convert that dataframe to dict. df=( pd.cut(data\_lst, 5).value\_counts()) dict\_n=df.to\_dict()
4,261,861
This is part of my program: ``` // let's get jpg image from socket int iRcvdBytes=recvfrom(iSockFd, buff, bufferSize, 0, (struct sockaddr*)&cliAddr, (socklen_t*)&cliAddrLen); // buff now contains 30KB jpg image // let's load the jpg image to IplImage IplImage* fIplImageHeader; fIplImageHeader = cvCreateImageHeader(...
2010/11/23
[ "https://Stackoverflow.com/questions/4261861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/95944/" ]
You are comparing the lenght of the compressed jpeg image data to the uncompressed pixel data. In particular, given: ``` fIplImageHeader = cvCreateImageHeader(cvSize(width, height), depth, channels) ``` It will always be the case that `fIplImageHeader->imageSize` == `width * height * (depth/8) * channels` Assign...
Jpeg does not represent an exact representation of an image. It's a "lossy" format (i.e. you lose some detail in exchange for a smaller size image). I'd bet you haven't specified the 'quality' of the image you want so it's using a default high quality. Look for a quality setting and set it for a lower value. You'll nee...
11,414,596
I'm trying to drop the last row in a `dataframe` created by pandas in python and seem to be having trouble. ``` index = DateRange('1/1/2000', periods=8) df = DataFrame(randn(8, 3), index=index, columns=['A', 'B', 'C']) ``` I tried the drop method like this: ``` df.drop([shape(df)[0]-1], axis = 0) ``` but it keep...
2012/07/10
[ "https://Stackoverflow.com/questions/11414596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1504276/" ]
I'm use the following code and resolve problem. ``` $('.colorBox').colorbox({ scalePhotos: true, maxWidth: '100%' }); ```
That result makes sense to me. You gave colorbox a display:block element with no defined width and asked it to estimate the size, which of course will be 100% of the available width.
12,922,000
How can I get the Operating System build number (Windows, Mac etc) from within a browser? Can use Flash or Java if have to? or something else?
2012/10/16
[ "https://Stackoverflow.com/questions/12922000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/159366/" ]
As of [FakeItEasy 2.0.0](https://github.com/FakeItEasy/FakeItEasy/releases/tag/2.0.0), this is now possible. The [Raising Events documentation topic](http://fakeiteasy.readthedocs.io/en/stable/raising-events/) has the full story, but the gist is that you'd use ``` fake.OnNameChanged += Raise.With<NameChanged>(newNam...
You could always make `ChangeYourName` virtual and replace the method. ``` A.CallsTo(()=>fakeClass.ChangeyourName(A<string>._)).Invokes((x)=>invokeMockEvent(x)); ``` If that isn't what you wanted, I suppose if `ChangeYourName` is public you could just create your fake class ``` var class = new Class(); class.OnName...
967,073
Trackpad two finger scrolling and right-click issue with Ubuntu 17.10 (i386, 64bit, GNOME 3.26.1) on a Lenovo T540p (the model with a Intel Core i5-4210M Haswell CPU etc)
2017/10/21
[ "https://askubuntu.com/questions/967073", "https://askubuntu.com", "https://askubuntu.com/users/692423/" ]
I have the same issue on my Thinkpad T450s. This issue is referenced on launchpad here: <https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1722478> It seems to happen after a resume. The workaround described on LP1722478 works for me: ``` sudo modprobe -r psmouse sudo modprobe psmouse ```
I guess I know what you mean. If you install *Gnome Tweaking Tool*, a.k.a. *Tweaks*, you can go to `Keyboard & Mouse > Click Method > Fingers`. That might solve it.
967,073
Trackpad two finger scrolling and right-click issue with Ubuntu 17.10 (i386, 64bit, GNOME 3.26.1) on a Lenovo T540p (the model with a Intel Core i5-4210M Haswell CPU etc)
2017/10/21
[ "https://askubuntu.com/questions/967073", "https://askubuntu.com", "https://askubuntu.com/users/692423/" ]
Still broken in 22.04 on my ThinkPad X240. An alternative to the kernel command line workaround is creating the file `/etc/modprobe.d/psmouse.conf` containing ``` options psmouse synaptics_intertouch=0 ``` and reload the module ``` sudo modprobe -r psmouse sudo modprobe psmouse ```
You probably were using Unity as your desktop environment before and are using Gnome Shell now. (Whether you wanted it or not, the upgrade decided for you.) If you want to use Unity even now, that is an option, and it will resolve your problem. You may already have Unity installed, whether you know it or not, but in c...
967,073
Trackpad two finger scrolling and right-click issue with Ubuntu 17.10 (i386, 64bit, GNOME 3.26.1) on a Lenovo T540p (the model with a Intel Core i5-4210M Haswell CPU etc)
2017/10/21
[ "https://askubuntu.com/questions/967073", "https://askubuntu.com", "https://askubuntu.com/users/692423/" ]
Update for other ThinkPad users, as per the hard work done [here](https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1722478), the workaround is as follows... Edit the file `/etc/default/grub` and change the line: ``` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" ``` to ``` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash p...
I guess I know what you mean. If you install *Gnome Tweaking Tool*, a.k.a. *Tweaks*, you can go to `Keyboard & Mouse > Click Method > Fingers`. That might solve it.
967,073
Trackpad two finger scrolling and right-click issue with Ubuntu 17.10 (i386, 64bit, GNOME 3.26.1) on a Lenovo T540p (the model with a Intel Core i5-4210M Haswell CPU etc)
2017/10/21
[ "https://askubuntu.com/questions/967073", "https://askubuntu.com", "https://askubuntu.com/users/692423/" ]
Update for other ThinkPad users, as per the hard work done [here](https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1722478), the workaround is as follows... Edit the file `/etc/default/grub` and change the line: ``` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" ``` to ``` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash p...
About the two finger scrolling, try with **three fingers**, that worked out of the box for me on my Lenovo X1 Carbon 2015.
967,073
Trackpad two finger scrolling and right-click issue with Ubuntu 17.10 (i386, 64bit, GNOME 3.26.1) on a Lenovo T540p (the model with a Intel Core i5-4210M Haswell CPU etc)
2017/10/21
[ "https://askubuntu.com/questions/967073", "https://askubuntu.com", "https://askubuntu.com/users/692423/" ]
Update for other ThinkPad users, as per the hard work done [here](https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1722478), the workaround is as follows... Edit the file `/etc/default/grub` and change the line: ``` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" ``` to ``` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash p...
As mentioned in the [answer by @hpotter40](https://askubuntu.com/a/971735), this is behavior is bug [LP #1722478](https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1722478). It affects a wide variety of relatively recent ThinkPad computers, and is still present in Ubtuntu 19.04. Three workarounds are discussed in th...
967,073
Trackpad two finger scrolling and right-click issue with Ubuntu 17.10 (i386, 64bit, GNOME 3.26.1) on a Lenovo T540p (the model with a Intel Core i5-4210M Haswell CPU etc)
2017/10/21
[ "https://askubuntu.com/questions/967073", "https://askubuntu.com", "https://askubuntu.com/users/692423/" ]
I have the same issue on my Thinkpad T450s. This issue is referenced on launchpad here: <https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1722478> It seems to happen after a resume. The workaround described on LP1722478 works for me: ``` sudo modprobe -r psmouse sudo modprobe psmouse ```
I had the same problem. In Gnome Tweaks, 'Keyboard & Mouse' settings, changing the click method to 'Areas' got the right-click working again.
967,073
Trackpad two finger scrolling and right-click issue with Ubuntu 17.10 (i386, 64bit, GNOME 3.26.1) on a Lenovo T540p (the model with a Intel Core i5-4210M Haswell CPU etc)
2017/10/21
[ "https://askubuntu.com/questions/967073", "https://askubuntu.com", "https://askubuntu.com/users/692423/" ]
Update for other ThinkPad users, as per the hard work done [here](https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1722478), the workaround is as follows... Edit the file `/etc/default/grub` and change the line: ``` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" ``` to ``` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash p...
Still broken in 22.04 on my ThinkPad X240. An alternative to the kernel command line workaround is creating the file `/etc/modprobe.d/psmouse.conf` containing ``` options psmouse synaptics_intertouch=0 ``` and reload the module ``` sudo modprobe -r psmouse sudo modprobe psmouse ```
967,073
Trackpad two finger scrolling and right-click issue with Ubuntu 17.10 (i386, 64bit, GNOME 3.26.1) on a Lenovo T540p (the model with a Intel Core i5-4210M Haswell CPU etc)
2017/10/21
[ "https://askubuntu.com/questions/967073", "https://askubuntu.com", "https://askubuntu.com/users/692423/" ]
I have the same issue on my Thinkpad T450s. This issue is referenced on launchpad here: <https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1722478> It seems to happen after a resume. The workaround described on LP1722478 works for me: ``` sudo modprobe -r psmouse sudo modprobe psmouse ```
About the two finger scrolling, try with **three fingers**, that worked out of the box for me on my Lenovo X1 Carbon 2015.
967,073
Trackpad two finger scrolling and right-click issue with Ubuntu 17.10 (i386, 64bit, GNOME 3.26.1) on a Lenovo T540p (the model with a Intel Core i5-4210M Haswell CPU etc)
2017/10/21
[ "https://askubuntu.com/questions/967073", "https://askubuntu.com", "https://askubuntu.com/users/692423/" ]
I guess I know what you mean. If you install *Gnome Tweaking Tool*, a.k.a. *Tweaks*, you can go to `Keyboard & Mouse > Click Method > Fingers`. That might solve it.
Still broken in 22.04 on my ThinkPad X240. An alternative to the kernel command line workaround is creating the file `/etc/modprobe.d/psmouse.conf` containing ``` options psmouse synaptics_intertouch=0 ``` and reload the module ``` sudo modprobe -r psmouse sudo modprobe psmouse ```
967,073
Trackpad two finger scrolling and right-click issue with Ubuntu 17.10 (i386, 64bit, GNOME 3.26.1) on a Lenovo T540p (the model with a Intel Core i5-4210M Haswell CPU etc)
2017/10/21
[ "https://askubuntu.com/questions/967073", "https://askubuntu.com", "https://askubuntu.com/users/692423/" ]
As mentioned in the [answer by @hpotter40](https://askubuntu.com/a/971735), this is behavior is bug [LP #1722478](https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1722478). It affects a wide variety of relatively recent ThinkPad computers, and is still present in Ubtuntu 19.04. Three workarounds are discussed in th...
You probably were using Unity as your desktop environment before and are using Gnome Shell now. (Whether you wanted it or not, the upgrade decided for you.) If you want to use Unity even now, that is an option, and it will resolve your problem. You may already have Unity installed, whether you know it or not, but in c...
1,523,170
I've been looking around at various APIs, and since twitter seems to be a common discussion point, I'll use it as an example. A lot of APIs are implementing oAuth which is great for allowing the service to authenicate and authorize the application connecting to it, however, from what I have seen there doesnt seem to ...
2009/10/06
[ "https://Stackoverflow.com/questions/1523170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56940/" ]
This is what the 'trust' part of SSL does. -- Edit I note this has been downvoted, but it's important that other readers realise it's due to a personal disagreement, not due to incorrectness.
In the .NET world we use WCF, which has many different security models, including signing (and if desired encrypting) each message/response. This adds up to a non-trivial amount of overhead, but can give you more 'trust' in the security model. You can switch to using binary-serialized data to cut down on the bloat and ...
52,766,481
I have a sql statement ``` SELECT emp.id, emp.name, FROM emp, office, payment WHERE emp.id = office.empid AND payment.id = emp.pay ``` but I actually want the ``` AND payment.id = emp.pay ``` to be executed conditionally. It should not execute always. For e.g. it should execute only if emp.pay is NOT NULL
2018/10/11
[ "https://Stackoverflow.com/questions/52766481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6614967/" ]
You can add animation on all styles changes adding next properties to **myDiv** class: ``` /* Animate all changes */ -webkit-transition: all 0.5s ease; -moz-transition: all 0.5s ease; -o-transition: all 0.5s ease; transition: all 0.5s ease; ``` I will show the changes on your example: ```js $('.myDiv').click(functi...
It's a bit of a complicated task, but this should give you an idea of how it's done. This code will run into some issues (clicking quickly will stack `setTimeout`) but does the basics. The idea is that you calculate the current position of the element with `getBoundingClientRect()` and set initial position values with...
52,766,481
I have a sql statement ``` SELECT emp.id, emp.name, FROM emp, office, payment WHERE emp.id = office.empid AND payment.id = emp.pay ``` but I actually want the ``` AND payment.id = emp.pay ``` to be executed conditionally. It should not execute always. For e.g. it should execute only if emp.pay is NOT NULL
2018/10/11
[ "https://Stackoverflow.com/questions/52766481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6614967/" ]
Fullscreen animation ==================== Now making a element fullscreen is pretty simple. It could be done with css alone. ```css .content { display: inline-grid; width: 150px; height: 100px; background-color: cornflowerblue; border-radius: 3px; transition: width 2s, height 2s; margin: 10px; ...
You can add animation on all styles changes adding next properties to **myDiv** class: ``` /* Animate all changes */ -webkit-transition: all 0.5s ease; -moz-transition: all 0.5s ease; -o-transition: all 0.5s ease; transition: all 0.5s ease; ``` I will show the changes on your example: ```js $('.myDiv').click(functi...
52,766,481
I have a sql statement ``` SELECT emp.id, emp.name, FROM emp, office, payment WHERE emp.id = office.empid AND payment.id = emp.pay ``` but I actually want the ``` AND payment.id = emp.pay ``` to be executed conditionally. It should not execute always. For e.g. it should execute only if emp.pay is NOT NULL
2018/10/11
[ "https://Stackoverflow.com/questions/52766481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6614967/" ]
You can add animation on all styles changes adding next properties to **myDiv** class: ``` /* Animate all changes */ -webkit-transition: all 0.5s ease; -moz-transition: all 0.5s ease; -o-transition: all 0.5s ease; transition: all 0.5s ease; ``` I will show the changes on your example: ```js $('.myDiv').click(functi...
Here's how i made it: * JQuery: 3.6.0 * Css preprocessor: SCSS * CSS Framework: Bootstrap 5.1.0 See it in action: <https://codepen.io/illegalmexican/pen/NWYNVvg> Please note that i was answering a JQuery post. The fowlloing could be made in Vanilla Javascript for better performance. Also keep in mind that this co...
52,766,481
I have a sql statement ``` SELECT emp.id, emp.name, FROM emp, office, payment WHERE emp.id = office.empid AND payment.id = emp.pay ``` but I actually want the ``` AND payment.id = emp.pay ``` to be executed conditionally. It should not execute always. For e.g. it should execute only if emp.pay is NOT NULL
2018/10/11
[ "https://Stackoverflow.com/questions/52766481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6614967/" ]
Fullscreen animation ==================== Now making a element fullscreen is pretty simple. It could be done with css alone. ```css .content { display: inline-grid; width: 150px; height: 100px; background-color: cornflowerblue; border-radius: 3px; transition: width 2s, height 2s; margin: 10px; ...
It's a bit of a complicated task, but this should give you an idea of how it's done. This code will run into some issues (clicking quickly will stack `setTimeout`) but does the basics. The idea is that you calculate the current position of the element with `getBoundingClientRect()` and set initial position values with...
52,766,481
I have a sql statement ``` SELECT emp.id, emp.name, FROM emp, office, payment WHERE emp.id = office.empid AND payment.id = emp.pay ``` but I actually want the ``` AND payment.id = emp.pay ``` to be executed conditionally. It should not execute always. For e.g. it should execute only if emp.pay is NOT NULL
2018/10/11
[ "https://Stackoverflow.com/questions/52766481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6614967/" ]
Fullscreen animation ==================== Now making a element fullscreen is pretty simple. It could be done with css alone. ```css .content { display: inline-grid; width: 150px; height: 100px; background-color: cornflowerblue; border-radius: 3px; transition: width 2s, height 2s; margin: 10px; ...
Here's how i made it: * JQuery: 3.6.0 * Css preprocessor: SCSS * CSS Framework: Bootstrap 5.1.0 See it in action: <https://codepen.io/illegalmexican/pen/NWYNVvg> Please note that i was answering a JQuery post. The fowlloing could be made in Vanilla Javascript for better performance. Also keep in mind that this co...
11,410,466
look the below program. When compiled it, the loop is not terminating. That is not an expected behaviour. Anyone please explain this reason? ``` #include<iostream.h> int main() { int nIntValue = 0; int nTempVal = 100; for( int nLoop = 1; nLoop <= 25; nLoop++ ) { nTempVal = nTempVal / nLoop; ...
2012/07/10
[ "https://Stackoverflow.com/questions/11410466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1510300/" ]
First of all, what is `nIntVal`? Second, assuming its really `nIntValue`, when you enter the following loop: ``` while( nIntVal == 0 ) { nIntVal += nTempVal; cout<<nIntVal; } ``` it is 0. As for nTempVal, you are dividing 100 by `(1*2*3*...*25)`. You are using `int` type which means all valu...
`nTempVal = 0`. So the loop is not terminated. You can easily find such error with `debugger`