qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
14,800,379 | I have 3 span tags that hold the price for each item and shipping. I need to add the three span tags together to come up with the total price using jQuery. Here is my code:
```
<div id="relative">
<div id="absolute">
Widget 1: <span id="widget_1_price">$99.99</span><br />
Widget 2: <span id="widget... | 2013/02/10 | [
"https://Stackoverflow.com/questions/14800379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/317740/"
] | Loop through the elements and parse the text in them, and add them together:
```
var sum = 0;
$('#widget_1_price,#widget_2_price,#shipping_price').each(function(){
sum += parseFloat($(this).text().substr(1));
});
$('#total_price').text('$' + Math.round(sum * 100) / 100);
```
Demo: <http://jsfiddle.net/QTMsE/> | ```
var val1 = parseFloat($("#widget_1_price").text().substring(1));
var val2 = parseFloat($("#widget_2_price").text().substring(1));
var shipping = parseFloat($("#shipping_price").text().substring(1));
var all = val1 + val2 + shipping;
$("#total_price").text("$"+all);
```
Try this. |
14,800,379 | I have 3 span tags that hold the price for each item and shipping. I need to add the three span tags together to come up with the total price using jQuery. Here is my code:
```
<div id="relative">
<div id="absolute">
Widget 1: <span id="widget_1_price">$99.99</span><br />
Widget 2: <span id="widget... | 2013/02/10 | [
"https://Stackoverflow.com/questions/14800379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/317740/"
] | Loop through the elements and parse the text in them, and add them together:
```
var sum = 0;
$('#widget_1_price,#widget_2_price,#shipping_price').each(function(){
sum += parseFloat($(this).text().substr(1));
});
$('#total_price').text('$' + Math.round(sum * 100) / 100);
```
Demo: <http://jsfiddle.net/QTMsE/> | Try this:
```
total = parseFloat($('#widget_1_price').text().slice(1))+
parseFloat($('#widget_2_price').text().slice(1))+
parseFloat($('#shipping_price').text().slice(1));
$('#total_price').text('$'+total);
``` |
355,300 | The following code allows me to produce series easily (see examples below the code):
```
\documentclass{article}
\ExplSyntaxOn
\NewDocumentCommand \simpleseq { m m m } {
\seq_set_split:Nnn \l_inner_seq {,} {#3}
\seq_set_map:NNn \l_part_seq \l_inner_seq {\exp_not:n {#2}}
\seq_use:Nn \l_part_seq {#1 \allowbreak}
... | 2017/02/23 | [
"https://tex.stackexchange.com/questions/355300",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/63573/"
] | Define a temporary function:
```
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}
\ExplSyntaxOn
\seq_new:N \l_fabian_inner_in_seq
\seq_new:N \l_fabian_inner_out_seq
\seq_new:N \l_fabian_outer_in_seq
\seq_new:N \l_fabian_outer_out_seq
\NewDocumentCommand \seq { O{,} O{\dots} d|| s m s }
{
\IfNoVal... | The following modification works, but seems really really really unsafe ~~and I won't use it unless someone tells me it's a good idea (and gives me arguments so that I believe him :p)~~
```
\NewDocumentCommand \simpleseq { m m m } {
\seq_set_split:Nnn \l_inner_seq {,} {#3}
\seq_set_map:NNn \l_part_seq \l_inner_seq... |
845,199 | I would like to know what guys are using to make diagram of your application/service architecture ?
I would like to make diagrams representing the different layer of the whole application and for some parts go deeper (class level) | 2009/05/10 | [
"https://Stackoverflow.com/questions/845199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27820/"
] | [Visio](http://visiotoolbox.com/en-us/Buynow.aspx?utm_source=google&utm_medium=cpc&utm_term=Visio&utm_content=textads&utm_campaign=Search_Visio_US&gclid=CKLJpLnqsZoCFSbxDAodyBv-bQ) | You can also use [ARIS Express](http://www.ariscommunity.com/aris-express), which is free-of-charge. For example, you can use a system landscape model to describe your application architecture. Another interesting diagram might be IT infrastructure model, where you can describe the deployment of your application. Or yo... |
845,199 | I would like to know what guys are using to make diagram of your application/service architecture ?
I would like to make diagrams representing the different layer of the whole application and for some parts go deeper (class level) | 2009/05/10 | [
"https://Stackoverflow.com/questions/845199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27820/"
] | There are a [lot of UML tools](http://en.wikipedia.org/wiki/List_of_UML_tools) that can be used to draw [UML diagrams](http://en.wikipedia.org/wiki/Unified_Modeling_Language). Some of them can also generate skeleton code etc but you don't have to bother with that if you don't want to.
Here's a couple of open source um... | I use dia for this task |
845,199 | I would like to know what guys are using to make diagram of your application/service architecture ?
I would like to make diagrams representing the different layer of the whole application and for some parts go deeper (class level) | 2009/05/10 | [
"https://Stackoverflow.com/questions/845199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27820/"
] | [Visio](http://visiotoolbox.com/en-us/Buynow.aspx?utm_source=google&utm_medium=cpc&utm_term=Visio&utm_content=textads&utm_campaign=Search_Visio_US&gclid=CKLJpLnqsZoCFSbxDAodyBv-bQ) | What specific approach are you using? Lucidchart is great for UML schemas. No plugin or download needed. |
845,199 | I would like to know what guys are using to make diagram of your application/service architecture ?
I would like to make diagrams representing the different layer of the whole application and for some parts go deeper (class level) | 2009/05/10 | [
"https://Stackoverflow.com/questions/845199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27820/"
] | [Enterprise Architect](http://www.sparxsystems.com.au/) | What specific approach are you using? Lucidchart is great for UML schemas. No plugin or download needed. |
845,199 | I would like to know what guys are using to make diagram of your application/service architecture ?
I would like to make diagrams representing the different layer of the whole application and for some parts go deeper (class level) | 2009/05/10 | [
"https://Stackoverflow.com/questions/845199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27820/"
] | I used [dia](http://live.gnome.org/Dia), for couple of my small (300+ classes) projects, that I did for my school/work.
It is general enough so you can draw anything in it, and it even can generate code. | I use dia for this task |
845,199 | I would like to know what guys are using to make diagram of your application/service architecture ?
I would like to make diagrams representing the different layer of the whole application and for some parts go deeper (class level) | 2009/05/10 | [
"https://Stackoverflow.com/questions/845199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27820/"
] | it's not really to make uml diagrams but more "general diagram" of the whole architecture of an application (which is more like a service compound of several application) | we use Dabbleboard. It's great for remote team members. just give them a url and it updates on the fly.
here is a link to one of our diagrams
<http://dabbleboard.com/draw?b=135471&i=7&c=7b1781adc4a54887d5d414378575b890e38469de> |
845,199 | I would like to know what guys are using to make diagram of your application/service architecture ?
I would like to make diagrams representing the different layer of the whole application and for some parts go deeper (class level) | 2009/05/10 | [
"https://Stackoverflow.com/questions/845199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27820/"
] | What specific approach are you using? Lucidchart is great for UML schemas. No plugin or download needed. | I use [inkscape](http://www.inkscape.org/) to visualize class interactions and architecture. It's a general purpose SVG editor, so you're free to be more creative and expressive in your diagrams than with Dia or Visio (both of which I've used).
The learning curve is gentle, it provides everything I've ever needed for ... |
845,199 | I would like to know what guys are using to make diagram of your application/service architecture ?
I would like to make diagrams representing the different layer of the whole application and for some parts go deeper (class level) | 2009/05/10 | [
"https://Stackoverflow.com/questions/845199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27820/"
] | [Visio](http://visiotoolbox.com/en-us/Buynow.aspx?utm_source=google&utm_medium=cpc&utm_term=Visio&utm_content=textads&utm_campaign=Search_Visio_US&gclid=CKLJpLnqsZoCFSbxDAodyBv-bQ) | it's not really to make uml diagrams but more "general diagram" of the whole architecture of an application (which is more like a service compound of several application) |
845,199 | I would like to know what guys are using to make diagram of your application/service architecture ?
I would like to make diagrams representing the different layer of the whole application and for some parts go deeper (class level) | 2009/05/10 | [
"https://Stackoverflow.com/questions/845199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27820/"
] | There are a [lot of UML tools](http://en.wikipedia.org/wiki/List_of_UML_tools) that can be used to draw [UML diagrams](http://en.wikipedia.org/wiki/Unified_Modeling_Language). Some of them can also generate skeleton code etc but you don't have to bother with that if you don't want to.
Here's a couple of open source um... | There are many different modeling tools out there, I just discovered ArgoUML [<http://argouml.tigris.org]> which you might want to check out. |
845,199 | I would like to know what guys are using to make diagram of your application/service architecture ?
I would like to make diagrams representing the different layer of the whole application and for some parts go deeper (class level) | 2009/05/10 | [
"https://Stackoverflow.com/questions/845199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27820/"
] | There are a [lot of UML tools](http://en.wikipedia.org/wiki/List_of_UML_tools) that can be used to draw [UML diagrams](http://en.wikipedia.org/wiki/Unified_Modeling_Language). Some of them can also generate skeleton code etc but you don't have to bother with that if you don't want to.
Here's a couple of open source um... | You can also use [ARIS Express](http://www.ariscommunity.com/aris-express), which is free-of-charge. For example, you can use a system landscape model to describe your application architecture. Another interesting diagram might be IT infrastructure model, where you can describe the deployment of your application. Or yo... |
2,812,784 | We are creating a "widget" for our site and wanted to ensure we have got this right.
I realize this all relates to X-Browser permissions but little worried about how this works with like Cookies and permissions ? | 2010/05/11 | [
"https://Stackoverflow.com/questions/2812784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338523/"
] | You should take a look at [easyXDM](http://easyxdm.net/wp/), its a library that provides cross-domain communication, for instance between the parent page and the widget. One of the more advanced examples can be found at <http://consumer.easyxdm.net/current/example/methods.html>
As easyXDM supports context, you can eas... | Cookies are tied to the domain, so any code in the parent will be unable to read cookies set in the site contained within the iframe I'm afraid. |
28,597 | I am doing a project in my '06 Ridgeline where I am taking out the iPod / Aux add-on and putting in a Bluetooth / Aux add-on at the back of the radio. In the process I will be removing the left cigarette lighter and replacing it was a USB and Aux port.
I've also been thinking about putting in some USB ports for chargi... | 2016/04/20 | [
"https://mechanics.stackexchange.com/questions/28597",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/16600/"
] | The power socket has a simple two cavity connector. It will most likely have #2 female spade connectors. Connect a new device with male spade connectors after first verifying polarity. I would not look for a matching connector, finding one is unlikely. I just take them apart and make a plan.
Drawing of power connecto... | You could just strip, solder and heatshrink the relevant cables together - should just be two, I'd guess. Quicker, easier, and less likely to break than trying to match the plug on the back of the 12v outlet. If you don't feel confident doing it yourself, an autoelectrician wouldn't take longer than 15minutes if the ca... |
28,597 | I am doing a project in my '06 Ridgeline where I am taking out the iPod / Aux add-on and putting in a Bluetooth / Aux add-on at the back of the radio. In the process I will be removing the left cigarette lighter and replacing it was a USB and Aux port.
I've also been thinking about putting in some USB ports for chargi... | 2016/04/20 | [
"https://mechanics.stackexchange.com/questions/28597",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/16600/"
] | You could just strip, solder and heatshrink the relevant cables together - should just be two, I'd guess. Quicker, easier, and less likely to break than trying to match the plug on the back of the 12v outlet. If you don't feel confident doing it yourself, an autoelectrician wouldn't take longer than 15minutes if the ca... | As stated before by Pete, I'd also recommend cutting or splicing the existing wires and adding your connections there. It'd be a lot easier and at times cheaper to do this as well.
I've done multiple mods on many cars, and have done this method and not one has failed. As long as you do your testing in Phases, e.g. con... |
28,597 | I am doing a project in my '06 Ridgeline where I am taking out the iPod / Aux add-on and putting in a Bluetooth / Aux add-on at the back of the radio. In the process I will be removing the left cigarette lighter and replacing it was a USB and Aux port.
I've also been thinking about putting in some USB ports for chargi... | 2016/04/20 | [
"https://mechanics.stackexchange.com/questions/28597",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/16600/"
] | The power socket has a simple two cavity connector. It will most likely have #2 female spade connectors. Connect a new device with male spade connectors after first verifying polarity. I would not look for a matching connector, finding one is unlikely. I just take them apart and make a plan.
Drawing of power connecto... | As stated before by Pete, I'd also recommend cutting or splicing the existing wires and adding your connections there. It'd be a lot easier and at times cheaper to do this as well.
I've done multiple mods on many cars, and have done this method and not one has failed. As long as you do your testing in Phases, e.g. con... |
28,597 | I am doing a project in my '06 Ridgeline where I am taking out the iPod / Aux add-on and putting in a Bluetooth / Aux add-on at the back of the radio. In the process I will be removing the left cigarette lighter and replacing it was a USB and Aux port.
I've also been thinking about putting in some USB ports for chargi... | 2016/04/20 | [
"https://mechanics.stackexchange.com/questions/28597",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/16600/"
] | The power socket has a simple two cavity connector. It will most likely have #2 female spade connectors. Connect a new device with male spade connectors after first verifying polarity. I would not look for a matching connector, finding one is unlikely. I just take them apart and make a plan.
Drawing of power connecto... | Finally finished the project. I made a power cable using this part from Digikey and its working great.
<http://www.digikey.com/product-detail/en/42474-3/A27885CT-ND/456871?WT.v_sub=1717195&WT.mc_id=em_TEA1605A.US.Send&WT.z_email=7020_TEA1605A00US_tepurchasedpart&mkt_tok=eyJpIjoiWlROa05EYzRZVGMyTmpabSIsInQiOiJmUkFZeTlh... |
28,597 | I am doing a project in my '06 Ridgeline where I am taking out the iPod / Aux add-on and putting in a Bluetooth / Aux add-on at the back of the radio. In the process I will be removing the left cigarette lighter and replacing it was a USB and Aux port.
I've also been thinking about putting in some USB ports for chargi... | 2016/04/20 | [
"https://mechanics.stackexchange.com/questions/28597",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/16600/"
] | Finally finished the project. I made a power cable using this part from Digikey and its working great.
<http://www.digikey.com/product-detail/en/42474-3/A27885CT-ND/456871?WT.v_sub=1717195&WT.mc_id=em_TEA1605A.US.Send&WT.z_email=7020_TEA1605A00US_tepurchasedpart&mkt_tok=eyJpIjoiWlROa05EYzRZVGMyTmpabSIsInQiOiJmUkFZeTlh... | As stated before by Pete, I'd also recommend cutting or splicing the existing wires and adding your connections there. It'd be a lot easier and at times cheaper to do this as well.
I've done multiple mods on many cars, and have done this method and not one has failed. As long as you do your testing in Phases, e.g. con... |
96,602 | I have Ubuntu 12.04 LTS and Windows 7 Home Premium on my laptop. My desire is to uninstall Ubuntu without spoiling MBR and Windows 7.
I would like to emphasize that Ubuntu was installed later so I select the OS in GRUB. I would also like to uninstall GRUB. How can I do so in a painless and simple manner? | 2013/10/18 | [
"https://unix.stackexchange.com/questions/96602",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/49442/"
] | I would do something like the following steps if I were you:
1. Backup any valuable data on your Ubuntu system
2. Boot into a Windows 7 installation disc
3. Repair your system by overwriting the MBR (Master Boot Record)
4. Boot into Windows 7
5. Format the Ubuntu partition(s)
By overwriting the MBR and formatting the... | You can use EasyBCD for safely uninstall. |
96,602 | I have Ubuntu 12.04 LTS and Windows 7 Home Premium on my laptop. My desire is to uninstall Ubuntu without spoiling MBR and Windows 7.
I would like to emphasize that Ubuntu was installed later so I select the OS in GRUB. I would also like to uninstall GRUB. How can I do so in a painless and simple manner? | 2013/10/18 | [
"https://unix.stackexchange.com/questions/96602",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/49442/"
] | In Windows you can use ["Dual-boot Repair"](http://www.boyans.net) tool.
Rewrite all partition boot records and MBR.
**Or** from Windows 7 recovery/installation CD/DVD/USB run on command prompt:
**bootsect /nt60 ALL /mbr**
**Or** you could just run "StartUp Repair" from Windows 7 recovery CD.
Eventually you have ... | You can use EasyBCD for safely uninstall. |
12,936,803 | I have a database in SQL Server. I do not have authorization to change any table but I can create views.
I have three `varchar` columns which store dates in the format `YYYYMMDD`. I want to create a view where the dates are converted from `varchar` to `datetime`.
Now it can be the case that instead of a date in thi... | 2012/10/17 | [
"https://Stackoverflow.com/questions/12936803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/675082/"
] | Try this
```
CASE WHEN ISDATE(closedDate) = 1 THEN CONVERT(datetime, closedDate, 112)
ELSE NULL END closedDate
``` | ```
Use below code
SELECT CASE WHEN ISDATE(datecolumn)=1 THEN CONVERT(datetime, datecolumn, 103 )
ELSE null END
FROM tablename
use below for empty data
SELECT CASE WHEN ISDATE(datecolumn)=1 THEN CONVERT(datetime, datecolumn, 103 )
... |
263,200 | I'm trying to skeletonize an image ([ref](https://i.stack.imgur.com/q2xUi.png))
```
img = Import["https://i.stack.imgur.com/q2xUi.png"]
graph= MorphologicalGraph[img]
```
Input image:
[](https://i.stack.imgur.com/q2xUi.png)
Skeleton generated:
[... | 2022/02/07 | [
"https://mathematica.stackexchange.com/questions/263200",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/58343/"
] | You can use `GeneralUtilities`PrintDefinitions` to see what `MorphologicalGraph` is doing. It calls some functions that do
```
vertices = ImageAdd[
MorphologicalTransform[skeleton, "SkeletonEndPoints", Padding -> 0],
MorphologicalTransform[skeleton, "SkeletonBranchPoints", Padding -> 0]
```
to find vertices.... | This seems to be a work-around (at best), as it appears to give what was expected that `MorphologicalGraph` would give.
```
img = Import["https://i.stack.imgur.com/q2xUi.png"]
```
giving
[](https://i.stack.imgur.com/LtRht.jpg)
Then we proceed to do
```
ColorNegate@Th... |
58,686,923 | I use blazor with .net core 3.0 to develop a website that allow to pass some parameters in URL.
The problem is whenever I pass a Vietnamese keyword in the URL, the blazor throw an inner exception that appears on Browser console.
**Please be aware of that** I cannot use `Encode URL` to extract that information since t... | 2019/11/04 | [
"https://Stackoverflow.com/questions/58686923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8012407/"
] | >
> I have to encode and decode every time
>
>
>
Not sure whether it is a bug. However, you don't have to encode and decode every time. As a walkaround, we can create a quick and dirty fix so that the `space` within the querystring is converted to `+`.
Since this error happens when invoking remote signalR [`Compo... | First things first: This is nothing Blazor specific
You are simply using an URI which is not valid. Each character used in an URI must have a corresponding characters via US-ASCII table.
Blazor is just calling `Uri.IsWellFormedUriString` which returns false for your given example.
As others have pointed out the solu... |
51,508,549 | I just bumped into somewhat strange behavior while doing my RESTful Eve project
For this step i have to add some data to eve's db.
I wanted to use python's requests module to make a POST with data I have to save
Here is what I'm sending (`author` is a variable that contains some data):
```
data = {"author_id": auth... | 2018/07/24 | [
"https://Stackoverflow.com/questions/51508549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5763118/"
] | If possible, I'd recommend using `Promise.all` instead, it'll make your script run faster in addition to making the logic clearer:
```
const getData = Promise.all([
knex.select('column1').from('table1').where('column1', '1')
// Simply pass the function name as a parameter to the `.then`:
.then(handleData)
... | `knex.select().then()` returns a promise, so you don't need to wrap it in another promise you just need to set up the chain of `then()`s and return the whole thing. The result will be that `getData` returns the promise from the last then. You can return the value you want from that `then()` which will make it available... |
66,747,875 | My question is related to [Block mean of numpy 2D array](https://stackoverflow.com/questions/14229029/block-mean-of-numpy-2d-array) and [block mean of 2D numpy array (in both dimensions)](https://stackoverflow.com/questions/66160734/block-mean-of-2d-numpy-array-in-both-dimensions) (in fact it is just more general case)... | 2021/03/22 | [
"https://Stackoverflow.com/questions/66747875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12542316/"
] | If you are open to other packages, `Pandas` as a convenient `groupby` function:
```
out = (pd.Series(a.ravel(),
index = pd.MultiIndex.from_product((pairs,pairs)))
.groupby(level=(0,1)).mean()
.unstack().to_numpy()
)
```
Output:
```
array([[5.25 , 5. , 3.5 ... | The best I can imagine is to try to limit the number of loops. I will assume here that the 6x6 2D array is `arr` and that the communities definition is `coms = np.array([0, 0, 1, 1, 1, 2])`.
I would first compute slices per community:
```
dcoms = {k: slice(min(x), 1 + max(x)) for k in np.unique(coms)
for x i... |
66,747,875 | My question is related to [Block mean of numpy 2D array](https://stackoverflow.com/questions/14229029/block-mean-of-numpy-2d-array) and [block mean of 2D numpy array (in both dimensions)](https://stackoverflow.com/questions/66160734/block-mean-of-2d-numpy-array-in-both-dimensions) (in fact it is just more general case)... | 2021/03/22 | [
"https://Stackoverflow.com/questions/66747875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12542316/"
] | If you are open to other packages, `Pandas` as a convenient `groupby` function:
```
out = (pd.Series(a.ravel(),
index = pd.MultiIndex.from_product((pairs,pairs)))
.groupby(level=(0,1)).mean()
.unstack().to_numpy()
)
```
Output:
```
array([[5.25 , 5. , 3.5 ... | Thanks guys, I performed some benchmark tests to compare these solutions.
The setup is following
```py
np.random.seed(0)
mat = (np.random.random((500, 500)) - 0.5) * 100
# Create 5 communities of size 50 and 10 communities of size 15
comms = np.concatenate((np.repeat(np.arange(5), 50), np.repeat(np.arange(5, 15), 2... |
28,526,694 | When the ball collides with the cup, the score should increase by 1. However it currently increases by 1, 3 or sometimes 4 which means the collision is being detected multiple times.
I think I must be checking for collisions incorrectly:
```
let ballCategory : UInt32 = 0x1 << 0
let cupCategory : UInt32 = 0x1 << 1... | 2015/02/15 | [
"https://Stackoverflow.com/questions/28526694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4371019/"
] | You can set one BOOL value to check if is allowed contact handling(set YES at the beginning). After updating score, you can set that variable to NO, then run moveBall() to start again and at the end of moveBall() method set BOOL value to YES. I think something like that should work.
Other way would be to remove ball/o... | this happened to me, what to do is simple, just define everything like this each node needs one:
first make this for the nodes, either if its a screen border or what ever node it hits, say this:
```
let nodesCatergory : UInt32 = 0x1 << 1
```
after, put this nodesCatergory to everynode you have in game, or the nodes... |
15,855 | So far I was thinking the way of saying "He spends time in writing letters" ([example from A&G](http://dcc.dickinson.edu/grammar/latin/gerund-and-gerundive)) might be *terit tempus **scribendo epistulas*** or *terit tempus **scribendis epistulis***.
But can *terit tempus **scribendo epistularum*** also convey the same... | 2021/04/22 | [
"https://latin.stackexchange.com/questions/15855",
"https://latin.stackexchange.com",
"https://latin.stackexchange.com/users/4796/"
] | I would not read the genitive and the gerund together.
I suggest this reordering and grouping to clarify:
>
> *…(plus operae) poneremus (in agendo) quam (in scribendo)…*
>
> ≈ …we would put more work into doing than writing…
>
>
>
I see *operae* as a genitive qualifying *plus*.
---
You could conceivably read... | No, this construction is impossible because it has nominal syntax (*hoc domūs tēctum* "this house roof") like the English gerund, while the Latin gerund has verbal syntax (not \**in hōc scrībendō* "in this writing") and governs the same case as the verb (not \**epistolārum scrībere* "to write of-letters"). With verbs [... |
15,855 | So far I was thinking the way of saying "He spends time in writing letters" ([example from A&G](http://dcc.dickinson.edu/grammar/latin/gerund-and-gerundive)) might be *terit tempus **scribendo epistulas*** or *terit tempus **scribendis epistulis***.
But can *terit tempus **scribendo epistularum*** also convey the same... | 2021/04/22 | [
"https://latin.stackexchange.com/questions/15855",
"https://latin.stackexchange.com",
"https://latin.stackexchange.com/users/4796/"
] | I would not read the genitive and the gerund together.
I suggest this reordering and grouping to clarify:
>
> *…(plus operae) poneremus (in agendo) quam (in scribendo)…*
>
> ≈ …we would put more work into doing than writing…
>
>
>
I see *operae* as a genitive qualifying *plus*.
---
You could conceivably read... | I group the words in the Cicero passage this way:
>
> (in agendo plus quam in scribendo) (operae poneremus)
>
>
>
This makes *operae* some sort of object of *poneremus*—I can't tell if it's dative or genitive. Some googling suggests that *aliquid operae pono* is an idiom for "I put effort into something."
Loeb C... |
15,855 | So far I was thinking the way of saying "He spends time in writing letters" ([example from A&G](http://dcc.dickinson.edu/grammar/latin/gerund-and-gerundive)) might be *terit tempus **scribendo epistulas*** or *terit tempus **scribendis epistulis***.
But can *terit tempus **scribendo epistularum*** also convey the same... | 2021/04/22 | [
"https://latin.stackexchange.com/questions/15855",
"https://latin.stackexchange.com",
"https://latin.stackexchange.com/users/4796/"
] | As pointed out in the previous answers, it seems quite clear that *plus...operae* is an argument of the verb *poneremus*. I found that some philologists corrected the text as follows: *in agendo plus quam in scribendo **operam** poneremus* (e.g. see [here](https://books.google.es/books?id=XPLfAAAAMAAJ&pg=PA143&lpg=PA14... | No, this construction is impossible because it has nominal syntax (*hoc domūs tēctum* "this house roof") like the English gerund, while the Latin gerund has verbal syntax (not \**in hōc scrībendō* "in this writing") and governs the same case as the verb (not \**epistolārum scrībere* "to write of-letters"). With verbs [... |
15,855 | So far I was thinking the way of saying "He spends time in writing letters" ([example from A&G](http://dcc.dickinson.edu/grammar/latin/gerund-and-gerundive)) might be *terit tempus **scribendo epistulas*** or *terit tempus **scribendis epistulis***.
But can *terit tempus **scribendo epistularum*** also convey the same... | 2021/04/22 | [
"https://latin.stackexchange.com/questions/15855",
"https://latin.stackexchange.com",
"https://latin.stackexchange.com/users/4796/"
] | As pointed out in the previous answers, it seems quite clear that *plus...operae* is an argument of the verb *poneremus*. I found that some philologists corrected the text as follows: *in agendo plus quam in scribendo **operam** poneremus* (e.g. see [here](https://books.google.es/books?id=XPLfAAAAMAAJ&pg=PA143&lpg=PA14... | I group the words in the Cicero passage this way:
>
> (in agendo plus quam in scribendo) (operae poneremus)
>
>
>
This makes *operae* some sort of object of *poneremus*—I can't tell if it's dative or genitive. Some googling suggests that *aliquid operae pono* is an idiom for "I put effort into something."
Loeb C... |
13,942,583 | I'm wondering if there is a simple way to self initialize a backbone view. It's probably best I show an example of what I'm looking to do.
Currently the default way to initialize a backbone view is as follows:
```
var BBview = Backbone.View.extend({});
var myView = new BBview();
```
For name-spacing reasons I'd l... | 2012/12/18 | [
"https://Stackoverflow.com/questions/13942583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1429463/"
] | `Backbone.View.extend()` returns a constructor function so you can call `new` on it. The only tricky part is getting the precedence correct so that `extend` sees the arguments in its parentheses rather than `new` seeing them as arguments to the constructor:
```
var v = new (Backbone.View.extend({ ... }));
```
Demo: ... | Just initialize the backbone view directly with the `new` operator:
```
var myView = new Backbone.View();
```
Or by using extend:
```
var myView = new (Backbone.View.extend({
initialize : function() { console.log('init'); }
}));
``` |
12,455,215 | I want to set up a identity-provider in my application.
I saw a SAML toolkit for PHP from OneLogin.com (http://support.onelogin.com/entries/268420-saml-toolkit-for-php). How can I use it for setting up a identity provider in my machine?
I felt that we can use it for setting up a service-provider not identity-provider.... | 2012/09/17 | [
"https://Stackoverflow.com/questions/12455215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/739331/"
] | This toolkit is for use with OneLogin as an identity provider.
If you want to set up an identity provider locally that is not OneLogin, you should find some other software that will do this. | If it can help you... There's a GPL licensed library implementing SAML IDP in PHP <https://github.com/lightSAML/lightSAML-IDP> but it's in early beta. |
68,622,170 | I am using kubernetes cluster provided from infra team(not minikube), I have created traefik ingress controller with all the configuration, ingress container, our applications are running in the cluster. now i want to access the application using domain name or ip address, for this, i have created a Ingress resource as... | 2021/08/02 | [
"https://Stackoverflow.com/questions/68622170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1234915/"
] | If you using any Load balancer behind the ingress or any ingress controller with a load Balancer you have to use the Load balancer IP everywhere.
So you have to map the `Loadbalancer IP` into the `DNS` for `dummy.domain.com`, or else if you are not using the load balancer you have to use the Master IP.
You are testin... | The Ingress object configures the ingress controller to route any request for **dummy.domain.com** to the application you just deployed. You will need to update the **/etc/hosts** file on your host machine to map **dummy.domain.com** to the ingress controller VM’s IP address for example 2192.168.50.212, this address is... |
68,622,170 | I am using kubernetes cluster provided from infra team(not minikube), I have created traefik ingress controller with all the configuration, ingress container, our applications are running in the cluster. now i want to access the application using domain name or ip address, for this, i have created a Ingress resource as... | 2021/08/02 | [
"https://Stackoverflow.com/questions/68622170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1234915/"
] | The Ingress object configures the ingress controller to route any request for **dummy.domain.com** to the application you just deployed. You will need to update the **/etc/hosts** file on your host machine to map **dummy.domain.com** to the ingress controller VM’s IP address for example 2192.168.50.212, this address is... | I was able to solve this issue by requesting new domain name(dns entry) from Infra team, for this domain name i have mapped the Master nodes Ip address of the cluster, we have 3 manager nodes, so i have mapped the domain name(dummy.domain.com) with 3 manger nodes Ip address.
After this i was able to access the applica... |
68,622,170 | I am using kubernetes cluster provided from infra team(not minikube), I have created traefik ingress controller with all the configuration, ingress container, our applications are running in the cluster. now i want to access the application using domain name or ip address, for this, i have created a Ingress resource as... | 2021/08/02 | [
"https://Stackoverflow.com/questions/68622170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1234915/"
] | If you using any Load balancer behind the ingress or any ingress controller with a load Balancer you have to use the Load balancer IP everywhere.
So you have to map the `Loadbalancer IP` into the `DNS` for `dummy.domain.com`, or else if you are not using the load balancer you have to use the Master IP.
You are testin... | I was able to solve this issue by requesting new domain name(dns entry) from Infra team, for this domain name i have mapped the Master nodes Ip address of the cluster, we have 3 manager nodes, so i have mapped the domain name(dummy.domain.com) with 3 manger nodes Ip address.
After this i was able to access the applica... |
13,684,525 | I am not able to access both the Source control in Visual Studio 2010 as in 2012 when I try to access this error is shown: "TF14045: The identity is not a Recognized identity". This error started after I detach the project collection from TFS 2010 and attach on Team Foundation Server 2012, anyone knows how to fix this? | 2012/12/03 | [
"https://Stackoverflow.com/questions/13684525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1872696/"
] | OK, I have now fixed the same problem with Chrome v75.0 when having an element and its child tags (p, img) with
```
backface-visibility: hidden;
```
Chrome displays only the content of the children.
I use a jQuery plugin to flip some content. I fixed it by using
```
.not('p, img, br, strong')
```
to avoid to ad... | I had the same issue, where "-webkit-backface-visibility: hidden" was actually needed and what worked for me was to first set it to "visible" and then "hidden".
```
-webkit-backface-visibility: visible;
-webkit-backface-visibility: hidden;
```
I hope that this will help you. |
13,684,525 | I am not able to access both the Source control in Visual Studio 2010 as in 2012 when I try to access this error is shown: "TF14045: The identity is not a Recognized identity". This error started after I detach the project collection from TFS 2010 and attach on Team Foundation Server 2012, anyone knows how to fix this? | 2012/12/03 | [
"https://Stackoverflow.com/questions/13684525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1872696/"
] | OK, I have now fixed the same problem with Chrome v75.0 when having an element and its child tags (p, img) with
```
backface-visibility: hidden;
```
Chrome displays only the content of the children.
I use a jQuery plugin to flip some content. I fixed it by using
```
.not('p, img, br, strong')
```
to avoid to ad... | If you're facing similar issue try adding following styles:
`-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);` |
21,380,446 | I need to get data from `HttpContext` collections and store it in one `Dictionary`, but I have a problem. How can I rewrite `KeyValuePair` in `Dictionary` if I meet pair with key which `Dictionary` already has?
For example, my function:
```
private static IDictionary<string, object> FromNameValueCollection(NameValueC... | 2014/01/27 | [
"https://Stackoverflow.com/questions/21380446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3223977/"
] | Simple... don't use a Dictionary, and instead consider making an [ILookup](http://msdn.microsoft.com/en-us/library/bb534291%28v=vs.110%29.aspx) instead. It's pretty much the same as a Dictionary other than it allows for the storing of multiple values against a key. So...
```
(from string query in rq
select new Key... | You need to override Equals and GetHashCode on your class KeyAndValue because the Dictionary will compare references and not the values that you wish to. |
69,791,042 | I am new to Java; so also postgresql I am using for the backend.
I want to hash user password and save in the database using sha-256
Next time the user visits, I want to compare the password user submitted with the saved hashpassword, "at the java end".
I have tried this (I got from the internet):
```
private static S... | 2021/10/31 | [
"https://Stackoverflow.com/questions/69791042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9087451/"
] | Your code looks fine (well, be aware that you are using SHA-512 not SHA-256 as the question suggest) but please, take into account that you need to store the salt as well as the obtained hash in the database in order to validate the user password later.
Salts are used in hashes as a way to protect against password ide... | You've two options to pass validation:
1. Use a constant value for salt.
2. Use a dynamic value for salt but maintain a logic where the value of salt is the same for both password1 (The user's password in db) and password2 (The password to compare with). |
69,791,042 | I am new to Java; so also postgresql I am using for the backend.
I want to hash user password and save in the database using sha-256
Next time the user visits, I want to compare the password user submitted with the saved hashpassword, "at the java end".
I have tried this (I got from the internet):
```
private static S... | 2021/10/31 | [
"https://Stackoverflow.com/questions/69791042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9087451/"
] | >
> I want to hash user password and save in the database using sha-256
>
>
>
Why? This is not industry standard. It is in fact an industry non-standard: A known bad thing. SHA-256 is optimized to run a few billion a second. There is active pressure on creating cheap rigs that can go as fast as possible what with ... | You've two options to pass validation:
1. Use a constant value for salt.
2. Use a dynamic value for salt but maintain a logic where the value of salt is the same for both password1 (The user's password in db) and password2 (The password to compare with). |
48,885,930 | I'd like to count specific things from a file, i.e. how many times `"--undefined--"` appears. Here is a piece of the file's content:
```
"jo:ns 76.434
pRE 75.417
zi: 75.178
dEnt --undefined--
ba --undefined--
```
I tried to use something like this. But it won't work:
```
with open("v3.txt", 'r') a... | 2018/02/20 | [
"https://Stackoverflow.com/questions/48885930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6546783/"
] | `readlines()` returns the list of lines, but they are not stripped (ie. they contain the newline character).
Either strip them first:
```
data = [line.strip() for line in data]
```
or check for `--undefined--\n`:
```
if line.endswith("--undefined--\n"):
```
Alternatively, consider string's `.count()` method:
```... | Or don't limit yourself to `.endswith()`, use the `in` operator.
```
data = ''
count = 0
with open('v3.txt', 'r') as infile:
data = infile.readlines()
print(data)
for line in data:
if '--undefined--' in line:
count += 1
count
``` |
48,885,930 | I'd like to count specific things from a file, i.e. how many times `"--undefined--"` appears. Here is a piece of the file's content:
```
"jo:ns 76.434
pRE 75.417
zi: 75.178
dEnt --undefined--
ba --undefined--
```
I tried to use something like this. But it won't work:
```
with open("v3.txt", 'r') a... | 2018/02/20 | [
"https://Stackoverflow.com/questions/48885930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6546783/"
] | `readlines()` returns the list of lines, but they are not stripped (ie. they contain the newline character).
Either strip them first:
```
data = [line.strip() for line in data]
```
or check for `--undefined--\n`:
```
if line.endswith("--undefined--\n"):
```
Alternatively, consider string's `.count()` method:
```... | Quoting Raymond Hettinger, "There must be a better way":
```
from collections import Counter
counter = Counter()
words = ('--undefined--', 'otherword', 'onemore')
with open("v3.txt", 'r') as f:
lines = f.readlines()
for line in lines:
for word in words:
if word in line:
c... |
48,885,930 | I'd like to count specific things from a file, i.e. how many times `"--undefined--"` appears. Here is a piece of the file's content:
```
"jo:ns 76.434
pRE 75.417
zi: 75.178
dEnt --undefined--
ba --undefined--
```
I tried to use something like this. But it won't work:
```
with open("v3.txt", 'r') a... | 2018/02/20 | [
"https://Stackoverflow.com/questions/48885930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6546783/"
] | `readlines()` returns the list of lines, but they are not stripped (ie. they contain the newline character).
Either strip them first:
```
data = [line.strip() for line in data]
```
or check for `--undefined--\n`:
```
if line.endswith("--undefined--\n"):
```
Alternatively, consider string's `.count()` method:
```... | When reading a file line by line, each line ends with the newline character:
```
>>> with open("blookcore/models.py") as f:
... lines = f.readlines()
...
>>> lines[0]
'# -*- coding: utf-8 -*-\n'
>>>
```
so your `endswith()` test just can't work - you have to strip the line first:
```
if i.strip().endswith("--u... |
48,885,930 | I'd like to count specific things from a file, i.e. how many times `"--undefined--"` appears. Here is a piece of the file's content:
```
"jo:ns 76.434
pRE 75.417
zi: 75.178
dEnt --undefined--
ba --undefined--
```
I tried to use something like this. But it won't work:
```
with open("v3.txt", 'r') a... | 2018/02/20 | [
"https://Stackoverflow.com/questions/48885930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6546783/"
] | you can read all the data in one string and split the string in a list, and count occurrences of the substring in that list.
```
with open('afile.txt', 'r') as myfile:
data=myfile.read().replace('\n', ' ')
data.split(' ').count("--undefined--")
```
or directly from the string :
```
data.count("--undefined--")
... | Or don't limit yourself to `.endswith()`, use the `in` operator.
```
data = ''
count = 0
with open('v3.txt', 'r') as infile:
data = infile.readlines()
print(data)
for line in data:
if '--undefined--' in line:
count += 1
count
``` |
48,885,930 | I'd like to count specific things from a file, i.e. how many times `"--undefined--"` appears. Here is a piece of the file's content:
```
"jo:ns 76.434
pRE 75.417
zi: 75.178
dEnt --undefined--
ba --undefined--
```
I tried to use something like this. But it won't work:
```
with open("v3.txt", 'r') a... | 2018/02/20 | [
"https://Stackoverflow.com/questions/48885930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6546783/"
] | you can read all the data in one string and split the string in a list, and count occurrences of the substring in that list.
```
with open('afile.txt', 'r') as myfile:
data=myfile.read().replace('\n', ' ')
data.split(' ').count("--undefined--")
```
or directly from the string :
```
data.count("--undefined--")
... | Quoting Raymond Hettinger, "There must be a better way":
```
from collections import Counter
counter = Counter()
words = ('--undefined--', 'otherword', 'onemore')
with open("v3.txt", 'r') as f:
lines = f.readlines()
for line in lines:
for word in words:
if word in line:
c... |
48,885,930 | I'd like to count specific things from a file, i.e. how many times `"--undefined--"` appears. Here is a piece of the file's content:
```
"jo:ns 76.434
pRE 75.417
zi: 75.178
dEnt --undefined--
ba --undefined--
```
I tried to use something like this. But it won't work:
```
with open("v3.txt", 'r') a... | 2018/02/20 | [
"https://Stackoverflow.com/questions/48885930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6546783/"
] | you can read all the data in one string and split the string in a list, and count occurrences of the substring in that list.
```
with open('afile.txt', 'r') as myfile:
data=myfile.read().replace('\n', ' ')
data.split(' ').count("--undefined--")
```
or directly from the string :
```
data.count("--undefined--")
... | When reading a file line by line, each line ends with the newline character:
```
>>> with open("blookcore/models.py") as f:
... lines = f.readlines()
...
>>> lines[0]
'# -*- coding: utf-8 -*-\n'
>>>
```
so your `endswith()` test just can't work - you have to strip the line first:
```
if i.strip().endswith("--u... |
70,707 | I want to use a hash function to generate a random sequence from number 0-n. And so I would like to find a good function that results in values that are seemingly random (does not need to be secure), but gives a sequence that is uniformly distributed.
Can I look at a function that has the property of high collision re... | 2019/05/21 | [
"https://crypto.stackexchange.com/questions/70707",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/61897/"
] | Define $H(x) = \operatorname{SHA-256}(x) \mathbin\| 1$; that is, append a single 1 bit to SHA-256. Can you find a collision under $H$? Does $H$ have anything resembling uniform distribution?
This counterexample is not merely pathological; designs like [Rumba20](https://cr.yp.to/papers.html#expandxor "Daniel J. Bernste... | No, but high collision resistance per bit has an influence.
Non-uniformity -> less entropy -> weakned collision resistance.
As keysize is significant factor: *most* cryptographic hash functions have uniform output given entropic input. Using a hash (or encryption) routine to make a stream of random numbers from a sing... |
70,707 | I want to use a hash function to generate a random sequence from number 0-n. And so I would like to find a good function that results in values that are seemingly random (does not need to be secure), but gives a sequence that is uniformly distributed.
Can I look at a function that has the property of high collision re... | 2019/05/21 | [
"https://crypto.stackexchange.com/questions/70707",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/61897/"
] | Define $H(x) = \operatorname{SHA-256}(x) \mathbin\| 1$; that is, append a single 1 bit to SHA-256. Can you find a collision under $H$? Does $H$ have anything resembling uniform distribution?
This counterexample is not merely pathological; designs like [Rumba20](https://cr.yp.to/papers.html#expandxor "Daniel J. Bernste... | Only my 2 cents, **you don't necessarily need an (heavy) hash function** to generate a sequence or a series of pseudo-random numbers.
A **practical, low-level way, to generate an uniform distribution** of values, in a specific range, could be to **use a simple acceptance/rejection method**, combined with pseudo-random... |
70,707 | I want to use a hash function to generate a random sequence from number 0-n. And so I would like to find a good function that results in values that are seemingly random (does not need to be secure), but gives a sequence that is uniformly distributed.
Can I look at a function that has the property of high collision re... | 2019/05/21 | [
"https://crypto.stackexchange.com/questions/70707",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/61897/"
] | Define $H(x) = \operatorname{SHA-256}(x) \mathbin\| 1$; that is, append a single 1 bit to SHA-256. Can you find a collision under $H$? Does $H$ have anything resembling uniform distribution?
This counterexample is not merely pathological; designs like [Rumba20](https://cr.yp.to/papers.html#expandxor "Daniel J. Bernste... | It does not follow from the definition of a [cryptographic hash function](https://en.wikipedia.org/wiki/Cryptographic_hash_function) that its output would be uniformly random. However, this is the case for the hash functions used in practice.
A common assumption when reasoning about hash functions is that they are ind... |
70,707 | I want to use a hash function to generate a random sequence from number 0-n. And so I would like to find a good function that results in values that are seemingly random (does not need to be secure), but gives a sequence that is uniformly distributed.
Can I look at a function that has the property of high collision re... | 2019/05/21 | [
"https://crypto.stackexchange.com/questions/70707",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/61897/"
] | No, but high collision resistance per bit has an influence.
Non-uniformity -> less entropy -> weakned collision resistance.
As keysize is significant factor: *most* cryptographic hash functions have uniform output given entropic input. Using a hash (or encryption) routine to make a stream of random numbers from a sing... | Only my 2 cents, **you don't necessarily need an (heavy) hash function** to generate a sequence or a series of pseudo-random numbers.
A **practical, low-level way, to generate an uniform distribution** of values, in a specific range, could be to **use a simple acceptance/rejection method**, combined with pseudo-random... |
70,707 | I want to use a hash function to generate a random sequence from number 0-n. And so I would like to find a good function that results in values that are seemingly random (does not need to be secure), but gives a sequence that is uniformly distributed.
Can I look at a function that has the property of high collision re... | 2019/05/21 | [
"https://crypto.stackexchange.com/questions/70707",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/61897/"
] | It does not follow from the definition of a [cryptographic hash function](https://en.wikipedia.org/wiki/Cryptographic_hash_function) that its output would be uniformly random. However, this is the case for the hash functions used in practice.
A common assumption when reasoning about hash functions is that they are ind... | No, but high collision resistance per bit has an influence.
Non-uniformity -> less entropy -> weakned collision resistance.
As keysize is significant factor: *most* cryptographic hash functions have uniform output given entropic input. Using a hash (or encryption) routine to make a stream of random numbers from a sing... |
70,707 | I want to use a hash function to generate a random sequence from number 0-n. And so I would like to find a good function that results in values that are seemingly random (does not need to be secure), but gives a sequence that is uniformly distributed.
Can I look at a function that has the property of high collision re... | 2019/05/21 | [
"https://crypto.stackexchange.com/questions/70707",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/61897/"
] | It does not follow from the definition of a [cryptographic hash function](https://en.wikipedia.org/wiki/Cryptographic_hash_function) that its output would be uniformly random. However, this is the case for the hash functions used in practice.
A common assumption when reasoning about hash functions is that they are ind... | Only my 2 cents, **you don't necessarily need an (heavy) hash function** to generate a sequence or a series of pseudo-random numbers.
A **practical, low-level way, to generate an uniform distribution** of values, in a specific range, could be to **use a simple acceptance/rejection method**, combined with pseudo-random... |
5,686,336 | I have a script called 'git-export' which helps me to export a remote repository. It is run like that:
```
git-export http://host.com/git-repo <-t tag or -b branch or -c commit> /local/dir
```
Before it was used to export local repository and I used these commands:
to get commit from branch:
```
git branch -v --no... | 2011/04/16 | [
"https://Stackoverflow.com/questions/5686336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/676439/"
] | You're looking for [`git ls-remote`](http://www.kernel.org/pub/software/scm/git/docs/git-ls-remote.html). For example:
```
$ git ls-remote git://git.kernel.org/pub/scm/git/git.git
4d8b32a2e1758236c4c1b714f179892e3bce982c HEAD
f75a94048af9e423a3d8cba694531d0d08bd82b4 refs/heads/html
810cae53e0f622d6804f063c04a83d... | You can use curl for checking if the specific url exists or not
for example
when i try to hit angularjs existing url
```
$ curl -I https://github.com/angular/angularjs.org/tree/master/src
**HTTP/1.1 200 OK**
Server: GitHub.com
Date: Mon, 11 Aug 2014 15:22:40 GMT
```
When I hit on a wrong URL
```
$ curl -I https://g... |
22,901,249 | I have a question about how Typescript generates javascript code for simple class inheritance.
Below is some Typescript code followed by the generated javascript code.
Typescript code:
```
class Animal {
constructor(public name: string) { }
move(meters: number) {
alert(this.name + " moved " + meters... | 2014/04/06 | [
"https://Stackoverflow.com/questions/22901249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3487297/"
] | Static properties/functions do not exist on the prototype. The `prototype` is only used when a `new` instance is created.
So, the first loop simply copies static properties (which would include functions). It is not copying anything on the `prototype` (as `for(var v in p)` does not include the `prototype` or propertie... | ```
d[p] = b[p];.
```
it is done that way so b own properties are own properties of d.
>
> My question is why is this copying required, just setting the
> Cat.prototype = \_super;
>
>
>
It might seem like a detail but setting "static" properties on a prototype can have undesirable side effects.
imagine you ha... |
22,901,249 | I have a question about how Typescript generates javascript code for simple class inheritance.
Below is some Typescript code followed by the generated javascript code.
Typescript code:
```
class Animal {
constructor(public name: string) { }
move(meters: number) {
alert(this.name + " moved " + meters... | 2014/04/06 | [
"https://Stackoverflow.com/questions/22901249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3487297/"
] | This is all about *static* properties on the class. Consider some code:
```
class Mammal {
static descriptor = 'mammalian';
constructor() {}
getLegs() {
return 4; // Good for most things
}
}
class OtherMammal extends Mammal {
// Default implementation is OK
}
class Human extends Mammal ... | ```
d[p] = b[p];.
```
it is done that way so b own properties are own properties of d.
>
> My question is why is this copying required, just setting the
> Cat.prototype = \_super;
>
>
>
It might seem like a detail but setting "static" properties on a prototype can have undesirable side effects.
imagine you ha... |
22,901,249 | I have a question about how Typescript generates javascript code for simple class inheritance.
Below is some Typescript code followed by the generated javascript code.
Typescript code:
```
class Animal {
constructor(public name: string) { }
move(meters: number) {
alert(this.name + " moved " + meters... | 2014/04/06 | [
"https://Stackoverflow.com/questions/22901249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3487297/"
] | Static properties/functions do not exist on the prototype. The `prototype` is only used when a `new` instance is created.
So, the first loop simply copies static properties (which would include functions). It is not copying anything on the `prototype` (as `for(var v in p)` does not include the `prototype` or propertie... | I think copying is required because we need to inherit only methods not properties. In the first line we actually create object properties. Prototype keeps only methods. Second line is required to prevent modifying base class prototype by code like this:
```
Cat.prototype.catMethod = function() { /* ... */ }
```
Der... |
22,901,249 | I have a question about how Typescript generates javascript code for simple class inheritance.
Below is some Typescript code followed by the generated javascript code.
Typescript code:
```
class Animal {
constructor(public name: string) { }
move(meters: number) {
alert(this.name + " moved " + meters... | 2014/04/06 | [
"https://Stackoverflow.com/questions/22901249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3487297/"
] | This is all about *static* properties on the class. Consider some code:
```
class Mammal {
static descriptor = 'mammalian';
constructor() {}
getLegs() {
return 4; // Good for most things
}
}
class OtherMammal extends Mammal {
// Default implementation is OK
}
class Human extends Mammal ... | I think copying is required because we need to inherit only methods not properties. In the first line we actually create object properties. Prototype keeps only methods. Second line is required to prevent modifying base class prototype by code like this:
```
Cat.prototype.catMethod = function() { /* ... */ }
```
Der... |
22,901,249 | I have a question about how Typescript generates javascript code for simple class inheritance.
Below is some Typescript code followed by the generated javascript code.
Typescript code:
```
class Animal {
constructor(public name: string) { }
move(meters: number) {
alert(this.name + " moved " + meters... | 2014/04/06 | [
"https://Stackoverflow.com/questions/22901249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3487297/"
] | Static properties/functions do not exist on the prototype. The `prototype` is only used when a `new` instance is created.
So, the first loop simply copies static properties (which would include functions). It is not copying anything on the `prototype` (as `for(var v in p)` does not include the `prototype` or propertie... | This is all about *static* properties on the class. Consider some code:
```
class Mammal {
static descriptor = 'mammalian';
constructor() {}
getLegs() {
return 4; // Good for most things
}
}
class OtherMammal extends Mammal {
// Default implementation is OK
}
class Human extends Mammal ... |
216,582 | I am using internet connection with data cap. I want to record my daily internet usage in a file, is there any tool for this or perhaps you can suggest a script that would run as daemon?
(I am not pro in bash scripting or with linux administrating software so a simple script will be recommended) | 2015/07/16 | [
"https://unix.stackexchange.com/questions/216582",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/52733/"
] | I use [vnstat](http://humdi.net/vnstat/), which keeps track of daily stats for the last 30 days, and is available in the Ubuntu/Debian (and probably many more) repos.
Just install it and use it like `vnstat -i wlan0 -h`:
```
wlan0 14:47
^ ... | I would suggest using [vnstat](http://humdi.net/vnstat), which keeps record of data usage for each interface you enable it on. You can view detailed records in varying precision from monthly up to hourly (for the last 24 hours). One very useful thing about vnstat is that it does not require root access to view records.... |
3,215,979 | I am doing a past paper and I have been given a matrix A:
\begin{bmatrix}
4 & -1 & -3 & 2 \\
4 & -2 & -4 & 4 \\
-4 & 4 & 6 & -4 \\
-6 & 5 & 7 & -4 \\
\end{bmatrix}
and I need to find a matrix $P$ such that $P^{-1}AP$ =
\begin{bmatrix}
2 & 0 & 0 & 0 \\
0 & 2 & 1 & 0 \\
0 & 0 & 2 & 0 \\
0 & 0 & 0 & -2 \\
\end... | 2019/05/06 | [
"https://math.stackexchange.com/questions/3215979",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | Basically by the same reason why $\sqrt{1+x^2}$ is differentiable, whereas $\sqrt{x^2}(=\lvert x\rvert)$ is not: the surface $x^2=y^2+z^2$ is the union of the surfaces $x=\pm\sqrt{y^2+z^2}$ and you have a problem concerning differentiability when $(x,y,z)=(0,0,0)$. But you have no such problem with the surfaces $x=\pm\... | The answer depends a bit on your definition of a "regular" surface; there seems to be no universally familiar definition.
Going by the definition that a surface is regular if it is everywhere locally diffeomorphic to a plane, then the reason that the standard hyperboloid is regular is that even at the "closest" points... |
70,190 | I know that $\frac{(m-1)!}{(m-n)!(n-1)!} + \frac{(m-1)!}{(m-n-1)!(n)!} = \frac{m!}{(n)!(m-n)!}$, but I am not sure on the intermediate steps. The only solution I am seeing involves finding a common denominator:
$\frac{(m-1)!}{(m-n)!(n-1)!} + \frac{(m-1)!}{(m-n-1)!(n)!} = \frac{(m-1)!(m-n-1)!(n)!+(m-1)!(m-n)!(n-1)!}{(m... | 2011/10/05 | [
"https://math.stackexchange.com/questions/70190",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/9793/"
] | Let $X$ be a set and let $\sigma:X\to X$ be an involution. If $k$ is a ring, then there is an induced involution $\sigma:R\to R$ in the ring $R=k[X]$ of all functions $X\to k$.
By restricting this general situation, you get new examples. For example,
* if $X$ is a topological space, $\sigma:X\to X$ is continuous, $k... | For $X$ any topological space, the ring of continuous functions $X \to R$ where $R$ is any topological commutative ring with involution is itself a commutative ring with pointwise involution (consider in particular the case $R = \mathbb{C}$ with the usual topology). For $X$ compact Hausdorff we get important examples o... |
70,190 | I know that $\frac{(m-1)!}{(m-n)!(n-1)!} + \frac{(m-1)!}{(m-n-1)!(n)!} = \frac{m!}{(n)!(m-n)!}$, but I am not sure on the intermediate steps. The only solution I am seeing involves finding a common denominator:
$\frac{(m-1)!}{(m-n)!(n-1)!} + \frac{(m-1)!}{(m-n-1)!(n)!} = \frac{(m-1)!(m-n-1)!(n)!+(m-1)!(m-n)!(n-1)!}{(m... | 2011/10/05 | [
"https://math.stackexchange.com/questions/70190",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/9793/"
] | Let $X$ be a set and let $\sigma:X\to X$ be an involution. If $k$ is a ring, then there is an induced involution $\sigma:R\to R$ in the ring $R=k[X]$ of all functions $X\to k$.
By restricting this general situation, you get new examples. For example,
* if $X$ is a topological space, $\sigma:X\to X$ is continuous, $k... | The situation turns on whether $R$ contains nonzero solutions of $x+x=0$ (2-torsion) and whether $x+x=y$ can be solved for all $y$ (2-divisibility).
If $R$ admits division by $2$ then there is an additive decomposition $x =\frac{x + \sigma(x)}{2} + \frac{x - \sigma(x)}{2}$ as a sum of invariant and anti-invariant part... |
22,408,448 | I have a program that I am developing using Visual Studio 2013 on a Windows 7 64 bit machine. I have my project setup to target Framework 4.0 and my platform target as x86. I can get it to build and run on my 64 bit, and on a Win 7 32 bit machine with .NET 4.0, but it will not run on XP.
I am using the BCL Portabilit... | 2014/03/14 | [
"https://Stackoverflow.com/questions/22408448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3232337/"
] | Something you attempting to load from your app.config is causing this.
Perhaps a file location in the app.config which does not exist in your XP machine.
Anyway, This does **not** look like .Net 4.0 support for XP issue.
It looks like it is coming from your code - and not from the .NET "envelope".
Sorry for the s... | Do you try to compile localized in english(en)? I found similar error in this question,hope can help u,
[How can I modify my C# project file so that Resources.resx is compiled into the satellite assembly for my UICulture?](https://stackoverflow.com/questions/10657736/how-can-i-modify-my-c-sharp-project-file-so-that-re... |
35,608,554 | I am trying to select the first letter of the last word in a string: such as the first letter after the last space.
"Hello World"
I need to select "W"
"Hello World I am young"
need to select "y"
using charAt()
thanks | 2016/02/24 | [
"https://Stackoverflow.com/questions/35608554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4640719/"
] | You can split string by empty space, pop last element and ask for it's first letter:
```
"Hello World".split(" ").pop().charAt(0); // W
``` | A string is just an array of characters, so you can access it with square brackets. In order to get the first letter of each word in your string, try this:
```
var myString = "Hello World"
var myWords = myString.split(" ");
myWords.forEach(function(word) {
console.log(word[0]);
});
```
For just the last word in ... |
35,608,554 | I am trying to select the first letter of the last word in a string: such as the first letter after the last space.
"Hello World"
I need to select "W"
"Hello World I am young"
need to select "y"
using charAt()
thanks | 2016/02/24 | [
"https://Stackoverflow.com/questions/35608554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4640719/"
] | You can split string by empty space, pop last element and ask for it's first letter:
```
"Hello World".split(" ").pop().charAt(0); // W
``` | Using `lastIndexOf` function:
```
var str = "Hello World";
str.charAt(str.lastIndexOf(' ') + 1)
``` |
35,608,554 | I am trying to select the first letter of the last word in a string: such as the first letter after the last space.
"Hello World"
I need to select "W"
"Hello World I am young"
need to select "y"
using charAt()
thanks | 2016/02/24 | [
"https://Stackoverflow.com/questions/35608554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4640719/"
] | You can split string by empty space, pop last element and ask for it's first letter:
```
"Hello World".split(" ").pop().charAt(0); // W
``` | If you are just allowed to use charAt do the following:
Iterate through the whole string and always remember the last position you have found an empty space. If you are at the end of the string take the char next to the position you have remembered for the last empty space you have found.
Be aware of the case that yo... |
35,608,554 | I am trying to select the first letter of the last word in a string: such as the first letter after the last space.
"Hello World"
I need to select "W"
"Hello World I am young"
need to select "y"
using charAt()
thanks | 2016/02/24 | [
"https://Stackoverflow.com/questions/35608554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4640719/"
] | Using `lastIndexOf` function:
```
var str = "Hello World";
str.charAt(str.lastIndexOf(' ') + 1)
``` | A string is just an array of characters, so you can access it with square brackets. In order to get the first letter of each word in your string, try this:
```
var myString = "Hello World"
var myWords = myString.split(" ");
myWords.forEach(function(word) {
console.log(word[0]);
});
```
For just the last word in ... |
35,608,554 | I am trying to select the first letter of the last word in a string: such as the first letter after the last space.
"Hello World"
I need to select "W"
"Hello World I am young"
need to select "y"
using charAt()
thanks | 2016/02/24 | [
"https://Stackoverflow.com/questions/35608554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4640719/"
] | Using `lastIndexOf` function:
```
var str = "Hello World";
str.charAt(str.lastIndexOf(' ') + 1)
``` | If you are just allowed to use charAt do the following:
Iterate through the whole string and always remember the last position you have found an empty space. If you are at the end of the string take the char next to the position you have remembered for the last empty space you have found.
Be aware of the case that yo... |
30,752,535 | I have this model admin class where I need to add an extra variable for my custom template:
```
class ArticleAdmin(admin.ModelAdmin):
def change_view(self, request, extra_context=None):
extra_context = extra_context or {}
print extra_context
extra_context["show_save_as_draft"] = True
... | 2015/06/10 | [
"https://Stackoverflow.com/questions/30752535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1831520/"
] | That's not the correct signature for the change\_view method. It should be:
```
def change_view(self, request, object_id, form_url='', extra_context=None):
```
You've missed out the object\_id param, so the value (4) is going into extra\_context instead.
Remember to update your super call as well. | >
> please check the super method call, you define a method
> change\_view,but in super you specified changelist\_view, so there is a
> mismatched function calls
>
>
>
```
class ArticleAdmin(admin.ModelAdmin):
def change_view(self, request, extra_context=None):
extra_context = extra_context or {}
print... |
23,861,018 | I'm developing a game for Android using phonegap.
I want to know if the user has some way of editing the HTML while playing the game, and in that case, I would like to know if I can prevent it.
In case the user can edit the HTML and I can't prevent it, I'll have to modify parts of my logic, so that I don't take texts... | 2014/05/25 | [
"https://Stackoverflow.com/questions/23861018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1786381/"
] | Based on the information you've provided, the only conclusion I can make is that `jasmine.createSpy('JdRes')` returns `undefined`.
That means that either `jasmine.createSpy` doesn't have a `return` statement, or it tries to return something that has a value of `undefined`. You should check if the function does indeed ... | This will occur also when you inject a different number of items than the number of arguments to the function - either way, I believe. For example:
```
(function () {
'use strict';
angular.module('controllers').controller('myController', MyController);
MyController.$inject = ['$scope',
'$state',
'$compile',
... |
80,578 | It says in *Ester* "בערב היא באה", "in the evening she would arrive", and [we learn](/a/55204) many important *halachos* of *Purim* from that. I wonder, then: are there any laws or customs **specific to the night of *Purim***? Of course, we read *Ester* by night, but we do that by day also; I'm looking for something un... | 2017/03/04 | [
"https://judaism.stackexchange.com/questions/80578",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/170/"
] | There is in fact a long-standing custom of packing *mishloach manos* on the night of Purim. (There's a *hekesh yod-dalet yod-dalet* to binding the *lulav*.) This doesn't appear in *maseches M'gila*, but if you look in *maseches P'sachim* you'll find this:
>
> אור לארבעה עשר בודקין את החמץ לאור הנר
>
>
> The night o... | Keep in mind that without knowing the accent, the word באה could be in present tense, also. So that would mean "In the evening she is coming".
Esther was coming to the king at night time, and in the morning she returned.
From this, we learn that women come to shul to hear the Megilla at night. It is difficult for the... |
80,578 | It says in *Ester* "בערב היא באה", "in the evening she would arrive", and [we learn](/a/55204) many important *halachos* of *Purim* from that. I wonder, then: are there any laws or customs **specific to the night of *Purim***? Of course, we read *Ester* by night, but we do that by day also; I'm looking for something un... | 2017/03/04 | [
"https://judaism.stackexchange.com/questions/80578",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/170/"
] | Many communities have a [Purim Rov](http://www.theyeshivaworld.com/news/photos/287822/photo-essay-purim-rov-in-montreal-taken-home-tonight-on-horse-and-buggy-photos-by-jdn.html), the purpose of which is to show the community that the Rov's job is actually harder than it seems.
The questions is what part of Purim shou... | There is in fact a long-standing custom of packing *mishloach manos* on the night of Purim. (There's a *hekesh yod-dalet yod-dalet* to binding the *lulav*.) This doesn't appear in *maseches M'gila*, but if you look in *maseches P'sachim* you'll find this:
>
> אור לארבעה עשר בודקין את החמץ לאור הנר
>
>
> The night o... |
80,578 | It says in *Ester* "בערב היא באה", "in the evening she would arrive", and [we learn](/a/55204) many important *halachos* of *Purim* from that. I wonder, then: are there any laws or customs **specific to the night of *Purim***? Of course, we read *Ester* by night, but we do that by day also; I'm looking for something un... | 2017/03/04 | [
"https://judaism.stackexchange.com/questions/80578",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/170/"
] | Many communities have a [Purim Rov](http://www.theyeshivaworld.com/news/photos/287822/photo-essay-purim-rov-in-montreal-taken-home-tonight-on-horse-and-buggy-photos-by-jdn.html), the purpose of which is to show the community that the Rov's job is actually harder than it seems.
The questions is what part of Purim shou... | Keep in mind that without knowing the accent, the word באה could be in present tense, also. So that would mean "In the evening she is coming".
Esther was coming to the king at night time, and in the morning she returned.
From this, we learn that women come to shul to hear the Megilla at night. It is difficult for the... |
21,426,136 | I understand `Kaminari` perform well with Rails3 reading this article: [Rails 3 pagination, will\_paginate vs. Kaminari](https://stackoverflow.com/q/8186985/2930161), but how about with Rails4? Also, when stylizing them with Bootstrap3, which gem is easier solution? | 2014/01/29 | [
"https://Stackoverflow.com/questions/21426136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2930161/"
] | In my experience, there is very little difference between `Kaminari` & `Will Paginate` - it's mainly a personal choice as to which you use (rather like `Paperclip` / `Carrierwave` or `Mac / Windows`)
In terms of compatibility, both gems work natively with Rails 4
---
**Bootstrap**
In reference to Bootstrap, I think... | **Kaminari works fine for me with Rails 4.1.5**
You can get it working with Bootstrap 3 by changing one line of code in the generated Bootstrap theme for [Kaminari](https://github.com/amatsuda/kaminari_themes/tree/master/bootstrap)
In ***Views/Kaminari/\_paginator.html.erb***
**Change this line:** `<div class="pagi... |
21,426,136 | I understand `Kaminari` perform well with Rails3 reading this article: [Rails 3 pagination, will\_paginate vs. Kaminari](https://stackoverflow.com/q/8186985/2930161), but how about with Rails4? Also, when stylizing them with Bootstrap3, which gem is easier solution? | 2014/01/29 | [
"https://Stackoverflow.com/questions/21426136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2930161/"
] | In my experience, there is very little difference between `Kaminari` & `Will Paginate` - it's mainly a personal choice as to which you use (rather like `Paperclip` / `Carrierwave` or `Mac / Windows`)
In terms of compatibility, both gems work natively with Rails 4
---
**Bootstrap**
In reference to Bootstrap, I think... | It is pretty easy to implement twitter bootstrap pagination with `Kaminari`. Just follow the steps below:
1. Add `gem 'kaminari'` to your `GemFile`. Run `bundle install` and restart rails server
2. Check the [Kaminary themes](https://github.com/amatsuda/kaminari_themes) - in your case you need the `bootstrap3` theme
3... |
21,426,136 | I understand `Kaminari` perform well with Rails3 reading this article: [Rails 3 pagination, will\_paginate vs. Kaminari](https://stackoverflow.com/q/8186985/2930161), but how about with Rails4? Also, when stylizing them with Bootstrap3, which gem is easier solution? | 2014/01/29 | [
"https://Stackoverflow.com/questions/21426136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2930161/"
] | It is pretty easy to implement twitter bootstrap pagination with `Kaminari`. Just follow the steps below:
1. Add `gem 'kaminari'` to your `GemFile`. Run `bundle install` and restart rails server
2. Check the [Kaminary themes](https://github.com/amatsuda/kaminari_themes) - in your case you need the `bootstrap3` theme
3... | **Kaminari works fine for me with Rails 4.1.5**
You can get it working with Bootstrap 3 by changing one line of code in the generated Bootstrap theme for [Kaminari](https://github.com/amatsuda/kaminari_themes/tree/master/bootstrap)
In ***Views/Kaminari/\_paginator.html.erb***
**Change this line:** `<div class="pagi... |
34,993,550 | I have written a script to perform an incremental import of data from oracle table to HDFS directory. I use the following sqoop command to do the import :
```
sqoop -- import \
--connect $JDBCconnectionString \
--username $dbUserName \
--password-file $passwordLocal \
--query 'select * from dmt_sim.di... | 2016/01/25 | [
"https://Stackoverflow.com/questions/34993550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2135762/"
] | The solution I 've found so far has plenty of drawbacks, however it kind of does the job:
Use 'gnuplot -e' and cat the script file into the command:
```
cat data | gnuplot -e "$(cat script.gp)"
```
change script.gp using `;` at the end of every line, remove all comments and change the plot command using `'-'` ins... | I would suggest to use the special file '<' which allows you to call the php script and you can have your gnuplot file `plot.gp`:
```
set term jpeg;
set encoding utf8;
set output file_out
my_cmd1=sprintf('< my_script %s', my_file1)
my_cmd2=sprintf('< my_script %s', my_file2)
plot my_cmd1 with lines, my_cmd2 with line... |
65,836,254 | I am facing an issue where my `UIView` with a `Lottie-Animation` is not being correctly displayed. I am using a lot of `Dispatch.main.async` and I a pretty sure that is messing everything up.
**1.** User taps on a `Button` and instantly my `UIVIew`("coverView")+ `Animation` ("loadingAnimation") should be displayed (ca... | 2021/01/21 | [
"https://Stackoverflow.com/questions/65836254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11968226/"
] | Seems that there are redundant `DispatchQueue.main.async` calls
* Better is to remove `DispatchQueue.main.async` in all the function and call all these functions within `DispatchQueue.main.async` in `addWishButtonTapped()`
You can try with below changes:
```
@objc func addWishButtonTapped() {
print("tapped 1")
D... | I think you are using too many asyncs. You only need to stop your animation when the result view is ready. So your structure should be play the animation immediately, craw website in background, when it finishes, stops the animation and shows the result.
So there are two queues, craw in background queue, and when it i... |
65,836,254 | I am facing an issue where my `UIView` with a `Lottie-Animation` is not being correctly displayed. I am using a lot of `Dispatch.main.async` and I a pretty sure that is messing everything up.
**1.** User taps on a `Button` and instantly my `UIVIew`("coverView")+ `Animation` ("loadingAnimation") should be displayed (ca... | 2021/01/21 | [
"https://Stackoverflow.com/questions/65836254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11968226/"
] | Seems that there are redundant `DispatchQueue.main.async` calls
* Better is to remove `DispatchQueue.main.async` in all the function and call all these functions within `DispatchQueue.main.async` in `addWishButtonTapped()`
You can try with below changes:
```
@objc func addWishButtonTapped() {
print("tapped 1")
D... | Load data in background thread (so not affect UI) and send finish callback only on main queue, like
```
func crawlWebsite(finished: @escaping () -> Void){
var html: String?
guard let url = self.url else { return }
let directoryURL = url as NSURL
let urlString: String = directoryURL.absoluteString!
... |
65,836,254 | I am facing an issue where my `UIView` with a `Lottie-Animation` is not being correctly displayed. I am using a lot of `Dispatch.main.async` and I a pretty sure that is messing everything up.
**1.** User taps on a `Button` and instantly my `UIVIew`("coverView")+ `Animation` ("loadingAnimation") should be displayed (ca... | 2021/01/21 | [
"https://Stackoverflow.com/questions/65836254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11968226/"
] | Seems that there are redundant `DispatchQueue.main.async` calls
* Better is to remove `DispatchQueue.main.async` in all the function and call all these functions within `DispatchQueue.main.async` in `addWishButtonTapped()`
You can try with below changes:
```
@objc func addWishButtonTapped() {
print("tapped 1")
D... | I have no experience with Lottie-Animation, but as I see there are at least 2 issues in this code.
1. A lot of unneeded `DispatchQueue.main.async` calls. Remove all, and rewrite `crawlWebsite` function, like was suggested above with combination of async global and async main.
2. In `setUpLoadingAnimation` function mak... |
65,836,254 | I am facing an issue where my `UIView` with a `Lottie-Animation` is not being correctly displayed. I am using a lot of `Dispatch.main.async` and I a pretty sure that is messing everything up.
**1.** User taps on a `Button` and instantly my `UIVIew`("coverView")+ `Animation` ("loadingAnimation") should be displayed (ca... | 2021/01/21 | [
"https://Stackoverflow.com/questions/65836254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11968226/"
] | Seems that there are redundant `DispatchQueue.main.async` calls
* Better is to remove `DispatchQueue.main.async` in all the function and call all these functions within `DispatchQueue.main.async` in `addWishButtonTapped()`
You can try with below changes:
```
@objc func addWishButtonTapped() {
print("tapped 1")
D... | the last DispatchQueue.main.async is enough for this
```
//MARK: crawlWebsite
func crawlWebsite(finished: @escaping () -> Void){
var html: String?
guard let url = self.url else { return }
let directoryURL = url as NSURL
let urlString: String = directoryURL.absoluteString!
// save url to wish
... |
35,169,077 | I have multidimentional array functions which are obtaining the values from database sqlite .
```
var myarray = [];
```
The array values will be like the below :
```
myarray[0][0] = "ABC";
myarray[0][1] = "abc";
...
...
...
myarray[3][1] = "GHI";
```
I need to store array values like this in a variable :
```
va... | 2016/02/03 | [
"https://Stackoverflow.com/questions/35169077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4609016/"
] | You can use the code below. Check demo - [Fiddle](https://jsfiddle.net/ermakovnikolay/3r6p1o3x/)
```
var md2 = [];
for (var t=0; t < myarray.length; t = t+2){
if (myarray[t] && myarray[t+1]) {
md2.push( [ myarray[t], myarray[t+1] ] );
}
}
``` | A two-dimensional array is created simply by building on a "normal" array.
```
var aa = new Array(3)
for(var i=0; i<3;i++) {
aa[i]=new Array(3);
for(var j=0; j<3;j++) {
aa[i][j] = j;
}
}
console.log(aa);
Output: [[0, 1, 2], [0, 1, 2], [0, 1, 2]]
```
Hope it helps. |
35,169,077 | I have multidimentional array functions which are obtaining the values from database sqlite .
```
var myarray = [];
```
The array values will be like the below :
```
myarray[0][0] = "ABC";
myarray[0][1] = "abc";
...
...
...
myarray[3][1] = "GHI";
```
I need to store array values like this in a variable :
```
va... | 2016/02/03 | [
"https://Stackoverflow.com/questions/35169077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4609016/"
] | You can use the code below. Check demo - [Fiddle](https://jsfiddle.net/ermakovnikolay/3r6p1o3x/)
```
var md2 = [];
for (var t=0; t < myarray.length; t = t+2){
if (myarray[t] && myarray[t+1]) {
md2.push( [ myarray[t], myarray[t+1] ] );
}
}
``` | you can use this code for store value from multidimensional to single
```
var md2 = [];
var cnt = 0;
for(var i=0;i<myArray.length;i++){
md2[i] = myArray[i];
}
``` |
35,169,077 | I have multidimentional array functions which are obtaining the values from database sqlite .
```
var myarray = [];
```
The array values will be like the below :
```
myarray[0][0] = "ABC";
myarray[0][1] = "abc";
...
...
...
myarray[3][1] = "GHI";
```
I need to store array values like this in a variable :
```
va... | 2016/02/03 | [
"https://Stackoverflow.com/questions/35169077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4609016/"
] | Both of these approaches will give you a copy of myarray which is all you are doing in your code as it is now
```
var md2 = [].concat(myarray);
// OR
var md2 = myarray.slice();
```
Both are non destructive and will leave `myarray` untouched | A two-dimensional array is created simply by building on a "normal" array.
```
var aa = new Array(3)
for(var i=0; i<3;i++) {
aa[i]=new Array(3);
for(var j=0; j<3;j++) {
aa[i][j] = j;
}
}
console.log(aa);
Output: [[0, 1, 2], [0, 1, 2], [0, 1, 2]]
```
Hope it helps. |
35,169,077 | I have multidimentional array functions which are obtaining the values from database sqlite .
```
var myarray = [];
```
The array values will be like the below :
```
myarray[0][0] = "ABC";
myarray[0][1] = "abc";
...
...
...
myarray[3][1] = "GHI";
```
I need to store array values like this in a variable :
```
va... | 2016/02/03 | [
"https://Stackoverflow.com/questions/35169077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4609016/"
] | Both of these approaches will give you a copy of myarray which is all you are doing in your code as it is now
```
var md2 = [].concat(myarray);
// OR
var md2 = myarray.slice();
```
Both are non destructive and will leave `myarray` untouched | you can use this code for store value from multidimensional to single
```
var md2 = [];
var cnt = 0;
for(var i=0;i<myArray.length;i++){
md2[i] = myArray[i];
}
``` |
6,525,409 | We have a dedicated server running CentOS and Coldfusion 8.
All cfmail email is routed through Google with cfmail and smtp.
Every now and then, when cfmail is used, the 'FROM' field uses an address from a totally different website.
For instance:
Use form on Site A
Get an email: "Subject: On Site A From: siteb@siteb... | 2011/06/29 | [
"https://Stackoverflow.com/questions/6525409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/295112/"
] | It sounds like it's possible it could be a [var scoping](https://stackoverflow.com/questions/5340722/when-to-var-scope-your-variables-in-coldfusion-components) issue, but we can't know for sure until you share some code... | Looks like you're running multiple sites? there's a setting in the CF caching page in admin to do with caching web server paths:
From <http://help.adobe.com/en_US/ColdFusion/9.0/Admin/WSc3ff6d0ea77859461172e0811cbf3638e6-7ffc.html> :
Disabling the cacheRealPath attribute To ensure that ColdFusion always returns pages... |
30,479,632 | I have a `vector<unsigned>` of size `(90,000 * 9,000)`. I need to find many times whether an element exists in this vector or not?
For doing so, I stored the vector in a sorted form using `std::sort()` and then looked up elements in the vector using `std::binary_search()`. However on profiling using `perf` I find tha... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30479632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4360034/"
] | Depending on the actual data structure of the vector the `contains` operation may take an `O(n)` or `O(1)`. Usually, it's `O(N)` if vector is backed by either associative array or linked list, in this case `contains` will be a full scan in the worst case scenario. You have mitigated a full scan by ordering and using bi... | If you do not need iterate through the collection (in a sorted manner) since c++11 you could use `std::unordered_set<yourtype>` all you need to do is to provide the collection way of getting hashing and equality information for `yourtype`. The time of accessing element of the collection is here amortised O(1), unlike s... |
30,479,632 | I have a `vector<unsigned>` of size `(90,000 * 9,000)`. I need to find many times whether an element exists in this vector or not?
For doing so, I stored the vector in a sorted form using `std::sort()` and then looked up elements in the vector using `std::binary_search()`. However on profiling using `perf` I find tha... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30479632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4360034/"
] | You've got 810 million values out of 4 billion possible values (assuming 32 bits `unsigned`). That's 1/5th of the total range, and uses 3.2 GB. This means you're in fact better of with a `std::vector<bool>` with 4 billion bits. This gives you O(1) lookup in less space (0.5 GB).
(In theory, `unsigned` could be 16 bits.... | If you do not need iterate through the collection (in a sorted manner) since c++11 you could use `std::unordered_set<yourtype>` all you need to do is to provide the collection way of getting hashing and equality information for `yourtype`. The time of accessing element of the collection is here amortised O(1), unlike s... |
30,479,632 | I have a `vector<unsigned>` of size `(90,000 * 9,000)`. I need to find many times whether an element exists in this vector or not?
For doing so, I stored the vector in a sorted form using `std::sort()` and then looked up elements in the vector using `std::binary_search()`. However on profiling using `perf` I find tha... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30479632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4360034/"
] | >
> However on profiling using perf I find that looking up elements in
> vector is the slowest operation.
>
>
>
That is half of the information you need, the other half being ***"how fast is it compared to other algorithms/containers"***? Maybe using `std::vector<>` is actually the fastest, or maybe its the slowe... | If you do not need iterate through the collection (in a sorted manner) since c++11 you could use `std::unordered_set<yourtype>` all you need to do is to provide the collection way of getting hashing and equality information for `yourtype`. The time of accessing element of the collection is here amortised O(1), unlike s... |
30,479,632 | I have a `vector<unsigned>` of size `(90,000 * 9,000)`. I need to find many times whether an element exists in this vector or not?
For doing so, I stored the vector in a sorted form using `std::sort()` and then looked up elements in the vector using `std::binary_search()`. However on profiling using `perf` I find tha... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30479632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4360034/"
] | You've got 810 million values out of 4 billion possible values (assuming 32 bits `unsigned`). That's 1/5th of the total range, and uses 3.2 GB. This means you're in fact better of with a `std::vector<bool>` with 4 billion bits. This gives you O(1) lookup in less space (0.5 GB).
(In theory, `unsigned` could be 16 bits.... | Depending on the actual data structure of the vector the `contains` operation may take an `O(n)` or `O(1)`. Usually, it's `O(N)` if vector is backed by either associative array or linked list, in this case `contains` will be a full scan in the worst case scenario. You have mitigated a full scan by ordering and using bi... |
30,479,632 | I have a `vector<unsigned>` of size `(90,000 * 9,000)`. I need to find many times whether an element exists in this vector or not?
For doing so, I stored the vector in a sorted form using `std::sort()` and then looked up elements in the vector using `std::binary_search()`. However on profiling using `perf` I find tha... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30479632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4360034/"
] | You've got 810 million values out of 4 billion possible values (assuming 32 bits `unsigned`). That's 1/5th of the total range, and uses 3.2 GB. This means you're in fact better of with a `std::vector<bool>` with 4 billion bits. This gives you O(1) lookup in less space (0.5 GB).
(In theory, `unsigned` could be 16 bits.... | >
> However on profiling using perf I find that looking up elements in
> vector is the slowest operation.
>
>
>
That is half of the information you need, the other half being ***"how fast is it compared to other algorithms/containers"***? Maybe using `std::vector<>` is actually the fastest, or maybe its the slowe... |
73,770 | I need to change the order in which things are on the user edit page in Drupal 7. I have tried modifying `page-user-edit.tpl.php` and `user-profile-edit.tpl.php`, but it doesn't seem to ever get there. What can I do? | 2013/05/21 | [
"https://drupal.stackexchange.com/questions/73770",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/11228/"
] | It's a little different for Drupal 7... The structure of the file name would be `page--user--edit.tpl.php` (for D7) as opposed to `page-user-edit.tpl.php` (for D6).
Also, remember to clear the cache after you make any such changes so that they're recognized.
Hope that helps... :) | If you just want to change the order of the fields in the user profile as they appear on the user profile edit page in Drupal 7, navigate to "Administration » Configuration » People » Account settings" and then click on the "Manage Fields" tab. You can the use the slider (or row weights) to rearrange the order of the f... |
16,328,282 | I have MySql tables that look like this
```
scores
game_id | level | score | time
--------+-------+-------+-----
1 | 1 | 1 | 10
1 | 2 | 0 | 10
1 | 3 | 1 | 20
2 | 1 | 1 | 5
2 | 2 | 1 | 15
2 | 3 | 0 | 10
3 | 1 | 0 | 10
3 ... | 2013/05/01 | [
"https://Stackoverflow.com/questions/16328282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2341071/"
] | This query below will give you the partial result.
```
SELECT a.game_ID,
b.user_id,
SUM(a.Score) sumPoint,
SUM(a.time) sumTime
FROM scores a
INNER JOIN games b
ON a.game_ID = b.game_ID
GROUP BY a.game_ID, b.user_id
```
* [SQLFiddle Demo](http://www.sqlfiddle.com/#!... | JW's answer is essentially the same as mine. I just think that bringing the user in so early seems to complicate things unnecessarily. How about...
```
SELECT x.*
, u.user_id
FROM
( SELECT game_id
, SUM(score) ttl_score
, SUM(time) ttl_time
FROM scores
GROUP
... |
5,060,488 | I have automation to create an Excel document from C#. I am trying to freeze the top row of my worksheet and apply filter. This is the same as in Excel 2010 if you select View > Freeze Panes > Freeze top row, and then after selecting top row Data > Filter. I do not have any idea how to apply the filter but the followin... | 2011/02/20 | [
"https://Stackoverflow.com/questions/5060488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/230624/"
] | Try this...
```
workSheet.Activate();
workSheet.Application.ActiveWindow.SplitRow = 1;
workSheet.Application.ActiveWindow.FreezePanes = true;
``` | ```
workSheet.EnableAutoFilter = true;
workSheet.Cells.AutoFilter(1);
//Set the header-row bold
workSheet.Range["A1", "A1"].EntireRow.Font.Bold = true;
//Adjust all columns
workSheet.Columns.AutoFit();
```
There could be some `System.Reflection.Missing.Value` that need to be passed with the arguments, but this... |
5,060,488 | I have automation to create an Excel document from C#. I am trying to freeze the top row of my worksheet and apply filter. This is the same as in Excel 2010 if you select View > Freeze Panes > Freeze top row, and then after selecting top row Data > Filter. I do not have any idea how to apply the filter but the followin... | 2011/02/20 | [
"https://Stackoverflow.com/questions/5060488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/230624/"
] | I figured it out!
@Jaime's solution to freezing the top row worked perfectly. And the following is my solution to applying the filter:
Thanks,
KBP
```
// Fix first row
workSheet.Activate();
workSheet.Application.ActiveWindow.SplitRow = 1;
workSheet.Application.ActiveWindow.FreezePanes = true;
// Now apply autofilter... | Try this...
```
workSheet.Activate();
workSheet.Application.ActiveWindow.SplitRow = 1;
workSheet.Application.ActiveWindow.FreezePanes = true;
``` |
5,060,488 | I have automation to create an Excel document from C#. I am trying to freeze the top row of my worksheet and apply filter. This is the same as in Excel 2010 if you select View > Freeze Panes > Freeze top row, and then after selecting top row Data > Filter. I do not have any idea how to apply the filter but the followin... | 2011/02/20 | [
"https://Stackoverflow.com/questions/5060488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/230624/"
] | Try this...
```
workSheet.Activate();
workSheet.Application.ActiveWindow.SplitRow = 1;
workSheet.Application.ActiveWindow.FreezePanes = true;
``` | The below solutions are working fine, but it is freezing the first row of the current visible snapshot of the sheet. For ex: If your current sheet visible snapshot is from row 43.. then freeze row is getting applied to 43.
If you want only the very first row of sheet (heading row) to be frozen, no matter the excel scr... |
5,060,488 | I have automation to create an Excel document from C#. I am trying to freeze the top row of my worksheet and apply filter. This is the same as in Excel 2010 if you select View > Freeze Panes > Freeze top row, and then after selecting top row Data > Filter. I do not have any idea how to apply the filter but the followin... | 2011/02/20 | [
"https://Stackoverflow.com/questions/5060488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/230624/"
] | Try this...
```
workSheet.Activate();
workSheet.Application.ActiveWindow.SplitRow = 1;
workSheet.Application.ActiveWindow.FreezePanes = true;
``` | //path were excel file is kept
string ResultsFilePath = @"C:\Users\krakhil\Desktop\FolderName\FileNameWithoutExtension";
```
Excel.Application ExcelApp = new Excel.Application();
Excel.Workbook ExcelWorkbook = ExcelApp.Workbooks.Open(ResultsFilePath);
ExcelApp.Visible = true;
//Loopin... |
5,060,488 | I have automation to create an Excel document from C#. I am trying to freeze the top row of my worksheet and apply filter. This is the same as in Excel 2010 if you select View > Freeze Panes > Freeze top row, and then after selecting top row Data > Filter. I do not have any idea how to apply the filter but the followin... | 2011/02/20 | [
"https://Stackoverflow.com/questions/5060488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/230624/"
] | I figured it out!
@Jaime's solution to freezing the top row worked perfectly. And the following is my solution to applying the filter:
Thanks,
KBP
```
// Fix first row
workSheet.Activate();
workSheet.Application.ActiveWindow.SplitRow = 1;
workSheet.Application.ActiveWindow.FreezePanes = true;
// Now apply autofilter... | ```
workSheet.EnableAutoFilter = true;
workSheet.Cells.AutoFilter(1);
//Set the header-row bold
workSheet.Range["A1", "A1"].EntireRow.Font.Bold = true;
//Adjust all columns
workSheet.Columns.AutoFit();
```
There could be some `System.Reflection.Missing.Value` that need to be passed with the arguments, but this... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.