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
213,431
If the Night's Watch was supposed to last thousands of years, and was given land, why not have them raise families in the Gift and send all adult males to guard the wall on a rotation?
2019/05/28
[ "https://scifi.stackexchange.com/questions/213431", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/99370/" ]
IDK if it's ever mentioned in canon, but this requirement also makes it impossible for the Night's Watch to turn into a dynasty / House, if the Lord Commander had children to pass things on to. That could easily result in its goals shifting, and the Night's Watch becoming involved in politics. And/or other regions not...
I don't think that part of the oath is just about love and duty, despite the great words from the maester. After all, the men still have families and people they love. Mothers, fathers, brothers, sisters, cousins, etc. Jon himself desperately want to help his brother Robb, probably as much as he would want to help a wi...
213,431
If the Night's Watch was supposed to last thousands of years, and was given land, why not have them raise families in the Gift and send all adult males to guard the wall on a rotation?
2019/05/28
[ "https://scifi.stackexchange.com/questions/213431", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/99370/" ]
They weren't. They were required to "take no wives and father no children". Even before contraceptives, there are ways of having sex which have no possibility of pregnancy, and that doesn't even count homosexual encounters. While celibacy is a way to *ensure* that, it isn't necessary. It was shown in the novels and bo...
I don't think that part of the oath is just about love and duty, despite the great words from the maester. After all, the men still have families and people they love. Mothers, fathers, brothers, sisters, cousins, etc. Jon himself desperately want to help his brother Robb, probably as much as he would want to help a wi...
213,431
If the Night's Watch was supposed to last thousands of years, and was given land, why not have them raise families in the Gift and send all adult males to guard the wall on a rotation?
2019/05/28
[ "https://scifi.stackexchange.com/questions/213431", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/99370/" ]
Because *love is the death of duty*. ------------------------------------ If they have families, they will lose the focus on the defense of the human realms against the Others. And when the time comes when they must choose, they will always choose their families rather than the realm. That is why they give up everythi...
Because it generates a conflict of interest that the Watch would rather not have present. > > **Maester Aemon:** Did you ever wonder why the men of the Night's Watch take no wives and father no children? So they will not love. Love is the death of duty." > > *Game of Thrones - S01E09: Baelor* > > > You may thi...
213,431
If the Night's Watch was supposed to last thousands of years, and was given land, why not have them raise families in the Gift and send all adult males to guard the wall on a rotation?
2019/05/28
[ "https://scifi.stackexchange.com/questions/213431", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/99370/" ]
Because *love is the death of duty*. ------------------------------------ If they have families, they will lose the focus on the defense of the human realms against the Others. And when the time comes when they must choose, they will always choose their families rather than the realm. That is why they give up everythi...
IDK if it's ever mentioned in canon, but this requirement also makes it impossible for the Night's Watch to turn into a dynasty / House, if the Lord Commander had children to pass things on to. That could easily result in its goals shifting, and the Night's Watch becoming involved in politics. And/or other regions not...
213,431
If the Night's Watch was supposed to last thousands of years, and was given land, why not have them raise families in the Gift and send all adult males to guard the wall on a rotation?
2019/05/28
[ "https://scifi.stackexchange.com/questions/213431", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/99370/" ]
They weren't. They were required to "take no wives and father no children". Even before contraceptives, there are ways of having sex which have no possibility of pregnancy, and that doesn't even count homosexual encounters. While celibacy is a way to *ensure* that, it isn't necessary. It was shown in the novels and bo...
IDK if it's ever mentioned in canon, but this requirement also makes it impossible for the Night's Watch to turn into a dynasty / House, if the Lord Commander had children to pass things on to. That could easily result in its goals shifting, and the Night's Watch becoming involved in politics. And/or other regions not...
213,431
If the Night's Watch was supposed to last thousands of years, and was given land, why not have them raise families in the Gift and send all adult males to guard the wall on a rotation?
2019/05/28
[ "https://scifi.stackexchange.com/questions/213431", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/99370/" ]
**Case 1: After Night King's death** Two kinds of people to join the night's watch or take the castle black. The first are the found guilty of crimes and join the night's watch for their life. Second, are who join castle black on their own. If you remember in the episode "The Iron Throne" (S08E06) Tyrion told Jon "The ...
I don't think that part of the oath is just about love and duty, despite the great words from the maester. After all, the men still have families and people they love. Mothers, fathers, brothers, sisters, cousins, etc. Jon himself desperately want to help his brother Robb, probably as much as he would want to help a wi...
213,431
If the Night's Watch was supposed to last thousands of years, and was given land, why not have them raise families in the Gift and send all adult males to guard the wall on a rotation?
2019/05/28
[ "https://scifi.stackexchange.com/questions/213431", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/99370/" ]
Because it generates a conflict of interest that the Watch would rather not have present. > > **Maester Aemon:** Did you ever wonder why the men of the Night's Watch take no wives and father no children? So they will not love. Love is the death of duty." > > *Game of Thrones - S01E09: Baelor* > > > You may thi...
IDK if it's ever mentioned in canon, but this requirement also makes it impossible for the Night's Watch to turn into a dynasty / House, if the Lord Commander had children to pass things on to. That could easily result in its goals shifting, and the Night's Watch becoming involved in politics. And/or other regions not...
19,997,642
I am trying to alter a piece of code that will allow me to position an image left, right or centred. I have been able to create radio buttons that populate a table on the database but now I want to pull that information out and create an IF statement that will then open a specified page depending on the result. Fo...
2013/11/15
[ "https://Stackoverflow.com/questions/19997642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2739546/" ]
You're bulding the **$to** array in the wrong way. You need a key-value pairs array, you can build it up this way: ``` $to[$row_users['user_bitcoin_wallet']] = $currency; ``` Then you can call **sendmany** this way: ``` $bitcoin->sendmany($BuyerAccount,$to); ``` Your code became: ``` <?php //step 1 create array ...
You might consider spliiting that array up as too many in one request can be a bit much for the bitcoin daemon. ``` $chunks=array_chunk($to,100,true); forach($chunks as $row) $bitcoin->sendmany($BuyerAccount,$row); ```
19,997,642
I am trying to alter a piece of code that will allow me to position an image left, right or centred. I have been able to create radio buttons that populate a table on the database but now I want to pull that information out and create an IF statement that will then open a specified page depending on the result. Fo...
2013/11/15
[ "https://Stackoverflow.com/questions/19997642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2739546/" ]
You're bulding the **$to** array in the wrong way. You need a key-value pairs array, you can build it up this way: ``` $to[$row_users['user_bitcoin_wallet']] = $currency; ``` Then you can call **sendmany** this way: ``` $bitcoin->sendmany($BuyerAccount,$to); ``` Your code became: ``` <?php //step 1 create array ...
Paolo gave a good answer, you can find `->sendmany()` official documentation here: [on the Mike Gogulski's bitcoin-php official Documentation](http://code.gogulski.com/bitcoin-php/class_bitcoin_client.html#a4e14526418b9263d3c3ceddcdae6d3ee)
19,997,642
I am trying to alter a piece of code that will allow me to position an image left, right or centred. I have been able to create radio buttons that populate a table on the database but now I want to pull that information out and create an IF statement that will then open a specified page depending on the result. Fo...
2013/11/15
[ "https://Stackoverflow.com/questions/19997642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2739546/" ]
You might consider spliiting that array up as too many in one request can be a bit much for the bitcoin daemon. ``` $chunks=array_chunk($to,100,true); forach($chunks as $row) $bitcoin->sendmany($BuyerAccount,$row); ```
Paolo gave a good answer, you can find `->sendmany()` official documentation here: [on the Mike Gogulski's bitcoin-php official Documentation](http://code.gogulski.com/bitcoin-php/class_bitcoin_client.html#a4e14526418b9263d3c3ceddcdae6d3ee)
2,817,938
I have a string in PHP for example `$string = "Blabla [word]";` I would like to filter the word between the '[' brackets. The result should be like this `$substring = "word";` thanks
2010/05/12
[ "https://Stackoverflow.com/questions/2817938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` preg_match('/\[(.*?)\]/', $string, $match); $substring = $match[1]; ```
Try: ``` preg_match ('/\[(.*)\]$/', $string, $matches); $substring = $matches[1]; var_dump ($substring); ```
29,664,977
I have a Excel file in .xlsx format. I have stored data by merging cells to form various columns. I am reading the Excel file via a Java web application and saving its data to a database (MySQL). But when I read from merged cells I get null values along with what are stored in the columns as well as the headers. I am u...
2015/04/16
[ "https://Stackoverflow.com/questions/29664977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4794604/" ]
Following code of snippet might help. ``` while (rowIterator.hasNext()) { Row row = rowIterator.next(); //For each row, iterate through all the columns Iterator<Cell> cellIterator = row.cellIterator(); outer: while (cellIterator.hasNext()) { Cell cell = cellIterato...
This method can read a specific cell (including merged cell): ``` import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermod...
9,974,649
I need to compare the values in a spreadsheet with a text file containing the output of a zone transfer to get the IP addresses of specific interfaces based on the type listed in the spread sheet. * **My input:** + **Excel spreadsheet:** ``` +----------+------------+ | **Name** | **Int type** | +--------...
2012/04/02
[ "https://Stackoverflow.com/questions/9974649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1302923/" ]
Your code is complicated for no obvious reason. For example, why does the macro open workbook "C:\Server-List-by-Switch.xlsx" rather than sit within in? I do not know what `Wscript.Echo` does so have used Debug.Print to output to the Immediate Window. I am not a fan of having a three character type identifier at the s...
just a wild guess - replace both *`strFQDN = splitRE (strNextLine, "\s+")`* with `strFQDN = splitRE (line, "\s+")` --- or update `strNextLine` with other lines, now it is always the first line..
77,168
I installed bitcoinjs-lib with command: meteor npm install bitcoinjs-lib. The installation command "flow-typed install -f 0.27 bitcoinjs-lib@2.2.0" didn't work. No idea what flow-typed is and the influence it has. This is the code I am running: ``` import bip39 from 'bip39'; import bip32 from 'bip32'; import cr...
2018/07/13
[ "https://bitcoin.stackexchange.com/questions/77168", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/85209/" ]
This method is used by Bitcoin Core (and few others) and comprises of backing up a wallet.dat file. It's a file that holds keys to spend outputs, addresses, transaction information, and other metadata such as contacts. It has a different location based on an operating system. > > Windows: %APPDATA%\Bitcoin > > L...
You need to copy your `wallet.dat` from your old computer to your new computer and replace the file. Otherwise you could take a look on Electrum, it is a light wallet (so you do not need to sync the whole blockchain) and you can import your wallet.dat also there. In your wallet.dat all adresses and private keys are sto...
47,591,481
I was expecting the shape to be (1,3) when I sum along axis=0 i.e. rows. But the shape remains same in both cases. Why is that? ``` >>> arr = np.arange(9).reshape(3,3) >>> arr array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) >>> arr.sum(1) array([ 3, 12, 21]) >>> arr.sum(1).shape (3,) >>> arr.sum(0) array([ 9, 12, 15]) ...
2017/12/01
[ "https://Stackoverflow.com/questions/47591481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6049672/" ]
`numpy.sum` returns: > > An array with the same shape as `a`, with the **specified axis removed**. > > > With one axis removed in both cases, you are left with a singleton tuple. *2 axes - 1 specified axis = 1 axis* However, passing `keepdims` as `True` in both gives different shapes, retaining all the axes in ...
Because summing along the axis of a ND array yields a (N-1)D array. This makes sense if you consider that ``` np.sum([1,2,3]) == 6 # a 0D 'array' ``` If you want to turn your `arr.sum(1)` into a `(1, 3)` or `(3, 1)` 2D array, then use ``` s = arr.sum(0)[np.newaxis, :] # (1, 3) ``` or ``` s = arr.sum(1)[:, np....
47,591,481
I was expecting the shape to be (1,3) when I sum along axis=0 i.e. rows. But the shape remains same in both cases. Why is that? ``` >>> arr = np.arange(9).reshape(3,3) >>> arr array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) >>> arr.sum(1) array([ 3, 12, 21]) >>> arr.sum(1).shape (3,) >>> arr.sum(0) array([ 9, 12, 15]) ...
2017/12/01
[ "https://Stackoverflow.com/questions/47591481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6049672/" ]
`numpy.sum` returns: > > An array with the same shape as `a`, with the **specified axis removed**. > > > With one axis removed in both cases, you are left with a singleton tuple. *2 axes - 1 specified axis = 1 axis* However, passing `keepdims` as `True` in both gives different shapes, retaining all the axes in ...
According to [the documentation](https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.sum.html) this is what you'll get: > > Returns: > > > sum\_along\_axis : ndarray > > > An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returne...
47,591,481
I was expecting the shape to be (1,3) when I sum along axis=0 i.e. rows. But the shape remains same in both cases. Why is that? ``` >>> arr = np.arange(9).reshape(3,3) >>> arr array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) >>> arr.sum(1) array([ 3, 12, 21]) >>> arr.sum(1).shape (3,) >>> arr.sum(0) array([ 9, 12, 15]) ...
2017/12/01
[ "https://Stackoverflow.com/questions/47591481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6049672/" ]
`numpy.sum` returns: > > An array with the same shape as `a`, with the **specified axis removed**. > > > With one axis removed in both cases, you are left with a singleton tuple. *2 axes - 1 specified axis = 1 axis* However, passing `keepdims` as `True` in both gives different shapes, retaining all the axes in ...
`numpy.arrays` have a logic which is not the same than Matlab or even mathematics. From [here](https://docs.scipy.org/doc/numpy-dev/user/numpy-for-matlab-users.html) : > > Handling of vectors (one-dimensional arrays) For array, the vector > shapes 1xN, Nx1, and N are all different things. Operations like > A[:,1] r...
47,591,481
I was expecting the shape to be (1,3) when I sum along axis=0 i.e. rows. But the shape remains same in both cases. Why is that? ``` >>> arr = np.arange(9).reshape(3,3) >>> arr array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) >>> arr.sum(1) array([ 3, 12, 21]) >>> arr.sum(1).shape (3,) >>> arr.sum(0) array([ 9, 12, 15]) ...
2017/12/01
[ "https://Stackoverflow.com/questions/47591481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6049672/" ]
Because summing along the axis of a ND array yields a (N-1)D array. This makes sense if you consider that ``` np.sum([1,2,3]) == 6 # a 0D 'array' ``` If you want to turn your `arr.sum(1)` into a `(1, 3)` or `(3, 1)` 2D array, then use ``` s = arr.sum(0)[np.newaxis, :] # (1, 3) ``` or ``` s = arr.sum(1)[:, np....
According to [the documentation](https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.sum.html) this is what you'll get: > > Returns: > > > sum\_along\_axis : ndarray > > > An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returne...
47,591,481
I was expecting the shape to be (1,3) when I sum along axis=0 i.e. rows. But the shape remains same in both cases. Why is that? ``` >>> arr = np.arange(9).reshape(3,3) >>> arr array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) >>> arr.sum(1) array([ 3, 12, 21]) >>> arr.sum(1).shape (3,) >>> arr.sum(0) array([ 9, 12, 15]) ...
2017/12/01
[ "https://Stackoverflow.com/questions/47591481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6049672/" ]
Because summing along the axis of a ND array yields a (N-1)D array. This makes sense if you consider that ``` np.sum([1,2,3]) == 6 # a 0D 'array' ``` If you want to turn your `arr.sum(1)` into a `(1, 3)` or `(3, 1)` 2D array, then use ``` s = arr.sum(0)[np.newaxis, :] # (1, 3) ``` or ``` s = arr.sum(1)[:, np....
`numpy.arrays` have a logic which is not the same than Matlab or even mathematics. From [here](https://docs.scipy.org/doc/numpy-dev/user/numpy-for-matlab-users.html) : > > Handling of vectors (one-dimensional arrays) For array, the vector > shapes 1xN, Nx1, and N are all different things. Operations like > A[:,1] r...
8,818,197
This is my code: ``` def execute(f, *args): f(args) ``` I sometimes want to pass no function `f` to `execute`, so I want `f` to default to the empty function.
2012/01/11
[ "https://Stackoverflow.com/questions/8818197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/707381/" ]
> > The problem is that sometimes want to pass no argument to execute, so I want function to default to the empty function. > > > Works fine for me: ``` >>> def execute(function = lambda x: x, *args): ... print function, args ... function(args) ... >>> execute() <function <lambda> at 0x01DD1A30> () >>> ``` ...
I don't understand very well what are you trying to do But would something like this work for you? ``` def execute(func=None, *args, **kwargs): if func: func(*args, **kwargs) ``` You can also add an else statement to do whatever you like.
8,818,197
This is my code: ``` def execute(f, *args): f(args) ``` I sometimes want to pass no function `f` to `execute`, so I want `f` to default to the empty function.
2012/01/11
[ "https://Stackoverflow.com/questions/8818197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/707381/" ]
> > The problem is that sometimes want to pass no argument to execute, so I want function to default to the empty function. > > > Works fine for me: ``` >>> def execute(function = lambda x: x, *args): ... print function, args ... function(args) ... >>> execute() <function <lambda> at 0x01DD1A30> () >>> ``` ...
An anonymous function returning None is often an appropriate no-op: ``` def execute(func=lambda *a, **k: None, *args, **kwargs): return func(*args, **kwargs) ```
16,250,205
I have a excel spreadsheet with many worksheet. i want to copy the first row from "Sheet1" into all other sheets at row 1 AND maintain the column widths specified from row1 sheet one. any ideas how this can be done? thanks in advance.
2013/04/27
[ "https://Stackoverflow.com/questions/16250205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1144596/" ]
This should help you! The following code pastes the first row of the sheet named "Sheet1" in each of the other sheets' first row. In case the source sheet's name is different, change the HeaderRow's sheet reference appropriately. ``` Dim ws As Worksheet, HeaderRow As Range Set HeaderRow = Worksheets("sheet1").Range("...
`ActiveCell.PasteSpecial xlColumnWidths`? To elaborate: ``` Sheets("Sheet1").Range("A1:BL50000").Copy With Sheets("Sheet2").Range("A1") .Cells.PasteSpecial xlPasteColumnWidths End With ``` Hope that helps!
924,434
I want to know how I can automate "Livestreamer". I download movies(series) every week. The command is like this: `livestreamer "hlsvariant://http://Bla_Bla" best -o Filename.ts` I want the change `Bla_Bla` automatically, and change the file name as `NameOfMovie*.ts`, where `*` is the chapter of the movie. For exam...
2015/06/05
[ "https://superuser.com/questions/924434", "https://superuser.com", "https://superuser.com/users/452074/" ]
Instead of having to figure out which number was your last sequence, then increment it, you could add the date to the filename like this: ``` NameOfMovie`date +%Y%m%d-%H%M%S`.ts ``` Then it becomes more meaningful & its easier to understand.
The following script can help you. You should not be running several copies of the script at the same time to avoid race condition. ``` name=somefile if [[ -e $name.ext ]] ; then i=0 while [[ -e $name-$i.ext ]] ; do let i++ done name=$name-$i fi touch $name.ext ```
4,963,135
I'm trying to handle user inactivity and activity in a WPF application to fade some stuff in and out. After a lot of research, I decided to go with the (at least in my opinion) very elegant solution Hans Passant posted [here](https://stackoverflow.com/questions/2363117/shutdown-wpf-application-after-n-seconds-of-inacti...
2011/02/10
[ "https://Stackoverflow.com/questions/4963135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135441/" ]
We've had a similar need for our software... it's a WPF application as well, and as a security feature - a client can configure a time that their user's will be logged off if they are idle. Below is the class that I made to wrap the Idle Detection code (which utilizes built in Windows functionality). We simply have a...
Instead of listening to `PreProcessInput` have you tried [PreviewMouseMove](http://msdn.microsoft.com/en-us/library/system.windows.uielement.previewmousemove.aspx)?
4,963,135
I'm trying to handle user inactivity and activity in a WPF application to fade some stuff in and out. After a lot of research, I decided to go with the (at least in my opinion) very elegant solution Hans Passant posted [here](https://stackoverflow.com/questions/2363117/shutdown-wpf-application-after-n-seconds-of-inacti...
2011/02/10
[ "https://Stackoverflow.com/questions/4963135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135441/" ]
I could figure out what caused the described behaviour. For example when the `Visibility` of a control is changed, the [`PreProcessInput`](http://msdn.microsoft.com/en-us/library/system.windows.input.inputmanager.preprocessinput.aspx) event is raised with `PreProcessInputEventArgs.StagingItem.Input` of the type `Input...
Instead of listening to `PreProcessInput` have you tried [PreviewMouseMove](http://msdn.microsoft.com/en-us/library/system.windows.uielement.previewmousemove.aspx)?
4,963,135
I'm trying to handle user inactivity and activity in a WPF application to fade some stuff in and out. After a lot of research, I decided to go with the (at least in my opinion) very elegant solution Hans Passant posted [here](https://stackoverflow.com/questions/2363117/shutdown-wpf-application-after-n-seconds-of-inacti...
2011/02/10
[ "https://Stackoverflow.com/questions/4963135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135441/" ]
I implements the solution in a IdleDetector class. I have improved a little bit the code. The Iddle detector throw an IsIdle That can be intercepte ! It give that ! I wait for some comments. ``` public class IdleDetector { private readonly DispatcherTimer _activityTimer; private Point _inactiveMousePosition = ...
Instead of listening to `PreProcessInput` have you tried [PreviewMouseMove](http://msdn.microsoft.com/en-us/library/system.windows.uielement.previewmousemove.aspx)?
4,963,135
I'm trying to handle user inactivity and activity in a WPF application to fade some stuff in and out. After a lot of research, I decided to go with the (at least in my opinion) very elegant solution Hans Passant posted [here](https://stackoverflow.com/questions/2363117/shutdown-wpf-application-after-n-seconds-of-inacti...
2011/02/10
[ "https://Stackoverflow.com/questions/4963135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135441/" ]
Instead of listening to `PreProcessInput` have you tried [PreviewMouseMove](http://msdn.microsoft.com/en-us/library/system.windows.uielement.previewmousemove.aspx)?
After digging in Martin Buberl code, I found what I think is a cleaner way to handle the `PreProcessInput` event for user activity. ``` InputManager.Current.PreProcessInput += InputManager_PreProcessInput; ``` I did it by checking the `e.StagingItem.Input` value for different mouse events and keyboard events: ``` p...
4,963,135
I'm trying to handle user inactivity and activity in a WPF application to fade some stuff in and out. After a lot of research, I decided to go with the (at least in my opinion) very elegant solution Hans Passant posted [here](https://stackoverflow.com/questions/2363117/shutdown-wpf-application-after-n-seconds-of-inacti...
2011/02/10
[ "https://Stackoverflow.com/questions/4963135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135441/" ]
We've had a similar need for our software... it's a WPF application as well, and as a security feature - a client can configure a time that their user's will be logged off if they are idle. Below is the class that I made to wrap the Idle Detection code (which utilizes built in Windows functionality). We simply have a...
I implements the solution in a IdleDetector class. I have improved a little bit the code. The Iddle detector throw an IsIdle That can be intercepte ! It give that ! I wait for some comments. ``` public class IdleDetector { private readonly DispatcherTimer _activityTimer; private Point _inactiveMousePosition = ...
4,963,135
I'm trying to handle user inactivity and activity in a WPF application to fade some stuff in and out. After a lot of research, I decided to go with the (at least in my opinion) very elegant solution Hans Passant posted [here](https://stackoverflow.com/questions/2363117/shutdown-wpf-application-after-n-seconds-of-inacti...
2011/02/10
[ "https://Stackoverflow.com/questions/4963135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135441/" ]
We've had a similar need for our software... it's a WPF application as well, and as a security feature - a client can configure a time that their user's will be logged off if they are idle. Below is the class that I made to wrap the Idle Detection code (which utilizes built in Windows functionality). We simply have a...
After digging in Martin Buberl code, I found what I think is a cleaner way to handle the `PreProcessInput` event for user activity. ``` InputManager.Current.PreProcessInput += InputManager_PreProcessInput; ``` I did it by checking the `e.StagingItem.Input` value for different mouse events and keyboard events: ``` p...
4,963,135
I'm trying to handle user inactivity and activity in a WPF application to fade some stuff in and out. After a lot of research, I decided to go with the (at least in my opinion) very elegant solution Hans Passant posted [here](https://stackoverflow.com/questions/2363117/shutdown-wpf-application-after-n-seconds-of-inacti...
2011/02/10
[ "https://Stackoverflow.com/questions/4963135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135441/" ]
I could figure out what caused the described behaviour. For example when the `Visibility` of a control is changed, the [`PreProcessInput`](http://msdn.microsoft.com/en-us/library/system.windows.input.inputmanager.preprocessinput.aspx) event is raised with `PreProcessInputEventArgs.StagingItem.Input` of the type `Input...
I implements the solution in a IdleDetector class. I have improved a little bit the code. The Iddle detector throw an IsIdle That can be intercepte ! It give that ! I wait for some comments. ``` public class IdleDetector { private readonly DispatcherTimer _activityTimer; private Point _inactiveMousePosition = ...
4,963,135
I'm trying to handle user inactivity and activity in a WPF application to fade some stuff in and out. After a lot of research, I decided to go with the (at least in my opinion) very elegant solution Hans Passant posted [here](https://stackoverflow.com/questions/2363117/shutdown-wpf-application-after-n-seconds-of-inacti...
2011/02/10
[ "https://Stackoverflow.com/questions/4963135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135441/" ]
I could figure out what caused the described behaviour. For example when the `Visibility` of a control is changed, the [`PreProcessInput`](http://msdn.microsoft.com/en-us/library/system.windows.input.inputmanager.preprocessinput.aspx) event is raised with `PreProcessInputEventArgs.StagingItem.Input` of the type `Input...
After digging in Martin Buberl code, I found what I think is a cleaner way to handle the `PreProcessInput` event for user activity. ``` InputManager.Current.PreProcessInput += InputManager_PreProcessInput; ``` I did it by checking the `e.StagingItem.Input` value for different mouse events and keyboard events: ``` p...
4,963,135
I'm trying to handle user inactivity and activity in a WPF application to fade some stuff in and out. After a lot of research, I decided to go with the (at least in my opinion) very elegant solution Hans Passant posted [here](https://stackoverflow.com/questions/2363117/shutdown-wpf-application-after-n-seconds-of-inacti...
2011/02/10
[ "https://Stackoverflow.com/questions/4963135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135441/" ]
I implements the solution in a IdleDetector class. I have improved a little bit the code. The Iddle detector throw an IsIdle That can be intercepte ! It give that ! I wait for some comments. ``` public class IdleDetector { private readonly DispatcherTimer _activityTimer; private Point _inactiveMousePosition = ...
After digging in Martin Buberl code, I found what I think is a cleaner way to handle the `PreProcessInput` event for user activity. ``` InputManager.Current.PreProcessInput += InputManager_PreProcessInput; ``` I did it by checking the `e.StagingItem.Input` value for different mouse events and keyboard events: ``` p...
19,301,005
In my ASP.Net page I have PlaceHolder and Button. When user click on this button, I add some UserControls from my Interface method getControl to the PlaceHolder. Code: ``` protected void ActionBtn_Click(object sender, EventArgs e) { if (provider != null) { actualObject = (PlaceHolde...
2013/10/10
[ "https://Stackoverflow.com/questions/19301005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1041802/" ]
If you fire \*myButton\_ServerClick\* event, postback is invoked and ASP.Net want to fire called event, but your control is not added to the page, that's why ASP.Net ignore this event. After postback and before event to be fired, you must add your control again and after them, event will be invoked. **Update** Somet...
**page.aspx** ``` <asp:PlaceHolder ID="PlaceHolder1" runat="server" ></asp:PlaceHolder> ``` **page.aspx.vb** ``` Private Sub CreateControl() Dim vw As Control vw = CType(LoadControl("~/View01.ascx"), View01) vw.ID = "View_Dyn" PlaceHolder1.Controls.Clear() PlaceHolder1.Controls.Add(vw) End Sub ...
19,301,005
In my ASP.Net page I have PlaceHolder and Button. When user click on this button, I add some UserControls from my Interface method getControl to the PlaceHolder. Code: ``` protected void ActionBtn_Click(object sender, EventArgs e) { if (provider != null) { actualObject = (PlaceHolde...
2013/10/10
[ "https://Stackoverflow.com/questions/19301005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1041802/" ]
If you fire \*myButton\_ServerClick\* event, postback is invoked and ASP.Net want to fire called event, but your control is not added to the page, that's why ASP.Net ignore this event. After postback and before event to be fired, you must add your control again and after them, event will be invoked. **Update** Somet...
Please note that UserControls are added by the below method - // First create the instance of user control var control = Page.LoadControl("~/folder1/UserControl1.ascx") // Now add this control to placeholder as - placeHolder1.Controls.Add(control); I hope this helps.
19,301,005
In my ASP.Net page I have PlaceHolder and Button. When user click on this button, I add some UserControls from my Interface method getControl to the PlaceHolder. Code: ``` protected void ActionBtn_Click(object sender, EventArgs e) { if (provider != null) { actualObject = (PlaceHolde...
2013/10/10
[ "https://Stackoverflow.com/questions/19301005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1041802/" ]
Please note that UserControls are added by the below method - // First create the instance of user control var control = Page.LoadControl("~/folder1/UserControl1.ascx") // Now add this control to placeholder as - placeHolder1.Controls.Add(control); I hope this helps.
**page.aspx** ``` <asp:PlaceHolder ID="PlaceHolder1" runat="server" ></asp:PlaceHolder> ``` **page.aspx.vb** ``` Private Sub CreateControl() Dim vw As Control vw = CType(LoadControl("~/View01.ascx"), View01) vw.ID = "View_Dyn" PlaceHolder1.Controls.Clear() PlaceHolder1.Controls.Add(vw) End Sub ...
41,785
I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So: * **Does anyone know of any good resources on constructing Parsers, Interpreters, and Compil...
2008/09/03
[ "https://Stackoverflow.com/questions/41785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145/" ]
Not very easy, but exhaustive: [the dragon book](http://en.wikipedia.org/wiki/Dragon_Book)
I recently read [Programming Language Processors in Java](http://www.amazon.co.uk/gp/product/0130257869?ie=UTF8&tag=mywebsi-21&linkCode=as2&camp=1634&creative=6738&creativeASIN=0130257869) and would recommend it to you as it starts with basic concepts and then takes you through the implementation of a recursive-descent...
41,785
I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So: * **Does anyone know of any good resources on constructing Parsers, Interpreters, and Compil...
2008/09/03
[ "https://Stackoverflow.com/questions/41785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145/" ]
Aho's "Dragon book" is *the* standard reference, but another good choice is Andrew Appel's [*Modern Compiler Implementation in Java*](http://www.cs.princeton.edu/~appel/modern/java/) (also available in [ML](http://www.cs.princeton.edu/~appel/modern/ml) and [C](http://www.cs.princeton.edu/~appel/modern/c) flavors). It w...
The MIT OpenCourseWare(OCW) site has a class whose project is to build a complier...they refer to the Dragon book and Appel's book, but in addition, there are also class notes and lectures available. The class is [6.035 - Computer Language Engineering](http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Scien...
41,785
I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So: * **Does anyone know of any good resources on constructing Parsers, Interpreters, and Compil...
2008/09/03
[ "https://Stackoverflow.com/questions/41785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145/" ]
This highly-entertaining blog post by Steve Yegge ([Rich Programmer Food](http://steve-yegge.blogspot.com/2007/06/rich-programmer-food.html)) won't tell you everything you need to know about *how* to build a compiler (although it does include a fair amount of good insight), but it does a great job of explaining *why* y...
RE: lex, yacc, bison Do you mean you don't need pointers to them or that you aren't interested in using them? I don't recommend writing a lexer or parser by hand. EDIT: You may have an exaggerated sense of what a "compiler-compiler" can accomplish: the really hard part of compilation begins after you've built the AST...
41,785
I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So: * **Does anyone know of any good resources on constructing Parsers, Interpreters, and Compil...
2008/09/03
[ "https://Stackoverflow.com/questions/41785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145/" ]
Aho's "Dragon book" is *the* standard reference, but another good choice is Andrew Appel's [*Modern Compiler Implementation in Java*](http://www.cs.princeton.edu/~appel/modern/java/) (also available in [ML](http://www.cs.princeton.edu/~appel/modern/ml) and [C](http://www.cs.princeton.edu/~appel/modern/c) flavors). It w...
It's an old book, and rather dated, but I've found *Brinch Hansen on Pascal Compilers* to be a very practical introduction to creating a language and building the elements of a compiler. Despite the name, it's not specific to Pascal. It's very worthwhile if you can find a copy.
41,785
I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So: * **Does anyone know of any good resources on constructing Parsers, Interpreters, and Compil...
2008/09/03
[ "https://Stackoverflow.com/questions/41785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145/" ]
I've found ["Let's build a compiler"](http://compilers.iecc.com/crenshaw/) - the tutorial by Jack Crenshaw, very easy to follow and understand. Jack builds a compiler for Pascal, from the ground up, with very detailed explanations of every step.
I recently read [Programming Language Processors in Java](http://www.amazon.co.uk/gp/product/0130257869?ie=UTF8&tag=mywebsi-21&linkCode=as2&camp=1634&creative=6738&creativeASIN=0130257869) and would recommend it to you as it starts with basic concepts and then takes you through the implementation of a recursive-descent...
41,785
I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So: * **Does anyone know of any good resources on constructing Parsers, Interpreters, and Compil...
2008/09/03
[ "https://Stackoverflow.com/questions/41785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145/" ]
The best paper I ever read on compilers is dated **1964** "META II a syntax-oriented compiler writing language" by Val Schorre. (<http://doi.acm.org/10.1145/800257.808896>) In 10 pages, he shows you how to build an astoundingly simple but very effective compiler-compiler, provides you with with the compiler-compiler g...
I recently read [Programming Language Processors in Java](http://www.amazon.co.uk/gp/product/0130257869?ie=UTF8&tag=mywebsi-21&linkCode=as2&camp=1634&creative=6738&creativeASIN=0130257869) and would recommend it to you as it starts with basic concepts and then takes you through the implementation of a recursive-descent...
41,785
I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So: * **Does anyone know of any good resources on constructing Parsers, Interpreters, and Compil...
2008/09/03
[ "https://Stackoverflow.com/questions/41785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145/" ]
The best paper I ever read on compilers is dated **1964** "META II a syntax-oriented compiler writing language" by Val Schorre. (<http://doi.acm.org/10.1145/800257.808896>) In 10 pages, he shows you how to build an astoundingly simple but very effective compiler-compiler, provides you with with the compiler-compiler g...
Not very easy, but exhaustive: [the dragon book](http://en.wikipedia.org/wiki/Dragon_Book)
41,785
I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So: * **Does anyone know of any good resources on constructing Parsers, Interpreters, and Compil...
2008/09/03
[ "https://Stackoverflow.com/questions/41785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145/" ]
Aho's "Dragon book" is *the* standard reference, but another good choice is Andrew Appel's [*Modern Compiler Implementation in Java*](http://www.cs.princeton.edu/~appel/modern/java/) (also available in [ML](http://www.cs.princeton.edu/~appel/modern/ml) and [C](http://www.cs.princeton.edu/~appel/modern/c) flavors). It w...
I recently read [Programming Language Processors in Java](http://www.amazon.co.uk/gp/product/0130257869?ie=UTF8&tag=mywebsi-21&linkCode=as2&camp=1634&creative=6738&creativeASIN=0130257869) and would recommend it to you as it starts with basic concepts and then takes you through the implementation of a recursive-descent...
41,785
I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So: * **Does anyone know of any good resources on constructing Parsers, Interpreters, and Compil...
2008/09/03
[ "https://Stackoverflow.com/questions/41785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145/" ]
This highly-entertaining blog post by Steve Yegge ([Rich Programmer Food](http://steve-yegge.blogspot.com/2007/06/rich-programmer-food.html)) won't tell you everything you need to know about *how* to build a compiler (although it does include a fair amount of good insight), but it does a great job of explaining *why* y...
Just in case you: * Are willing to play * Like the chance to build something quicker, then go deeper * Are ok with using .NET at an underlying platform ...then I'd recommend you to check Microsoft's Dynamic Language Runtime, which is provided as source code inside the whole Dynamic Silverlight SDK. <http://www.codep...
41,785
I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So: * **Does anyone know of any good resources on constructing Parsers, Interpreters, and Compil...
2008/09/03
[ "https://Stackoverflow.com/questions/41785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145/" ]
I recently read [Programming Language Processors in Java](http://www.amazon.co.uk/gp/product/0130257869?ie=UTF8&tag=mywebsi-21&linkCode=as2&camp=1634&creative=6738&creativeASIN=0130257869) and would recommend it to you as it starts with basic concepts and then takes you through the implementation of a recursive-descent...
RE: lex, yacc, bison Do you mean you don't need pointers to them or that you aren't interested in using them? I don't recommend writing a lexer or parser by hand. EDIT: You may have an exaggerated sense of what a "compiler-compiler" can accomplish: the really hard part of compilation begins after you've built the AST...
3,114,618
Following the guide from Microsoft, <http://msdn.microsoft.com/en-us/library/ee872121(VS.85).aspx> , I am able to get my program to be able to make a program resolve the dynamic libraries that are required in order for it to work. So I add a value with the full name and path to my executable, and add subkey to this e...
2010/06/24
[ "https://Stackoverflow.com/questions/3114618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/341945/" ]
It is correct. `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths` is used by `ShellExecuteEx` and not by `CreateProcess`. So not all programs will use the settings from `App Paths` of your application. If you want to define `PATH` for cmd.exe you can either use subkey of `App Paths` with the name ...
I'll give it my best shot. First, notice that both the cmd & the run\start menu options are running everything in C:\WINDOWS\system32. If you're dll was there then it would work. if you don't want to put it there, you can change the "environmental variables" by clicking right mouse button on **"my computer"-> "prope...
3,114,618
Following the guide from Microsoft, <http://msdn.microsoft.com/en-us/library/ee872121(VS.85).aspx> , I am able to get my program to be able to make a program resolve the dynamic libraries that are required in order for it to work. So I add a value with the full name and path to my executable, and add subkey to this e...
2010/06/24
[ "https://Stackoverflow.com/questions/3114618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/341945/" ]
It is correct. `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths` is used by `ShellExecuteEx` and not by `CreateProcess`. So not all programs will use the settings from `App Paths` of your application. If you want to define `PATH` for cmd.exe you can either use subkey of `App Paths` with the name ...
It's also possible to use "START /WAIT app.exe" from command line which uses ShellExecuteEx.
3,114,618
Following the guide from Microsoft, <http://msdn.microsoft.com/en-us/library/ee872121(VS.85).aspx> , I am able to get my program to be able to make a program resolve the dynamic libraries that are required in order for it to work. So I add a value with the full name and path to my executable, and add subkey to this e...
2010/06/24
[ "https://Stackoverflow.com/questions/3114618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/341945/" ]
It's also possible to use "START /WAIT app.exe" from command line which uses ShellExecuteEx.
I'll give it my best shot. First, notice that both the cmd & the run\start menu options are running everything in C:\WINDOWS\system32. If you're dll was there then it would work. if you don't want to put it there, you can change the "environmental variables" by clicking right mouse button on **"my computer"-> "prope...
30,946,059
If I want to have a Picture in the Center of my layout, I easily use: "Center Vertically" and "Center Horizontally". But now I want a picture to have it in the Center of the left side. But I don't want to use marginLeft=..dp. I want to work without dp. Is there a possibility like "Center Vertically" etc? Here is the co...
2015/06/19
[ "https://Stackoverflow.com/questions/30946059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4694839/" ]
The time complexity of this solution is suboptimal ( O(n^2) ), but it might help you think of ways to match pushing the values into "b": ``` _.forEach(a, function(element1){ _.forEach(b, function(element2){ if (element2.unique_id === element1.unique_id) { element2.states.push(element1.state); } }); })...
[groupBy()](https://lodash.com/docs#groupBy) and [map()](https://lodash.com/docs#map) are your friends: ``` _(a).groupBy('unique_id') .map(function(item, key) { return { unique_id: key, states: _.pluck(item, 'state') }; }) .value() ``` You're basically grouping the...
2,652,790
A rather simple example is this one: 1 4 9 16 25 36 49 .... 3 5 7 9 11 16 .... 2 2 2 2 2 .... [![enter image description here](https://i.stack.imgur.com/cKmLO.png)](https://i.stack.imgur.com/cKmLO.png) We can clearly see it's: $$ (i+1)^2 $$ but my question is how to do find the formula in general? I'm struggling w...
2018/02/16
[ "https://math.stackexchange.com/questions/2652790", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
A nice example is the (open) [long line](https://en.wikipedia.org/wiki/Long_line_(topology)). Every compact subset of it is contained in a bounded interval which is homeomorphic to $[0,1]$, and thus the homotopy groups are trivial (and the space is additionally locally contractible, even locally Euclidean!). However, i...
You can find many examples among finite topological spaces. For information on these, you can browse Jonathan Barmak's LNM book in the subject.
2,652,790
A rather simple example is this one: 1 4 9 16 25 36 49 .... 3 5 7 9 11 16 .... 2 2 2 2 2 .... [![enter image description here](https://i.stack.imgur.com/cKmLO.png)](https://i.stack.imgur.com/cKmLO.png) We can clearly see it's: $$ (i+1)^2 $$ but my question is how to do find the formula in general? I'm struggling w...
2018/02/16
[ "https://math.stackexchange.com/questions/2652790", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
A nice example is the (open) [long line](https://en.wikipedia.org/wiki/Long_line_(topology)). Every compact subset of it is contained in a bounded interval which is homeomorphic to $[0,1]$, and thus the homotopy groups are trivial (and the space is additionally locally contractible, even locally Euclidean!). However, i...
Quasi-circle, which is defined in exercise 7 of page 79 in Hatcher’s book Algebraic topology
2,652,790
A rather simple example is this one: 1 4 9 16 25 36 49 .... 3 5 7 9 11 16 .... 2 2 2 2 2 .... [![enter image description here](https://i.stack.imgur.com/cKmLO.png)](https://i.stack.imgur.com/cKmLO.png) We can clearly see it's: $$ (i+1)^2 $$ but my question is how to do find the formula in general? I'm struggling w...
2018/02/16
[ "https://math.stackexchange.com/questions/2652790", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
You can find many examples among finite topological spaces. For information on these, you can browse Jonathan Barmak's LNM book in the subject.
Quasi-circle, which is defined in exercise 7 of page 79 in Hatcher’s book Algebraic topology
56,935,443
I'm trying to make an android layout with an imageview as a background and components like buttons and editText on top. This works nicely with a constraint layout but when i change the device dimensions the components are misplaced. Is there any way to align the components to the imageView, so that they're always at th...
2019/07/08
[ "https://Stackoverflow.com/questions/56935443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Ok, i found a way to do this now. First you need a ConstraintLayout, then you put another ConstraintLayout(Lets call this "2nd layer") inside it with margins of 0 on all sides and set the layout width and height to wrap\_content. You now put your ImageView into this the 2nd layer and turn adjustViewBounds and cropToPad...
Many devices have different screen sizes and also pixel densities. So when you change a device and only have one layout design, if the device is a different screen size/pixel density from what you originally created the layout for, the way it looks will be different. Check out this document: <http://www.androiddocs.c...
60,687,202
I'm trying to make IF condition where I'm trying to print some text when number is 'correct'. The question is what if the condition can't have 'exact number' ? Like when you are finding everything (\*) in linux system "find / -name \*.mp3". Here is my code, sure it do not work work for bad syntax but I put it here for...
2020/03/14
[ "https://Stackoverflow.com/questions/60687202", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12874794/" ]
You need to provide a type to parse the JSON response into. Using a site like quicktype.io can generate one from your JSON, but any `Decodable` type will do. Then you can use Alamofire's `responseDecodable` handler to parse your response. ```swift AF.request(url).responseDecodable(of: TypeToParse.self) { response in ...
Paste your response in <https://jsonparseronline.com/> to see the structure of the object. It will show you all the keys and values that you can access using subscripts.
318,402
In the dictionary, I found this example ([Source](http://www.oxfordlearnersdictionaries.com/definition/english/appreciate?q=appreciate)): > > I would appreciate it if you paid in cash. > > > Clearly, this is the conditional sentence, type 2 which expresses something that is impossible in the future or at the pre...
2016/04/08
[ "https://english.stackexchange.com/questions/318402", "https://english.stackexchange.com", "https://english.stackexchange.com/users/105551/" ]
Expressions such as *I would appreciate it if you paid in cash* are commonly used to soften a request, to make it less direct, and thus to avoid putting an onus on the person being spoken to. Grammatically, you are right--the speaker is using the conditional incorrectly here. But this is a common colloquialism that is ...
"I **would** appreciate it if you paid in/by cash" is the correct sentence. You have to use **would** in this case, because an **if** in part of the sentence requires would in the next part (even when the second part comes first). => "**If** you paid in/by cash, I **would** appreciate it".
318,402
In the dictionary, I found this example ([Source](http://www.oxfordlearnersdictionaries.com/definition/english/appreciate?q=appreciate)): > > I would appreciate it if you paid in cash. > > > Clearly, this is the conditional sentence, type 2 which expresses something that is impossible in the future or at the pre...
2016/04/08
[ "https://english.stackexchange.com/questions/318402", "https://english.stackexchange.com", "https://english.stackexchange.com/users/105551/" ]
The difference is not so much in the type of the conditional, but the tense of the verb, specifically [future versus future-in-the-past](https://en.wikipedia.org/wiki/Uses_of_English_verb_forms#Future-in-the-past). For sake of discussion, imagine that the seller is himself imagining the situation a few minutes from wh...
"I **would** appreciate it if you paid in/by cash" is the correct sentence. You have to use **would** in this case, because an **if** in part of the sentence requires would in the next part (even when the second part comes first). => "**If** you paid in/by cash, I **would** appreciate it".
318,402
In the dictionary, I found this example ([Source](http://www.oxfordlearnersdictionaries.com/definition/english/appreciate?q=appreciate)): > > I would appreciate it if you paid in cash. > > > Clearly, this is the conditional sentence, type 2 which expresses something that is impossible in the future or at the pre...
2016/04/08
[ "https://english.stackexchange.com/questions/318402", "https://english.stackexchange.com", "https://english.stackexchange.com/users/105551/" ]
Conditional constructions are vastly more complex than the “first, second, third conditionals” teachers employ to introduce them. Now that you are dealing with expressions which do not conform to the ‘canonical’ n-conditionals, you are ready to discard those pedagogical baby rules. The use of past-form *would* in the...
"I **would** appreciate it if you paid in/by cash" is the correct sentence. You have to use **would** in this case, because an **if** in part of the sentence requires would in the next part (even when the second part comes first). => "**If** you paid in/by cash, I **would** appreciate it".
318,402
In the dictionary, I found this example ([Source](http://www.oxfordlearnersdictionaries.com/definition/english/appreciate?q=appreciate)): > > I would appreciate it if you paid in cash. > > > Clearly, this is the conditional sentence, type 2 which expresses something that is impossible in the future or at the pre...
2016/04/08
[ "https://english.stackexchange.com/questions/318402", "https://english.stackexchange.com", "https://english.stackexchange.com/users/105551/" ]
Conditional does not necessarily equate to "impossible now"; it can simply represent a hypothetical scenario. In other words, it hasn't happened yet (e.g., "If I won the lottery..." [but I haven't yet], "If you paid in cash..." [but you haven't yet]). Of the two options you provided, native speakers, when speaking cor...
"I **would** appreciate it if you paid in/by cash" is the correct sentence. You have to use **would** in this case, because an **if** in part of the sentence requires would in the next part (even when the second part comes first). => "**If** you paid in/by cash, I **would** appreciate it".
318,402
In the dictionary, I found this example ([Source](http://www.oxfordlearnersdictionaries.com/definition/english/appreciate?q=appreciate)): > > I would appreciate it if you paid in cash. > > > Clearly, this is the conditional sentence, type 2 which expresses something that is impossible in the future or at the pre...
2016/04/08
[ "https://english.stackexchange.com/questions/318402", "https://english.stackexchange.com", "https://english.stackexchange.com/users/105551/" ]
Expressions such as *I would appreciate it if you paid in cash* are commonly used to soften a request, to make it less direct, and thus to avoid putting an onus on the person being spoken to. Grammatically, you are right--the speaker is using the conditional incorrectly here. But this is a common colloquialism that is ...
The difference is not so much in the type of the conditional, but the tense of the verb, specifically [future versus future-in-the-past](https://en.wikipedia.org/wiki/Uses_of_English_verb_forms#Future-in-the-past). For sake of discussion, imagine that the seller is himself imagining the situation a few minutes from wh...
318,402
In the dictionary, I found this example ([Source](http://www.oxfordlearnersdictionaries.com/definition/english/appreciate?q=appreciate)): > > I would appreciate it if you paid in cash. > > > Clearly, this is the conditional sentence, type 2 which expresses something that is impossible in the future or at the pre...
2016/04/08
[ "https://english.stackexchange.com/questions/318402", "https://english.stackexchange.com", "https://english.stackexchange.com/users/105551/" ]
Conditional constructions are vastly more complex than the “first, second, third conditionals” teachers employ to introduce them. Now that you are dealing with expressions which do not conform to the ‘canonical’ n-conditionals, you are ready to discard those pedagogical baby rules. The use of past-form *would* in the...
Expressions such as *I would appreciate it if you paid in cash* are commonly used to soften a request, to make it less direct, and thus to avoid putting an onus on the person being spoken to. Grammatically, you are right--the speaker is using the conditional incorrectly here. But this is a common colloquialism that is ...
318,402
In the dictionary, I found this example ([Source](http://www.oxfordlearnersdictionaries.com/definition/english/appreciate?q=appreciate)): > > I would appreciate it if you paid in cash. > > > Clearly, this is the conditional sentence, type 2 which expresses something that is impossible in the future or at the pre...
2016/04/08
[ "https://english.stackexchange.com/questions/318402", "https://english.stackexchange.com", "https://english.stackexchange.com/users/105551/" ]
Expressions such as *I would appreciate it if you paid in cash* are commonly used to soften a request, to make it less direct, and thus to avoid putting an onus on the person being spoken to. Grammatically, you are right--the speaker is using the conditional incorrectly here. But this is a common colloquialism that is ...
Conditional does not necessarily equate to "impossible now"; it can simply represent a hypothetical scenario. In other words, it hasn't happened yet (e.g., "If I won the lottery..." [but I haven't yet], "If you paid in cash..." [but you haven't yet]). Of the two options you provided, native speakers, when speaking cor...
318,402
In the dictionary, I found this example ([Source](http://www.oxfordlearnersdictionaries.com/definition/english/appreciate?q=appreciate)): > > I would appreciate it if you paid in cash. > > > Clearly, this is the conditional sentence, type 2 which expresses something that is impossible in the future or at the pre...
2016/04/08
[ "https://english.stackexchange.com/questions/318402", "https://english.stackexchange.com", "https://english.stackexchange.com/users/105551/" ]
Conditional constructions are vastly more complex than the “first, second, third conditionals” teachers employ to introduce them. Now that you are dealing with expressions which do not conform to the ‘canonical’ n-conditionals, you are ready to discard those pedagogical baby rules. The use of past-form *would* in the...
The difference is not so much in the type of the conditional, but the tense of the verb, specifically [future versus future-in-the-past](https://en.wikipedia.org/wiki/Uses_of_English_verb_forms#Future-in-the-past). For sake of discussion, imagine that the seller is himself imagining the situation a few minutes from wh...
318,402
In the dictionary, I found this example ([Source](http://www.oxfordlearnersdictionaries.com/definition/english/appreciate?q=appreciate)): > > I would appreciate it if you paid in cash. > > > Clearly, this is the conditional sentence, type 2 which expresses something that is impossible in the future or at the pre...
2016/04/08
[ "https://english.stackexchange.com/questions/318402", "https://english.stackexchange.com", "https://english.stackexchange.com/users/105551/" ]
Conditional constructions are vastly more complex than the “first, second, third conditionals” teachers employ to introduce them. Now that you are dealing with expressions which do not conform to the ‘canonical’ n-conditionals, you are ready to discard those pedagogical baby rules. The use of past-form *would* in the...
Conditional does not necessarily equate to "impossible now"; it can simply represent a hypothetical scenario. In other words, it hasn't happened yet (e.g., "If I won the lottery..." [but I haven't yet], "If you paid in cash..." [but you haven't yet]). Of the two options you provided, native speakers, when speaking cor...
68,887,732
I have two yaml file in Azure DevOps, I define a variables "AAA:123" in azure-pipelines.yml, and call test.yml, in test.yaml, I can echo $(AAA) with 123, but using "- ${{ if eq($(AAA), '123') }}:", I can't read the variables AAA, how should I write in {{ if eq() }}? ### azure-pipelines.yml ``` variables: AAA: 123 ...
2021/08/23
[ "https://Stackoverflow.com/questions/68887732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16730281/" ]
If I understand your problem correctly, your python environment is properly set (for you are able to run your code) but your IDE (Vs code) points import errors. That is probably **because your IDE does not know which python environment use for your current project** (which seems to live somewhere in `/home/imantha/wor...
Manage to figure it out. I was using jupyter in vscode, and in addition changing its (jupyter) environment - which was the correct one, [![enter image description here](https://i.stack.imgur.com/s9g36.png)](https://i.stack.imgur.com/s9g36.png) I also had to change .py file environments (which was a different env befo...
3,548,314
I am developing an eclipse plugin. I have declared an action set with one action, but when the action is invoked it isn't doing what it should. Here is the class for the action. ``` package instantmessengerplugin; import java.io.IOException; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IA...
2010/08/23
[ "https://Stackoverflow.com/questions/3548314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/408156/" ]
several ways, right click on the view and select SCRIPT View AS-->CREATE TO--> New Query Window (see picture below) , don't click design because the designer doesn't support CASE and other statements or ``` sp_helptext 'ViewName' ``` or ``` select object_definition(object_id('ViewName')) ``` or ``` select name,...
Right-click on your view in the Object Explorer and select *Design*. If you do not see the SQL, then click the SQL button (likely 3rd button from the left) on the toolbar. You can also right-click and select *Script View as/Create To/New Query Editor Window*.
2,121,149
The eigenfunction equation to be solved is \begin{cases} -au\_{xx}+bu\_x=\lambda u, &\text{in } [0, L], \\ u\_x(0)=u(L)=0, & \end{cases} here $a, b, L$ are positive constants, and $\lambda$ is the eigenvalue. I have tried the eigenfunction $coskx$, or $sin kx$, but not true. So I'd appreciate it if someone could en...
2017/01/30
[ "https://math.stackexchange.com/questions/2121149", "https://math.stackexchange.com", "https://math.stackexchange.com/users/411514/" ]
The solutions come out of looking at the equation $$ ar^2-br+\lambda = 0 \\ r^2-(b/a)r +(\lambda/a) = 0 \\ (r-b/2a)^2+(\lambda/a-b^2/4a^2)=0 \\ r = b/2a\pm i\sqrt{\lambda/a-b^2/4a}. $$ So long as $\lambda \ne b^2/4a$, the roots are distinct, leading to solutions $$ u = Ae^{bx/2a}\cos(\sqrt{\lambda/a-b^2/4a}\,x)+Be...
@DisintegratingByParts: As for the other problem, whether my solution is true? \begin{cases} -au\_{xx}+bu\_x=\lambda u, &\text{in } [-L, L], \\ u(-L)=u(L)=0, & \end{cases} By using your approach, we find \begin{equation} r=\frac{b}{2a}\pm i\sqrt{\frac{\lambda}{a}-\frac{b^2}{4a^2}}. \end{equation} As long as $\lambda>\f...
347,403
Ok so I have heard that the only regular polygons which can completely fill the plane without overlapping are the 3,4 and 6 sided ones. I have also heard about Penrose tilings but this question ignores them. How can one prove that there isn't another polygon which can completely tile the plane only by itself? Regards
2013/03/31
[ "https://math.stackexchange.com/questions/347403", "https://math.stackexchange.com", "https://math.stackexchange.com/users/33907/" ]
Well, if you tile the plane by congruent regular polygons, there must be $n$ polygons meeting at each vertex. Thus the interior angles of each polygon must be $2\pi/n$, for some positive integer $n$. For $n=3$, we get polygons with angles of $2\pi/3$, which are regular hexagons. This tiling has three regular hexagons ...
Let $P$ be a regular polygon and $\alpha$ the value of the angle between two edges. To be able to tile the plane, you need that there exists a $k \in \mathbb N$ such that $k \alpha = 2 \pi$. The angle $\alpha(n)$ of a regular polygon of $n$ edges satisfies $n(\pi - \alpha(n)) = 2 \pi$, ie, $\alpha(n) = \pi - \frac {2 \...
347,403
Ok so I have heard that the only regular polygons which can completely fill the plane without overlapping are the 3,4 and 6 sided ones. I have also heard about Penrose tilings but this question ignores them. How can one prove that there isn't another polygon which can completely tile the plane only by itself? Regards
2013/03/31
[ "https://math.stackexchange.com/questions/347403", "https://math.stackexchange.com", "https://math.stackexchange.com/users/33907/" ]
Let $P$ be a regular polygon and $\alpha$ the value of the angle between two edges. To be able to tile the plane, you need that there exists a $k \in \mathbb N$ such that $k \alpha = 2 \pi$. The angle $\alpha(n)$ of a regular polygon of $n$ edges satisfies $n(\pi - \alpha(n)) = 2 \pi$, ie, $\alpha(n) = \pi - \frac {2 \...
Here is my take on @roger's answer. For there to be a tiling, the interior angles of the polygon must fit into $360º$ an whole number of times. In other words, $\frac{360º}{\text{interior angle}}$ must be a positive integer. Note that: $$\text{Interior angle} = 180º - \text{exterior angle} = 180º - \frac{360º}{n}$$ ...
347,403
Ok so I have heard that the only regular polygons which can completely fill the plane without overlapping are the 3,4 and 6 sided ones. I have also heard about Penrose tilings but this question ignores them. How can one prove that there isn't another polygon which can completely tile the plane only by itself? Regards
2013/03/31
[ "https://math.stackexchange.com/questions/347403", "https://math.stackexchange.com", "https://math.stackexchange.com/users/33907/" ]
Well, if you tile the plane by congruent regular polygons, there must be $n$ polygons meeting at each vertex. Thus the interior angles of each polygon must be $2\pi/n$, for some positive integer $n$. For $n=3$, we get polygons with angles of $2\pi/3$, which are regular hexagons. This tiling has three regular hexagons ...
Think of a tiles floor. The vertices always come together at some point. That is, with rectangular tiles there are always groups of 4 tiles, and the 4 corners are 90 degrees each so 4 of them add up to 360. A hexagon has an interior angle measure of 120, and 120 is the greatest factor of 360 (other than 180, which is a...
347,403
Ok so I have heard that the only regular polygons which can completely fill the plane without overlapping are the 3,4 and 6 sided ones. I have also heard about Penrose tilings but this question ignores them. How can one prove that there isn't another polygon which can completely tile the plane only by itself? Regards
2013/03/31
[ "https://math.stackexchange.com/questions/347403", "https://math.stackexchange.com", "https://math.stackexchange.com/users/33907/" ]
Well, if you tile the plane by congruent regular polygons, there must be $n$ polygons meeting at each vertex. Thus the interior angles of each polygon must be $2\pi/n$, for some positive integer $n$. For $n=3$, we get polygons with angles of $2\pi/3$, which are regular hexagons. This tiling has three regular hexagons ...
To the arithmetic of [roger/#347412 (Mar 31 '13 16:37) above](https://math.stackexchange.com/questions/347403/#347412): I didn't immediately see why $\{n \in \mathbb{N}\_{>0} \mid (n-2)|2n \} = \{3,4,6\}$. Here is my explanation: The comprehension for all $n>6$ is equivalent to the following statement: $2n \not\equiv...
347,403
Ok so I have heard that the only regular polygons which can completely fill the plane without overlapping are the 3,4 and 6 sided ones. I have also heard about Penrose tilings but this question ignores them. How can one prove that there isn't another polygon which can completely tile the plane only by itself? Regards
2013/03/31
[ "https://math.stackexchange.com/questions/347403", "https://math.stackexchange.com", "https://math.stackexchange.com/users/33907/" ]
Well, if you tile the plane by congruent regular polygons, there must be $n$ polygons meeting at each vertex. Thus the interior angles of each polygon must be $2\pi/n$, for some positive integer $n$. For $n=3$, we get polygons with angles of $2\pi/3$, which are regular hexagons. This tiling has three regular hexagons ...
Here is my take on @roger's answer. For there to be a tiling, the interior angles of the polygon must fit into $360º$ an whole number of times. In other words, $\frac{360º}{\text{interior angle}}$ must be a positive integer. Note that: $$\text{Interior angle} = 180º - \text{exterior angle} = 180º - \frac{360º}{n}$$ ...
347,403
Ok so I have heard that the only regular polygons which can completely fill the plane without overlapping are the 3,4 and 6 sided ones. I have also heard about Penrose tilings but this question ignores them. How can one prove that there isn't another polygon which can completely tile the plane only by itself? Regards
2013/03/31
[ "https://math.stackexchange.com/questions/347403", "https://math.stackexchange.com", "https://math.stackexchange.com/users/33907/" ]
Think of a tiles floor. The vertices always come together at some point. That is, with rectangular tiles there are always groups of 4 tiles, and the 4 corners are 90 degrees each so 4 of them add up to 360. A hexagon has an interior angle measure of 120, and 120 is the greatest factor of 360 (other than 180, which is a...
Here is my take on @roger's answer. For there to be a tiling, the interior angles of the polygon must fit into $360º$ an whole number of times. In other words, $\frac{360º}{\text{interior angle}}$ must be a positive integer. Note that: $$\text{Interior angle} = 180º - \text{exterior angle} = 180º - \frac{360º}{n}$$ ...
347,403
Ok so I have heard that the only regular polygons which can completely fill the plane without overlapping are the 3,4 and 6 sided ones. I have also heard about Penrose tilings but this question ignores them. How can one prove that there isn't another polygon which can completely tile the plane only by itself? Regards
2013/03/31
[ "https://math.stackexchange.com/questions/347403", "https://math.stackexchange.com", "https://math.stackexchange.com/users/33907/" ]
To the arithmetic of [roger/#347412 (Mar 31 '13 16:37) above](https://math.stackexchange.com/questions/347403/#347412): I didn't immediately see why $\{n \in \mathbb{N}\_{>0} \mid (n-2)|2n \} = \{3,4,6\}$. Here is my explanation: The comprehension for all $n>6$ is equivalent to the following statement: $2n \not\equiv...
Here is my take on @roger's answer. For there to be a tiling, the interior angles of the polygon must fit into $360º$ an whole number of times. In other words, $\frac{360º}{\text{interior angle}}$ must be a positive integer. Note that: $$\text{Interior angle} = 180º - \text{exterior angle} = 180º - \frac{360º}{n}$$ ...
896,041
I’m a PHP developer and I have a problem calculating the perfect match between two different data sets. I have data sets from companies, where each company defines the requirements for a specific job. I also have data sets from users, where each user can define a data set describing their skills. Both of this dataset...
2014/08/13
[ "https://math.stackexchange.com/questions/896041", "https://math.stackexchange.com", "https://math.stackexchange.com/users/169469/" ]
There are probably many ways to archive a meaningful solution for this problem. I used the [cosine similarity](http://en.wikipedia.org/wiki/Cosine_similarity) With the example above i get following function: $\frac{((4\*8) + (8\*10) + (12\*5) + (4\*5) + (10\*1))} {\sqrt{((4\*4) + (8\*8) + (12\*12) + (4\*4) + (10\*10)...
Answer: One approach could be that you could give weights to each of these skill and find the weighted variance in the sense that in your example,, the five jobs could have been weighted $w\_1,w\_2,w\_3,w\_4,w\_5$, and let us say for example sake, the weights are 0.2,0.1,0.3,0.15,0.25. Since it is the best match, we ...
44,973,749
I've created different types of objects like object1 object2 etc. Now, how can I store these objects into an array and print that array out? The idea below does not work. ``` Buch buch = new Buch("Blablabla", "Baba Isi", "DE 1234567890", 50, 1234f); System.out.println(buch.toString()); //5 Objekte erstellen...
2017/07/07
[ "https://Stackoverflow.com/questions/44973749", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7360940/" ]
Closing the Scanner also closes the input stream it's scanning -- in this case `System.in`. Hence, when you subsequently call getYear(), it finds the input stream `System.in` already closed. One way to avoid this is to use the same Scanner in both methods, by passing it as an argument to the methods. From the [Java A...
You can do this, simply by defining an object with both values as fields e.g. for the above. ``` class MonthAndYear { public int month; public int year; } ``` and your function can execute both your methods above, and return an instance of `MonthAndYear` populated with the month and year values. In the above...
56,462,640
Step1: Need to give input to server.as below image ![enter image description here](https://i.stack.imgur.com/IODSR.jpg) ``` step2: get response from server ,as below image. ![enter image description here][2] step3: MainActivity.java @RequiresApi(api = Build.VERSION_CODES.O) @Override protected void onCreate(Bund...
2019/06/05
[ "https://Stackoverflow.com/questions/56462640", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9379452/" ]
The way to explain is not possible to achieve, I mean, after you return from a function the process is done. However, there are several patterns you can implement, it just matters of playing with [triggers](https://firebase.google.com/docs/functions), take a look. You can save a state on a firestore collection and tr...
There are two kinds of cloud Functions for Firebase: the ones that you can **call directly** ([HTTPS Callable functions](https://firebase.google.com/docs/functions/callable), [HTTPS "simple" functions](https://firebase.google.com/docs/functions/http-events) and [scheduled functions](https://firebase.google.com/docs/fun...
27,885,264
Assume I have User records in my PureScript code with the following type: ``` { id :: Number , username :: String , email :: Maybe String , isActive :: Boolean } ``` A CommonJS module is derived from the PureScript code. Exported User-related functions will be called from external JavaScript code. In t...
2015/01/11
[ "https://Stackoverflow.com/questions/27885264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/312785/" ]
I've put together a solution. I'm sure much can be improved, such as changing the type of `toUser` to `Json -> Either String User` and preserving error information. Please leave a comment if you can see any ways this code could be improved. :) This solution uses [PureScript-Argonaut](https://github.com/purescript-cont...
Have you had a look at `purescript-foreign` (<https://github.com/purescript/purescript-foreign>)? I think that's what you're looking for here.
27,885,264
Assume I have User records in my PureScript code with the following type: ``` { id :: Number , username :: String , email :: Maybe String , isActive :: Boolean } ``` A CommonJS module is derived from the PureScript code. Exported User-related functions will be called from external JavaScript code. In t...
2015/01/11
[ "https://Stackoverflow.com/questions/27885264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/312785/" ]
Have you had a look at `purescript-foreign` (<https://github.com/purescript/purescript-foreign>)? I think that's what you're looking for here.
Just a little more ffi ``` module User where import Data.Maybe import Data.Function foreign import data UserExternal :: * type User = { id :: Number, username :: String, email :: Maybe String, isActive :: Boolean } type MbUser = { id :: Maybe Number, username :: Maybe String, emai...
27,885,264
Assume I have User records in my PureScript code with the following type: ``` { id :: Number , username :: String , email :: Maybe String , isActive :: Boolean } ``` A CommonJS module is derived from the PureScript code. Exported User-related functions will be called from external JavaScript code. In t...
2015/01/11
[ "https://Stackoverflow.com/questions/27885264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/312785/" ]
Have you had a look at `purescript-foreign` (<https://github.com/purescript/purescript-foreign>)? I think that's what you're looking for here.
As gb. wrote, that is exactly what the `Foreign` data type was built for. Off the top of my head: ``` convert :: Foreign -> F User convert f = do id <- f ! "id" >>= readNumber name <- f ! "name" >>= readString email <- (f ! "email" >>= readNull >>= traverse readString) <|> pure Nothing isActive <- (f ! "isActi...
27,885,264
Assume I have User records in my PureScript code with the following type: ``` { id :: Number , username :: String , email :: Maybe String , isActive :: Boolean } ``` A CommonJS module is derived from the PureScript code. Exported User-related functions will be called from external JavaScript code. In t...
2015/01/11
[ "https://Stackoverflow.com/questions/27885264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/312785/" ]
I've put together a solution. I'm sure much can be improved, such as changing the type of `toUser` to `Json -> Either String User` and preserving error information. Please leave a comment if you can see any ways this code could be improved. :) This solution uses [PureScript-Argonaut](https://github.com/purescript-cont...
Just a little more ffi ``` module User where import Data.Maybe import Data.Function foreign import data UserExternal :: * type User = { id :: Number, username :: String, email :: Maybe String, isActive :: Boolean } type MbUser = { id :: Maybe Number, username :: Maybe String, emai...
27,885,264
Assume I have User records in my PureScript code with the following type: ``` { id :: Number , username :: String , email :: Maybe String , isActive :: Boolean } ``` A CommonJS module is derived from the PureScript code. Exported User-related functions will be called from external JavaScript code. In t...
2015/01/11
[ "https://Stackoverflow.com/questions/27885264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/312785/" ]
I've put together a solution. I'm sure much can be improved, such as changing the type of `toUser` to `Json -> Either String User` and preserving error information. Please leave a comment if you can see any ways this code could be improved. :) This solution uses [PureScript-Argonaut](https://github.com/purescript-cont...
As gb. wrote, that is exactly what the `Foreign` data type was built for. Off the top of my head: ``` convert :: Foreign -> F User convert f = do id <- f ! "id" >>= readNumber name <- f ! "name" >>= readString email <- (f ! "email" >>= readNull >>= traverse readString) <|> pure Nothing isActive <- (f ! "isActi...
27,885,264
Assume I have User records in my PureScript code with the following type: ``` { id :: Number , username :: String , email :: Maybe String , isActive :: Boolean } ``` A CommonJS module is derived from the PureScript code. Exported User-related functions will be called from external JavaScript code. In t...
2015/01/11
[ "https://Stackoverflow.com/questions/27885264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/312785/" ]
As gb. wrote, that is exactly what the `Foreign` data type was built for. Off the top of my head: ``` convert :: Foreign -> F User convert f = do id <- f ! "id" >>= readNumber name <- f ! "name" >>= readString email <- (f ! "email" >>= readNull >>= traverse readString) <|> pure Nothing isActive <- (f ! "isActi...
Just a little more ffi ``` module User where import Data.Maybe import Data.Function foreign import data UserExternal :: * type User = { id :: Number, username :: String, email :: Maybe String, isActive :: Boolean } type MbUser = { id :: Maybe Number, username :: Maybe String, emai...
5,909,166
I have made an AJAX function with jQuery. The function works properly, and server return a JSON, but I can't use it in my JS script Server side : ``` $array = array(); $array["count"] = count($accounts_list).""; for($i=0; $i<count($accounts_list); $i++) { $account = $accounts_list[$i]; $arr...
2011/05/06
[ "https://Stackoverflow.com/questions/5909166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/379907/" ]
Try this : ``` var json = jQuery.parseJSON('{"count":"371","marker":{"name":"WAMPFLER","lat":"49.02751610","lon":"2.10611230"}}'); alert(json.count); ``` maybe you forget to give a string ' ' to parseJSON.
From [`jQuery.ajax`](http://api.jquery.com/jQuery.ajax/#data-types): > > The `json` type parses the fetched data file as a JavaScript object and returns the constructed object as the result data. > > > So you don't need `jQuery.parseJSON`, as the returned string already is parsed.
5,909,166
I have made an AJAX function with jQuery. The function works properly, and server return a JSON, but I can't use it in my JS script Server side : ``` $array = array(); $array["count"] = count($accounts_list).""; for($i=0; $i<count($accounts_list); $i++) { $account = $accounts_list[$i]; $arr...
2011/05/06
[ "https://Stackoverflow.com/questions/5909166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/379907/" ]
The output buffer didn't empty so AJAX received buffer content + JSON so it wasn't a valid JSON. I use `ob_clean()` on server side just before output my JSON and it solves the problem.
From [`jQuery.ajax`](http://api.jquery.com/jQuery.ajax/#data-types): > > The `json` type parses the fetched data file as a JavaScript object and returns the constructed object as the result data. > > > So you don't need `jQuery.parseJSON`, as the returned string already is parsed.
5,909,166
I have made an AJAX function with jQuery. The function works properly, and server return a JSON, but I can't use it in my JS script Server side : ``` $array = array(); $array["count"] = count($accounts_list).""; for($i=0; $i<count($accounts_list); $i++) { $account = $accounts_list[$i]; $arr...
2011/05/06
[ "https://Stackoverflow.com/questions/5909166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/379907/" ]
Try this : ``` var json = jQuery.parseJSON('{"count":"371","marker":{"name":"WAMPFLER","lat":"49.02751610","lon":"2.10611230"}}'); alert(json.count); ``` maybe you forget to give a string ' ' to parseJSON.
instead of using parseJson can you try just using eval. ``` $.ajax({ type: "POST", url: "index.php?module=cap_Maps&action=AddMarkers", data: dataString, dataType: "text", success: function(data) { if (data == "error"){ $(".tr_legend").before("<tr><td colspan='2' id='error'...
5,909,166
I have made an AJAX function with jQuery. The function works properly, and server return a JSON, but I can't use it in my JS script Server side : ``` $array = array(); $array["count"] = count($accounts_list).""; for($i=0; $i<count($accounts_list); $i++) { $account = $accounts_list[$i]; $arr...
2011/05/06
[ "https://Stackoverflow.com/questions/5909166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/379907/" ]
Try this : ``` var json = jQuery.parseJSON('{"count":"371","marker":{"name":"WAMPFLER","lat":"49.02751610","lon":"2.10611230"}}'); alert(json.count); ``` maybe you forget to give a string ' ' to parseJSON.
It looks like you are not sending the JSON with proper format from your server try to use [json\_encode()](http://php.net/manual/en/function.json-encode.php) function.
5,909,166
I have made an AJAX function with jQuery. The function works properly, and server return a JSON, but I can't use it in my JS script Server side : ``` $array = array(); $array["count"] = count($accounts_list).""; for($i=0; $i<count($accounts_list); $i++) { $account = $accounts_list[$i]; $arr...
2011/05/06
[ "https://Stackoverflow.com/questions/5909166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/379907/" ]
The output buffer didn't empty so AJAX received buffer content + JSON so it wasn't a valid JSON. I use `ob_clean()` on server side just before output my JSON and it solves the problem.
instead of using parseJson can you try just using eval. ``` $.ajax({ type: "POST", url: "index.php?module=cap_Maps&action=AddMarkers", data: dataString, dataType: "text", success: function(data) { if (data == "error"){ $(".tr_legend").before("<tr><td colspan='2' id='error'...
5,909,166
I have made an AJAX function with jQuery. The function works properly, and server return a JSON, but I can't use it in my JS script Server side : ``` $array = array(); $array["count"] = count($accounts_list).""; for($i=0; $i<count($accounts_list); $i++) { $account = $accounts_list[$i]; $arr...
2011/05/06
[ "https://Stackoverflow.com/questions/5909166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/379907/" ]
The output buffer didn't empty so AJAX received buffer content + JSON so it wasn't a valid JSON. I use `ob_clean()` on server side just before output my JSON and it solves the problem.
It looks like you are not sending the JSON with proper format from your server try to use [json\_encode()](http://php.net/manual/en/function.json-encode.php) function.
3,997,382
i'm looking for a larger example of dependency injection and how it can be implemented. If class A depends on class B and passes a reference of class C to B's constructor, must not class A also take a reference to class C in it's constructor? This means that the main method in the application should create all classes ...
2010/10/22
[ "https://Stackoverflow.com/questions/3997382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349729/" ]
You are correct and each DI framework has a different way of managing it. Some use attributes on the properties etc to denote dependency and then "automagically" supply an instance of the correct type, while others (say castle windsor for .net) allow xml configuration, fluent or other methods for "wiring up" the depe...
1. to answer your question about classes A,B,and C, A only needs a reference to B. 2. Most DI frameworks do not require you to use XML for configuration. In fact, many people prefer not to use it. You can explicitly set things up in code, or use some kind of conventions or attributes for the container to infer what obj...
3,997,382
i'm looking for a larger example of dependency injection and how it can be implemented. If class A depends on class B and passes a reference of class C to B's constructor, must not class A also take a reference to class C in it's constructor? This means that the main method in the application should create all classes ...
2010/10/22
[ "https://Stackoverflow.com/questions/3997382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349729/" ]
You are correct and each DI framework has a different way of managing it. Some use attributes on the properties etc to denote dependency and then "automagically" supply an instance of the correct type, while others (say castle windsor for .net) allow xml configuration, fluent or other methods for "wiring up" the depe...
here's a few examples from the PHP Language, hope this helps you understand ``` class Users { var $Database; public function __construct(Database $DB) { $this->Database = $DB; } } $Database = Database::getInstance(); $Users = new Users($Database); ``` From this example the `new` keyword is us...
3,997,382
i'm looking for a larger example of dependency injection and how it can be implemented. If class A depends on class B and passes a reference of class C to B's constructor, must not class A also take a reference to class C in it's constructor? This means that the main method in the application should create all classes ...
2010/10/22
[ "https://Stackoverflow.com/questions/3997382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349729/" ]
You are correct and each DI framework has a different way of managing it. Some use attributes on the properties etc to denote dependency and then "automagically" supply an instance of the correct type, while others (say castle windsor for .net) allow xml configuration, fluent or other methods for "wiring up" the depe...
If anybody is still looking for a good example which shows DI without IoC Containers (poor man's DI) and also with IoC Container (Unity in this example) and registering the types in code and also in XML you can check this out: <https://dannyvanderkraan.wordpress.com/2015/06/15/real-world-example-of-dependeny-injection/...
3,997,382
i'm looking for a larger example of dependency injection and how it can be implemented. If class A depends on class B and passes a reference of class C to B's constructor, must not class A also take a reference to class C in it's constructor? This means that the main method in the application should create all classes ...
2010/10/22
[ "https://Stackoverflow.com/questions/3997382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349729/" ]
1. to answer your question about classes A,B,and C, A only needs a reference to B. 2. Most DI frameworks do not require you to use XML for configuration. In fact, many people prefer not to use it. You can explicitly set things up in code, or use some kind of conventions or attributes for the container to infer what obj...
If anybody is still looking for a good example which shows DI without IoC Containers (poor man's DI) and also with IoC Container (Unity in this example) and registering the types in code and also in XML you can check this out: <https://dannyvanderkraan.wordpress.com/2015/06/15/real-world-example-of-dependeny-injection/...
3,997,382
i'm looking for a larger example of dependency injection and how it can be implemented. If class A depends on class B and passes a reference of class C to B's constructor, must not class A also take a reference to class C in it's constructor? This means that the main method in the application should create all classes ...
2010/10/22
[ "https://Stackoverflow.com/questions/3997382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349729/" ]
here's a few examples from the PHP Language, hope this helps you understand ``` class Users { var $Database; public function __construct(Database $DB) { $this->Database = $DB; } } $Database = Database::getInstance(); $Users = new Users($Database); ``` From this example the `new` keyword is us...
If anybody is still looking for a good example which shows DI without IoC Containers (poor man's DI) and also with IoC Container (Unity in this example) and registering the types in code and also in XML you can check this out: <https://dannyvanderkraan.wordpress.com/2015/06/15/real-world-example-of-dependeny-injection/...
44,161,228
In the PL/SQL world I would create a custom type with `type field_name is table of number index by VARCHAR2;` and use the new type like this `v_source_count source_code_ar;` The [documentation](https://mariadb.com/kb/en/mariadb/create-procedure/) for MariaDB states `types` can be any MariaDB type. It doesn't say anyth...
2017/05/24
[ "https://Stackoverflow.com/questions/44161228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1464160/" ]
It's true that you cannot create custom types in MariaDB, however if you need to simulate that functionality you can create a temporary table in memory. Note that creating a temp table has to come after any DECLARE statements. ``` CREATE TEMPORARY TABLE my_tmp_table ( <fieldName> <datatype>, ... ) ENGINE = MEM...
There are no "custom" datatypes in MariaDB (or MySQL).
58,500,866
Current State ------------- * I have a MongoDB instance running on a server without the **replication set** flag (`--replSet`) * I have some previously stored information on the Database and wish to retain the information Aim --- * I wish to however restart the container with the `--replSet "my-set"` flag set for th...
2019/10/22
[ "https://Stackoverflow.com/questions/58500866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4851126/" ]
### Answer: *This is not something Stack Overflow can help you with. You need to contact G Suite support and talk with them directly.* ### Further Information: Using Google Drive to allow untrusted users to upload content, honestly, is a really bad idea. There are multiple reasons for this - the content of uploaded ...
To somehow download/access the file : * Install **rclone** * Then use the command : **rclone --drive-acknowledge-abuse** to download the file
54,638,383
I'm a noob in java and right now I'm learning about generics. This code should delete any integer larger than five. I typed [10, 11, 12, 1], in theory, I should only get [3, 4, 6, 1]. But I'm getting [3, 4, 6, **11**, 1], I don't understand why..? ``` public static void main(String args[]) throws IOException{ Buff...
2019/02/11
[ "https://Stackoverflow.com/questions/54638383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9994134/" ]
If you read the documentation for [`List.remove()`](https://docs.oracle.com/javase/8/docs/api/java/util/List.html#remove-int-), you will see that the elements after index `i` are shifted to the left. This means that in your current implementation, you are skipping one element after each removal, so if there are two ele...
If you are using Java 8+, You can just use [`ArrayList::removeIf`](https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html#removeIf-java.util.function.Predicate-) like so : ``` list.removeIf(i -> i > 5); ``` [ideone demo](https://www.ideone.com/U0RaBl)
54,638,383
I'm a noob in java and right now I'm learning about generics. This code should delete any integer larger than five. I typed [10, 11, 12, 1], in theory, I should only get [3, 4, 6, 1]. But I'm getting [3, 4, 6, **11**, 1], I don't understand why..? ``` public static void main(String args[]) throws IOException{ Buff...
2019/02/11
[ "https://Stackoverflow.com/questions/54638383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9994134/" ]
If you read the documentation for [`List.remove()`](https://docs.oracle.com/javase/8/docs/api/java/util/List.html#remove-int-), you will see that the elements after index `i` are shifted to the left. This means that in your current implementation, you are skipping one element after each removal, so if there are two ele...
I imagine that was the exercise to understand how to remove from a list, but otherwise, this is how you could check before adding to it: ``` public static void main(String args[]) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> list = new ...
54,638,383
I'm a noob in java and right now I'm learning about generics. This code should delete any integer larger than five. I typed [10, 11, 12, 1], in theory, I should only get [3, 4, 6, 1]. But I'm getting [3, 4, 6, **11**, 1], I don't understand why..? ``` public static void main(String args[]) throws IOException{ Buff...
2019/02/11
[ "https://Stackoverflow.com/questions/54638383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9994134/" ]
If you read the documentation for [`List.remove()`](https://docs.oracle.com/javase/8/docs/api/java/util/List.html#remove-int-), you will see that the elements after index `i` are shifted to the left. This means that in your current implementation, you are skipping one element after each removal, so if there are two ele...
If you start the check from end of the array, it's working. ``` public static void main(String args[]) throws IOException{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> list = new ArrayList<Integer>(); list.add(3); list.add(4); list.add(56); l...
54,638,383
I'm a noob in java and right now I'm learning about generics. This code should delete any integer larger than five. I typed [10, 11, 12, 1], in theory, I should only get [3, 4, 6, 1]. But I'm getting [3, 4, 6, **11**, 1], I don't understand why..? ``` public static void main(String args[]) throws IOException{ Buff...
2019/02/11
[ "https://Stackoverflow.com/questions/54638383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9994134/" ]
If you are using Java 8+, You can just use [`ArrayList::removeIf`](https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html#removeIf-java.util.function.Predicate-) like so : ``` list.removeIf(i -> i > 5); ``` [ideone demo](https://www.ideone.com/U0RaBl)
I imagine that was the exercise to understand how to remove from a list, but otherwise, this is how you could check before adding to it: ``` public static void main(String args[]) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> list = new ...
54,638,383
I'm a noob in java and right now I'm learning about generics. This code should delete any integer larger than five. I typed [10, 11, 12, 1], in theory, I should only get [3, 4, 6, 1]. But I'm getting [3, 4, 6, **11**, 1], I don't understand why..? ``` public static void main(String args[]) throws IOException{ Buff...
2019/02/11
[ "https://Stackoverflow.com/questions/54638383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9994134/" ]
If you are using Java 8+, You can just use [`ArrayList::removeIf`](https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html#removeIf-java.util.function.Predicate-) like so : ``` list.removeIf(i -> i > 5); ``` [ideone demo](https://www.ideone.com/U0RaBl)
If you start the check from end of the array, it's working. ``` public static void main(String args[]) throws IOException{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> list = new ArrayList<Integer>(); list.add(3); list.add(4); list.add(56); l...