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
1,698,042
I have a Data View Web Part, on a custom edit Page for a list. I want to grab the current URL and pass it to the next page, so I can return to the editing screen. I have followed these instructions to display the current page URL: <http://www.stevesofian.net/post/XSLT-Tip-Get-Current-Page-URL.aspx> Inside of Sharepoi...
2009/11/08
[ "https://Stackoverflow.com/questions/1698042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55486/" ]
[`struct`](http://docs.python.org/library/struct.html) is fine if you have to convert one or a small number of 2-byte strings to integers, but [`array`](http://docs.python.org/library/array.html?highlight=array#module-array) and `numpy` itself are better options. Specifically, [numpy.fromstring](http://docs.scipy.org/d...
```py int(value[::-1].hex(), 16) ``` By example: ```py value = b'\xfd\xff\x00\x00\x00\x00\x00\x00' print(int(value[::-1].hex(), 16)) 65533 ``` `[::-1]` invert the values (little endian), `.hex()` trabnsform to hex literal, `int(,16)` transform from hex literal to int base16.
1,698,042
I have a Data View Web Part, on a custom edit Page for a list. I want to grab the current URL and pass it to the next page, so I can return to the editing screen. I have followed these instructions to display the current page URL: <http://www.stevesofian.net/post/XSLT-Tip-Get-Current-Page-URL.aspx> Inside of Sharepoi...
2009/11/08
[ "https://Stackoverflow.com/questions/1698042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55486/" ]
[Kevin Burke's answer](https://stackoverflow.com/a/1698048/8008041) to this question works great when your binary string represents a single short integer, but if your string holds binary data representing multiple integers, you will need to add an additional 'h' for each additional integer that the string represents. ...
```py int(value[::-1].hex(), 16) ``` By example: ```py value = b'\xfd\xff\x00\x00\x00\x00\x00\x00' print(int(value[::-1].hex(), 16)) 65533 ``` `[::-1]` invert the values (little endian), `.hex()` trabnsform to hex literal, `int(,16)` transform from hex literal to int base16.
54,837,626
Hi I currently have a magento 1.9 site which i use session storage as files as i find that using the database is very slow. I currently have about 16 gig of session files which i want to delete. If I run: find . -name 'sess\*' -mtime +7 -exec rm -f {} \; The site grinds to a halt and then kills the database attac...
2019/02/23
[ "https://Stackoverflow.com/questions/54837626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3979610/" ]
The reason the array doesn't have any values after the first one is because you never reach passed the first element. You increment `i` at the end of the function, but at the top of your `addClnt` function, `i` is set back to `0` . This will just keep resulting on overwriting the old previous data EDIT: ``` #include ...
clientCount is only getting incremented in that functions scope. When that function goes to it's return statement, all variables and all the work it did has completely died. You are passing clientCount by value and not by reference, so clientCount will always be 0, and incrementing it inside that local function won't...
57,949,995
I am trying to make a component but it is saying that I have not defined "addToCart". I have defined it in the same component, but I continue to get the same error? ``` Vue.component("solid-back",{ template: ` <div> <h1>{{ title }}</h1> <img :src="image"> <h3>Price</h3> <p>{{pri...
2019/09/16
[ "https://Stackoverflow.com/questions/57949995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12072073/" ]
If I understand your problem correctly, everytime the user navigates to the next page, you fire a request to the backend to load that page. If they click multiple times on the next page button, this leads to multiple requests being fired in parallel, and the last one to return "wins", i.e. those results will be display...
Add a Subject called finalise to your component ``` finalise = new Subject<void>(); ``` and pipe a take until finalise before your subscription. ``` this.companyService.getList(this.listOptions).pipe(takeUntil(finalise)) ``` And add a ngOnDestroy ``` ngOnDestroy() { this.finalise.next(); } ``` This will clea...
16,489,364
How can I use a column whose values are circular (i.e. 1,2,3,1,2,3,1,2,3....) to calculate and output the index number of the loop? So for example in this simplified table... ``` num cir 1 1 2 2 3 3 4 1 5 2 6 3 7 1 8 2 9 3 ``` How can I get this? ``` num cir index 1 1 1 2 2 1 ...
2013/05/10
[ "https://Stackoverflow.com/questions/16489364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2360798/" ]
Assuming that `num1` is ordered (although there can be gaps), one way to solve this problem is to assign the index based on the number of times the loop number has been found for smaller values of `num`. I think the clearest way to do this in MySQL is with a correlated subquery: ``` select t.*, (select count(*)...
Try this self-join with non-next cirsakes and count of them: ``` SELECT t1.num AS num, t1.cir AS cir, COUNT(*) AS index FROM t AS t1 JOIN t AS t2 on t2.cir = t1.cir AND t2.num <= t1.num GROUP BY t1.num, t1.cir ; ```
16,489,364
How can I use a column whose values are circular (i.e. 1,2,3,1,2,3,1,2,3....) to calculate and output the index number of the loop? So for example in this simplified table... ``` num cir 1 1 2 2 3 3 4 1 5 2 6 3 7 1 8 2 9 3 ``` How can I get this? ``` num cir index 1 1 1 2 2 1 ...
2013/05/10
[ "https://Stackoverflow.com/questions/16489364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2360798/" ]
[Gordon Linoff is right](https://stackoverflow.com/a/16489661/297408): in SQL, tables indeed do not have inherent order. However, there still is a way to assign indices in your case. The only issue is, the order would be indeterminate and a 1 might be grouped together with a 2 that would not necessarily be the one that...
Assuming that `num1` is ordered (although there can be gaps), one way to solve this problem is to assign the index based on the number of times the loop number has been found for smaller values of `num`. I think the clearest way to do this in MySQL is with a correlated subquery: ``` select t.*, (select count(*)...
16,489,364
How can I use a column whose values are circular (i.e. 1,2,3,1,2,3,1,2,3....) to calculate and output the index number of the loop? So for example in this simplified table... ``` num cir 1 1 2 2 3 3 4 1 5 2 6 3 7 1 8 2 9 3 ``` How can I get this? ``` num cir index 1 1 1 2 2 1 ...
2013/05/10
[ "https://Stackoverflow.com/questions/16489364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2360798/" ]
Assuming that `num1` is ordered (although there can be gaps), one way to solve this problem is to assign the index based on the number of times the loop number has been found for smaller values of `num`. I think the clearest way to do this in MySQL is with a correlated subquery: ``` select t.*, (select count(*)...
Try this ``` SELECT num, cir, @row_num := IF(@prev_cir<cir,@row_num,@row_num+1) as cir_index, @prev_cir:= cir FROM (SELECT @row_num := 0) r JOIN ( SELECT num, cir FROM mytable ORDER BY num ) t ``` First, I make sure that the records are ordered by `num`. Then I chk ...
16,489,364
How can I use a column whose values are circular (i.e. 1,2,3,1,2,3,1,2,3....) to calculate and output the index number of the loop? So for example in this simplified table... ``` num cir 1 1 2 2 3 3 4 1 5 2 6 3 7 1 8 2 9 3 ``` How can I get this? ``` num cir index 1 1 1 2 2 1 ...
2013/05/10
[ "https://Stackoverflow.com/questions/16489364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2360798/" ]
[Gordon Linoff is right](https://stackoverflow.com/a/16489661/297408): in SQL, tables indeed do not have inherent order. However, there still is a way to assign indices in your case. The only issue is, the order would be indeterminate and a 1 might be grouped together with a 2 that would not necessarily be the one that...
Try this self-join with non-next cirsakes and count of them: ``` SELECT t1.num AS num, t1.cir AS cir, COUNT(*) AS index FROM t AS t1 JOIN t AS t2 on t2.cir = t1.cir AND t2.num <= t1.num GROUP BY t1.num, t1.cir ; ```
16,489,364
How can I use a column whose values are circular (i.e. 1,2,3,1,2,3,1,2,3....) to calculate and output the index number of the loop? So for example in this simplified table... ``` num cir 1 1 2 2 3 3 4 1 5 2 6 3 7 1 8 2 9 3 ``` How can I get this? ``` num cir index 1 1 1 2 2 1 ...
2013/05/10
[ "https://Stackoverflow.com/questions/16489364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2360798/" ]
[Gordon Linoff is right](https://stackoverflow.com/a/16489661/297408): in SQL, tables indeed do not have inherent order. However, there still is a way to assign indices in your case. The only issue is, the order would be indeterminate and a 1 might be grouped together with a 2 that would not necessarily be the one that...
Try this ``` SELECT num, cir, @row_num := IF(@prev_cir<cir,@row_num,@row_num+1) as cir_index, @prev_cir:= cir FROM (SELECT @row_num := 0) r JOIN ( SELECT num, cir FROM mytable ORDER BY num ) t ``` First, I make sure that the records are ordered by `num`. Then I chk ...
23,161,750
Sorry if the question has already been asked. I couldn't think of the words for what I was trying to do but I have done some Google foo before asking. In the code below I'm trying to UNION onto the select query a Summary line. In the first Column of the Summary row I wanted the text Summary. I'm pretty sure I have don...
2014/04/18
[ "https://Stackoverflow.com/questions/23161750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943104/" ]
In my case, I was missing the following from my logging.conf file - ``` [formatters] keys = json ``` Below is the structure of the entire file - ``` [loggers] keys = root,__main__ [logger_root] handlers = [logger___main__] level = INFO handlers = __main__ qualname = __main__ [handlers] keys = __main__ [handler_...
Some of my logging settings were in `migrations/alembic.ini`. ``` # Logging configuration [loggers] keys = root,sqlalchemy,alembic ``` Instead of messing with it, I deleted the migrations folder, deleted the `alembic_version` table in my db, and then ran `flask db stamp heads` and then could do my normal db actions ...
23,161,750
Sorry if the question has already been asked. I couldn't think of the words for what I was trying to do but I have done some Google foo before asking. In the code below I'm trying to UNION onto the select query a Summary line. In the first Column of the Summary row I wanted the text Summary. I'm pretty sure I have don...
2014/04/18
[ "https://Stackoverflow.com/questions/23161750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943104/" ]
I had this issue because Python couldn't find my config file, though you would never know it by the error message. Apparently it does not look for the config file relative to the file in which the code is running, but rather relative to the current working directory (which you can get from `os.getcwd()`). I used the fo...
Some of my logging settings were in `migrations/alembic.ini`. ``` # Logging configuration [loggers] keys = root,sqlalchemy,alembic ``` Instead of messing with it, I deleted the migrations folder, deleted the `alembic_version` table in my db, and then ran `flask db stamp heads` and then could do my normal db actions ...
23,161,750
Sorry if the question has already been asked. I couldn't think of the words for what I was trying to do but I have done some Google foo before asking. In the code below I'm trying to UNION onto the select query a Summary line. In the first Column of the Summary row I wanted the text Summary. I'm pretty sure I have don...
2014/04/18
[ "https://Stackoverflow.com/questions/23161750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943104/" ]
Some of my logging settings were in `migrations/alembic.ini`. ``` # Logging configuration [loggers] keys = root,sqlalchemy,alembic ``` Instead of messing with it, I deleted the migrations folder, deleted the `alembic_version` table in my db, and then ran `flask db stamp heads` and then could do my normal db actions ...
in my case this error was showing up when I was trying to run my flask app on Docker container. What helped me is adding: ``` flask db init ``` into the boot.sh that runs at the beginning of container creation.
23,161,750
Sorry if the question has already been asked. I couldn't think of the words for what I was trying to do but I have done some Google foo before asking. In the code below I'm trying to UNION onto the select query a Summary line. In the first Column of the Summary row I wanted the text Summary. I'm pretty sure I have don...
2014/04/18
[ "https://Stackoverflow.com/questions/23161750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943104/" ]
d512 was correct. And when running the code and based on the PYTHONPATH, Python treats your project root directory as the 'current path' no matter where is your running file located. So another way is to add the relative path either as following: ``` logging.config.fileConfig('root_path_of_project/.../logging.conf') ...
in my case this error was showing up when I was trying to run my flask app on Docker container. What helped me is adding: ``` flask db init ``` into the boot.sh that runs at the beginning of container creation.
23,161,750
Sorry if the question has already been asked. I couldn't think of the words for what I was trying to do but I have done some Google foo before asking. In the code below I'm trying to UNION onto the select query a Summary line. In the first Column of the Summary row I wanted the text Summary. I'm pretty sure I have don...
2014/04/18
[ "https://Stackoverflow.com/questions/23161750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943104/" ]
In my case, I was missing the following from my logging.conf file - ``` [formatters] keys = json ``` Below is the structure of the entire file - ``` [loggers] keys = root,__main__ [logger_root] handlers = [logger___main__] level = INFO handlers = __main__ qualname = __main__ [handlers] keys = __main__ [handler_...
in my case this error was showing up when I was trying to run my flask app on Docker container. What helped me is adding: ``` flask db init ``` into the boot.sh that runs at the beginning of container creation.
23,161,750
Sorry if the question has already been asked. I couldn't think of the words for what I was trying to do but I have done some Google foo before asking. In the code below I'm trying to UNION onto the select query a Summary line. In the first Column of the Summary row I wanted the text Summary. I'm pretty sure I have don...
2014/04/18
[ "https://Stackoverflow.com/questions/23161750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943104/" ]
d512 was correct. And when running the code and based on the PYTHONPATH, Python treats your project root directory as the 'current path' no matter where is your running file located. So another way is to add the relative path either as following: ``` logging.config.fileConfig('root_path_of_project/.../logging.conf') ...
Try to replace ``` logging.config.fileConfig('../logging.conf', disable_existing_loggers=False) ``` with this ``` logging.config.fileConfig('logging.conf', disable_existing_loggers=False) ``` Not sure, but probably your `logging.conf` is in your current working directory, and with the `..` the file cannot be fou...
23,161,750
Sorry if the question has already been asked. I couldn't think of the words for what I was trying to do but I have done some Google foo before asking. In the code below I'm trying to UNION onto the select query a Summary line. In the first Column of the Summary row I wanted the text Summary. I'm pretty sure I have don...
2014/04/18
[ "https://Stackoverflow.com/questions/23161750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943104/" ]
I had this issue because Python couldn't find my config file, though you would never know it by the error message. Apparently it does not look for the config file relative to the file in which the code is running, but rather relative to the current working directory (which you can get from `os.getcwd()`). I used the fo...
Try to replace ``` logging.config.fileConfig('../logging.conf', disable_existing_loggers=False) ``` with this ``` logging.config.fileConfig('logging.conf', disable_existing_loggers=False) ``` Not sure, but probably your `logging.conf` is in your current working directory, and with the `..` the file cannot be fou...
23,161,750
Sorry if the question has already been asked. I couldn't think of the words for what I was trying to do but I have done some Google foo before asking. In the code below I'm trying to UNION onto the select query a Summary line. In the first Column of the Summary row I wanted the text Summary. I'm pretty sure I have don...
2014/04/18
[ "https://Stackoverflow.com/questions/23161750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943104/" ]
Try to replace ``` logging.config.fileConfig('../logging.conf', disable_existing_loggers=False) ``` with this ``` logging.config.fileConfig('logging.conf', disable_existing_loggers=False) ``` Not sure, but probably your `logging.conf` is in your current working directory, and with the `..` the file cannot be fou...
Some of my logging settings were in `migrations/alembic.ini`. ``` # Logging configuration [loggers] keys = root,sqlalchemy,alembic ``` Instead of messing with it, I deleted the migrations folder, deleted the `alembic_version` table in my db, and then ran `flask db stamp heads` and then could do my normal db actions ...
23,161,750
Sorry if the question has already been asked. I couldn't think of the words for what I was trying to do but I have done some Google foo before asking. In the code below I'm trying to UNION onto the select query a Summary line. In the first Column of the Summary row I wanted the text Summary. I'm pretty sure I have don...
2014/04/18
[ "https://Stackoverflow.com/questions/23161750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943104/" ]
I had this issue because Python couldn't find my config file, though you would never know it by the error message. Apparently it does not look for the config file relative to the file in which the code is running, but rather relative to the current working directory (which you can get from `os.getcwd()`). I used the fo...
in my case this error was showing up when I was trying to run my flask app on Docker container. What helped me is adding: ``` flask db init ``` into the boot.sh that runs at the beginning of container creation.
23,161,750
Sorry if the question has already been asked. I couldn't think of the words for what I was trying to do but I have done some Google foo before asking. In the code below I'm trying to UNION onto the select query a Summary line. In the first Column of the Summary row I wanted the text Summary. I'm pretty sure I have don...
2014/04/18
[ "https://Stackoverflow.com/questions/23161750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943104/" ]
I had this issue because Python couldn't find my config file, though you would never know it by the error message. Apparently it does not look for the config file relative to the file in which the code is running, but rather relative to the current working directory (which you can get from `os.getcwd()`). I used the fo...
In my case, I was missing the following from my logging.conf file - ``` [formatters] keys = json ``` Below is the structure of the entire file - ``` [loggers] keys = root,__main__ [logger_root] handlers = [logger___main__] level = INFO handlers = __main__ qualname = __main__ [handlers] keys = __main__ [handler_...
62,192
I have committed to taking on a summer intern and am supposed to fill the intern position by mid-March. In the meantime, I am in the final stages of a recruitment process elsewhere. While I know that the organization wants to hire me as soon as possible, the start date cannot be determined before my background check ...
2016/02/16
[ "https://workplace.stackexchange.com/questions/62192", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/46889/" ]
Over the years, I have heard about, and even encountered personally, these sorts of situations. My advice is that you proceed as though what you know to be true today will be true tomorrow and beyond. You have been asked to hire, manage, and presumably train an intern. Do that. You should absolutely, positively NOT r...
Don't bow out of anything, your current employer will smell a rat, and then if the offer does not go through, you've damaged your reputation at your current firm. Get everything in motion, and give two weeks notice as it is the professional thing to do. This maintains your reputation both with the new and old employer...
3,349,575
Im trying to do a simple rotation of a cube about the x and y axis: I want to always rotate the cube over the x axis by an amount x and rotate the cube over the yaxis by an amount y independent of the x axis rotation first i naively did : ``` glRotatef(x,1,0,0); glRotatef(y,0,1,0); ``` then but that first rotat...
2010/07/28
[ "https://Stackoverflow.com/questions/3349575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/401896/" ]
I got this to work correctly using quaternions: Im sure there are other ways, but afeter some reseatch , this worked perfectly for me. I posted a similar version on another forum. <http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=280859&#Post280859> first create the quaternion representation ...
It would help a lot if you could give a more detailed explanation of what you are trying to do and how the results you are getting differ from the results you want. But in general using Euler angles for rotation has some problems, as combining rotations can result in unintuitive behavior (and in the worst case losing a...
3,349,575
Im trying to do a simple rotation of a cube about the x and y axis: I want to always rotate the cube over the x axis by an amount x and rotate the cube over the yaxis by an amount y independent of the x axis rotation first i naively did : ``` glRotatef(x,1,0,0); glRotatef(y,0,1,0); ``` then but that first rotat...
2010/07/28
[ "https://Stackoverflow.com/questions/3349575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/401896/" ]
I got this to work correctly using quaternions: Im sure there are other ways, but afeter some reseatch , this worked perfectly for me. I posted a similar version on another forum. <http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=280859&#Post280859> first create the quaternion representation ...
It is not clear what you want to achieve. Perhaps you should think about some points and where you want them to rotate to -- e.g. vertex (1,1,1) should map to (0,1,0). Then, from that information, you can calculate the required rotation. Quaternions are generally used to interpolate between two rotational 'positions'....
3,349,575
Im trying to do a simple rotation of a cube about the x and y axis: I want to always rotate the cube over the x axis by an amount x and rotate the cube over the yaxis by an amount y independent of the x axis rotation first i naively did : ``` glRotatef(x,1,0,0); glRotatef(y,0,1,0); ``` then but that first rotat...
2010/07/28
[ "https://Stackoverflow.com/questions/3349575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/401896/" ]
I got this to work correctly using quaternions: Im sure there are other ways, but afeter some reseatch , this worked perfectly for me. I posted a similar version on another forum. <http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=280859&#Post280859> first create the quaternion representation ...
Your problem is not the gimbal lock. And effectively, there is no reason why your quaternion version would work better than your matrix (glRotate) version because the quaternions you are using are mathematically identical to your rotation matrices. If what you want is a mouse control, you probably want to check out [a...
22,779,759
I have developed the code for a popup window after clicking on a link. But what I want is to show a confirmation alert before closing the popup window. How can I achieve this? My code: ``` <script type="text/javascript"> $(document).ready(function(e) { window.onload=test_create(); function test_create() { alert(...
2014/04/01
[ "https://Stackoverflow.com/questions/22779759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
try this: ``` $(window).on('beforeunload', function(e) { alert('Close'); }); ``` or if you want to make a question if the user want really to close the page you can try this: ``` $(window).on('beforeunload', function(e) { if(confirm("Are you sure you want to close this window")){ return true; }...
Try these way Javascript: ``` window.onunload = function(){ //Do something } ``` Jquery: ``` $(window).unload(function(){ //Do something }); ```
22,779,759
I have developed the code for a popup window after clicking on a link. But what I want is to show a confirmation alert before closing the popup window. How can I achieve this? My code: ``` <script type="text/javascript"> $(document).ready(function(e) { window.onload=test_create(); function test_create() { alert(...
2014/04/01
[ "https://Stackoverflow.com/questions/22779759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
try this: ``` $(window).on('beforeunload', function(e) { alert('Close'); }); ``` or if you want to make a question if the user want really to close the page you can try this: ``` $(window).on('beforeunload', function(e) { if(confirm("Are you sure you want to close this window")){ return true; }...
The best way to create popups on `JavaScript` in my opinion is based on create div elements dinamically for have you'r on popups withs you'r own values and styles. Anyway I think you are looking for somting like `JavaScript prompt()`, take a look to [documentation](http://www.w3schools.com/jsref/met_win_prompt.asp). Th...
22,779,759
I have developed the code for a popup window after clicking on a link. But what I want is to show a confirmation alert before closing the popup window. How can I achieve this? My code: ``` <script type="text/javascript"> $(document).ready(function(e) { window.onload=test_create(); function test_create() { alert(...
2014/04/01
[ "https://Stackoverflow.com/questions/22779759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This should do: ``` $(window).on('beforeunload', function() { return confirm("Are you sure you want to leave?"); }); ```
Try these way Javascript: ``` window.onunload = function(){ //Do something } ``` Jquery: ``` $(window).unload(function(){ //Do something }); ```
22,779,759
I have developed the code for a popup window after clicking on a link. But what I want is to show a confirmation alert before closing the popup window. How can I achieve this? My code: ``` <script type="text/javascript"> $(document).ready(function(e) { window.onload=test_create(); function test_create() { alert(...
2014/04/01
[ "https://Stackoverflow.com/questions/22779759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This should do: ``` $(window).on('beforeunload', function() { return confirm("Are you sure you want to leave?"); }); ```
The best way to create popups on `JavaScript` in my opinion is based on create div elements dinamically for have you'r on popups withs you'r own values and styles. Anyway I think you are looking for somting like `JavaScript prompt()`, take a look to [documentation](http://www.w3schools.com/jsref/met_win_prompt.asp). Th...
9,139,666
I have to do a project using JDBC and MySql .. can someone guide me in this attempt to install and run these darn things? I can't figure out how and what to do. I have never worker with databases in my life, so i have no clue. What do i need to install, configure, etc? Can someone one offer some useful link for me to s...
2012/02/04
[ "https://Stackoverflow.com/questions/9139666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2064171/" ]
This one works for me ;-) ``` if (pref instanceof RingtonePreference) { Log.i("***", "RingtonePreference " + pref.getKey()); final RingtonePreference ringPref = (RingtonePreference) pref; ringPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Ove...
I have the same problem. Tried to go over the SharedPreferences value, but unfortunately the uri leads to an id like named file. ``` private void updateSummary(Preference p, SharedPreferences sharedPrefs) { if (p instanceof ListPreference) { ListPreference listPref = (ListPreference) p; p.setSumma...
54,452,137
I'm trying to find a number that is between 1.0 or 1.10 but wont be higher than 10.0 Here is what I have so far, ``` ^0$|^[1-9]{1}\.[0-9]{2}$|^10\.0$ ``` this one is working for `1.55` I tried adding an [OR](https://www.regular-expressions.info/alternation.html) to the expression, to find eg `1.5` but unfortu...
2019/01/31
[ "https://Stackoverflow.com/questions/54452137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9908376/" ]
You forgot the alternation between `[0-9]{2}$` and `^10`, if you add `|` as your begining regex did, it should work. ``` ^0$|^[1-9]{1}\.[0-9]{1}$|[1-9]{1}\.[0-9]{2}$|^10\.0$ ``` Besides, `{1}` here is not required, because it's repeated only one time. This regex is shorter: ``` ^0$|^[1-9]\.[0-9]$|[1-9]\.[0-9]{2}$|^...
You can use the following regex that accept only numbers with max 2 decimals: ``` ^0$|^[1-9](?:\.[0-9]{1,2})?$|^10(?:\.00?)?$ ``` It will also accept `10.00` and all integers without decimals from `0` to `10`. Demo: <https://regex101.com/r/tT1dX7/19> If you want to add numbers with maximum 2 decimals that are betw...
54,452,137
I'm trying to find a number that is between 1.0 or 1.10 but wont be higher than 10.0 Here is what I have so far, ``` ^0$|^[1-9]{1}\.[0-9]{2}$|^10\.0$ ``` this one is working for `1.55` I tried adding an [OR](https://www.regular-expressions.info/alternation.html) to the expression, to find eg `1.5` but unfortu...
2019/01/31
[ "https://Stackoverflow.com/questions/54452137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9908376/" ]
You forgot the alternation between `[0-9]{2}$` and `^10`, if you add `|` as your begining regex did, it should work. ``` ^0$|^[1-9]{1}\.[0-9]{1}$|[1-9]{1}\.[0-9]{2}$|^10\.0$ ``` Besides, `{1}` here is not required, because it's repeated only one time. This regex is shorter: ``` ^0$|^[1-9]\.[0-9]$|[1-9]\.[0-9]{2}$|^...
Maybe `^(?:1\.(?:0\d|[1-9]\d)|(?:[2-9]|10)\.00)$` ``` ^ (?: # 1.00 - 1.99 1 \. (?: 0 \d | [1-9] \d ) | # 2.00 - 10.00 (?: [2-9] | 10 ) \.00 ) $ ```
54,452,137
I'm trying to find a number that is between 1.0 or 1.10 but wont be higher than 10.0 Here is what I have so far, ``` ^0$|^[1-9]{1}\.[0-9]{2}$|^10\.0$ ``` this one is working for `1.55` I tried adding an [OR](https://www.regular-expressions.info/alternation.html) to the expression, to find eg `1.5` but unfortu...
2019/01/31
[ "https://Stackoverflow.com/questions/54452137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9908376/" ]
You can use the following regex that accept only numbers with max 2 decimals: ``` ^0$|^[1-9](?:\.[0-9]{1,2})?$|^10(?:\.00?)?$ ``` It will also accept `10.00` and all integers without decimals from `0` to `10`. Demo: <https://regex101.com/r/tT1dX7/19> If you want to add numbers with maximum 2 decimals that are betw...
Maybe `^(?:1\.(?:0\d|[1-9]\d)|(?:[2-9]|10)\.00)$` ``` ^ (?: # 1.00 - 1.99 1 \. (?: 0 \d | [1-9] \d ) | # 2.00 - 10.00 (?: [2-9] | 10 ) \.00 ) $ ```
23,435,653
I'm creating a website that use facebook connect, and I need the publish\_action permission for each user, unless, user can't get access to my website. But when a user register with Facebook connect, the *publish\_action* permission can be skipped ; the request is separated from the read permissions. This is an exam...
2014/05/02
[ "https://Stackoverflow.com/questions/23435653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3597441/" ]
You cannot require the publish permission to use your app.
No. People must be able to login to your app without granting publishing permissions.
37,964,425
In this code snippet (firebase doc) they have mentioned do not use user.getUid() to authenticate with your backend server. use FirebaseUser.getToken() instead. ```java FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user != null) { // Name, email address, and profile photo Url String name ...
2016/06/22
[ "https://Stackoverflow.com/questions/37964425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3559471/" ]
The uid is a unique identifier for the user. So, while it identifies the user, it does not authenticate them. A simple corollary is that my Stack Overflow ID is 209103. Knowing that, you can identify me. But to prove to Stack Overflow that you are Frank van Puffelen, requires that you know my credentials. The ID of a...
Take your requirements as an example, if you using `[GET] https://your-domain.com/api/users/$uid/balance` to retrieve user's data, then this API is not secured at all, anybody could get other user's data with a random $uid. As the comment(firebase doc) recommends, `FirebaseUser.getToken()` will get a [JWT](https://jwt...
1,873,805
If there are two numbers x and y selected at the random (1,2,3 ......3n) such that x$^2$-y$^2$ is divisible by 3 . We have to find number of pair of x,y . Itried as follows , but got stuck , can anyone help me[![enter image description here](https://i.stack.imgur.com/AcNNs.jpg)](https://i.stack.imgur.com/AcNNs.jpg)
2016/07/28
[ "https://math.stackexchange.com/questions/1873805", "https://math.stackexchange.com", "https://math.stackexchange.com/users/356141/" ]
Your answer is correct. To measure the extent of ascent/descent along a unit vector, you need the [directional derivative](https://en.wikipedia.org/wiki/Directional_derivative). For any differentiable $f$, the directional derivative along a unit vector $u$ is given by $$ D\_uf = \nabla f \cdot u $$ Note, however, tha...
Given that you already agree that $\nabla f$ points in the direction of steepest ascent: If we define the new function $g= -f$, then $g$ ascends precisely when $f$ descends, and so the direction of steepest ascent of $g$ is the direction of steepest descent of $f$. So $$\nabla g = \nabla (-f) = - \nabla f$$ is the di...
1,873,805
If there are two numbers x and y selected at the random (1,2,3 ......3n) such that x$^2$-y$^2$ is divisible by 3 . We have to find number of pair of x,y . Itried as follows , but got stuck , can anyone help me[![enter image description here](https://i.stack.imgur.com/AcNNs.jpg)](https://i.stack.imgur.com/AcNNs.jpg)
2016/07/28
[ "https://math.stackexchange.com/questions/1873805", "https://math.stackexchange.com", "https://math.stackexchange.com/users/356141/" ]
We know that: $$f(\mathbf{x} + \mathbf{v}) \approx f(\mathbf{x}) + \left < \nabla f(\mathbf{x}), \mathbf{v}\right> \;\;\;(1)$$ Let us find the vector that minimizes (1) (which is the vector of steepest descend): $$\min\_{\mathbf{v}} C(\mathbf{v}) = f(\mathbf{x}) + \left < \nabla f(\mathbf{x}), \mathbf{v}\right>$$ $$...
Given that you already agree that $\nabla f$ points in the direction of steepest ascent: If we define the new function $g= -f$, then $g$ ascends precisely when $f$ descends, and so the direction of steepest ascent of $g$ is the direction of steepest descent of $f$. So $$\nabla g = \nabla (-f) = - \nabla f$$ is the di...
15,373,982
I am a LISP newbie. To get the running sum of a list, I am writing like -- ``` (setf sum 0.0) (mapcar #'(lambda(x) (setf sum (+ sum x)) sum) values)) ``` For example, if you give `'(1 2 3 4)` as input, the above code returns `'(1 3 6 10)` as output and so forth. Is it possible to do the same thing (in a more...
2013/03/12
[ "https://Stackoverflow.com/questions/15373982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118211/" ]
You could use `loop`, like this: ``` (defun running-sum (xs) (loop with sum = 0 for x in xs collect (setf sum (+ sum x)))) (running-sum '(1 2 3 4)) ``` It's fundamentally the same thing, but it uses a local variable instead of a global one, and might be more clear. Alternatively, you could define...
In Scheme I would calculate the sum of the list recursively using an accumulator. Like so: ``` ; Computes a list of intermediary results of list summation (define list-sum (lambda (l) (letrec ((recsum (lambda (lst acc acclst) (if (pair? lst) (recsum (cdr lst) (+ acc (car lst)) (cons acc acclst)) ...
15,373,982
I am a LISP newbie. To get the running sum of a list, I am writing like -- ``` (setf sum 0.0) (mapcar #'(lambda(x) (setf sum (+ sum x)) sum) values)) ``` For example, if you give `'(1 2 3 4)` as input, the above code returns `'(1 3 6 10)` as output and so forth. Is it possible to do the same thing (in a more...
2013/03/12
[ "https://Stackoverflow.com/questions/15373982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118211/" ]
``` (loop for x in '(1 2 3 4) sum x into y collect y) ``` `scanl` is a oneliner: ``` (defun scanl (f init xs) (loop for x in xs collect (setf init (funcall f init x)))) ```
You could use `loop`, like this: ``` (defun running-sum (xs) (loop with sum = 0 for x in xs collect (setf sum (+ sum x)))) (running-sum '(1 2 3 4)) ``` It's fundamentally the same thing, but it uses a local variable instead of a global one, and might be more clear. Alternatively, you could define...
15,373,982
I am a LISP newbie. To get the running sum of a list, I am writing like -- ``` (setf sum 0.0) (mapcar #'(lambda(x) (setf sum (+ sum x)) sum) values)) ``` For example, if you give `'(1 2 3 4)` as input, the above code returns `'(1 3 6 10)` as output and so forth. Is it possible to do the same thing (in a more...
2013/03/12
[ "https://Stackoverflow.com/questions/15373982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118211/" ]
``` (loop for x in '(1 2 3 4) sum x into y collect y) ``` `scanl` is a oneliner: ``` (defun scanl (f init xs) (loop for x in xs collect (setf init (funcall f init x)))) ```
In Scheme I would calculate the sum of the list recursively using an accumulator. Like so: ``` ; Computes a list of intermediary results of list summation (define list-sum (lambda (l) (letrec ((recsum (lambda (lst acc acclst) (if (pair? lst) (recsum (cdr lst) (+ acc (car lst)) (cons acc acclst)) ...
15,373,982
I am a LISP newbie. To get the running sum of a list, I am writing like -- ``` (setf sum 0.0) (mapcar #'(lambda(x) (setf sum (+ sum x)) sum) values)) ``` For example, if you give `'(1 2 3 4)` as input, the above code returns `'(1 3 6 10)` as output and so forth. Is it possible to do the same thing (in a more...
2013/03/12
[ "https://Stackoverflow.com/questions/15373982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118211/" ]
Haskell does have a rich inventory of functions for list recursion, but we've got `reduce` at least. Here is an elementary (i. e. without the `loop` magic) functional solution: ``` (defun running-sum (lst) (reverse (reduce (lambda (acc x) (cons (+ (first acc) x) acc)) (rest ls...
In Scheme I would calculate the sum of the list recursively using an accumulator. Like so: ``` ; Computes a list of intermediary results of list summation (define list-sum (lambda (l) (letrec ((recsum (lambda (lst acc acclst) (if (pair? lst) (recsum (cdr lst) (+ acc (car lst)) (cons acc acclst)) ...
15,373,982
I am a LISP newbie. To get the running sum of a list, I am writing like -- ``` (setf sum 0.0) (mapcar #'(lambda(x) (setf sum (+ sum x)) sum) values)) ``` For example, if you give `'(1 2 3 4)` as input, the above code returns `'(1 3 6 10)` as output and so forth. Is it possible to do the same thing (in a more...
2013/03/12
[ "https://Stackoverflow.com/questions/15373982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118211/" ]
Or you could use higher-order functions ``` (define (running-sum ls) (cdr (reverse (foldl (lambda (y xs) (cons (+ (car xs) y) xs)) '(0) ls)))) ```
In Scheme I would calculate the sum of the list recursively using an accumulator. Like so: ``` ; Computes a list of intermediary results of list summation (define list-sum (lambda (l) (letrec ((recsum (lambda (lst acc acclst) (if (pair? lst) (recsum (cdr lst) (+ acc (car lst)) (cons acc acclst)) ...
15,373,982
I am a LISP newbie. To get the running sum of a list, I am writing like -- ``` (setf sum 0.0) (mapcar #'(lambda(x) (setf sum (+ sum x)) sum) values)) ``` For example, if you give `'(1 2 3 4)` as input, the above code returns `'(1 3 6 10)` as output and so forth. Is it possible to do the same thing (in a more...
2013/03/12
[ "https://Stackoverflow.com/questions/15373982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118211/" ]
``` (loop for x in '(1 2 3 4) sum x into y collect y) ``` `scanl` is a oneliner: ``` (defun scanl (f init xs) (loop for x in xs collect (setf init (funcall f init x)))) ```
Haskell does have a rich inventory of functions for list recursion, but we've got `reduce` at least. Here is an elementary (i. e. without the `loop` magic) functional solution: ``` (defun running-sum (lst) (reverse (reduce (lambda (acc x) (cons (+ (first acc) x) acc)) (rest ls...
15,373,982
I am a LISP newbie. To get the running sum of a list, I am writing like -- ``` (setf sum 0.0) (mapcar #'(lambda(x) (setf sum (+ sum x)) sum) values)) ``` For example, if you give `'(1 2 3 4)` as input, the above code returns `'(1 3 6 10)` as output and so forth. Is it possible to do the same thing (in a more...
2013/03/12
[ "https://Stackoverflow.com/questions/15373982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118211/" ]
``` (loop for x in '(1 2 3 4) sum x into y collect y) ``` `scanl` is a oneliner: ``` (defun scanl (f init xs) (loop for x in xs collect (setf init (funcall f init x)))) ```
Or you could use higher-order functions ``` (define (running-sum ls) (cdr (reverse (foldl (lambda (y xs) (cons (+ (car xs) y) xs)) '(0) ls)))) ```
10,529,846
I'm wondering if there are many other ways to print out debugging messages without line-breaking the content: ``` (function(){ var r=""; console.log("start: "); for (var i = 0; i < 10; i++) { console.log(i + " ");; //this will line-break the content } ...
2012/05/10
[ "https://Stackoverflow.com/questions/10529846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/399642/" ]
It depends on what you need. `console` object has many methods, not only `log()`. You can place all your data inside some object and call `console.dir(someObj)` for example, etc. More info you can find on [MDN](https://developer.mozilla.org/en/DOM/console)
* You could make your own "`console`", using a textarea. * You could add values to an array (`debugMessages.push(i)`) then join them (`debugMessages.join(" ")`)
33,053,074
So i've been trying to use Realm browser with Xcode so that it's easier for me to see and test my objects. But i seem to be running into a couple of problems with this. The first issue is that with Realm Browser i'm not able to actually open up my files location using the dropdown option 'open common locations' so i c...
2015/10/10
[ "https://Stackoverflow.com/questions/33053074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5325836/" ]
So i figured this out and realised that you have to be running the app using an iPhone 5s or higher
You are correct. Realm cannot be opened at the same time between processes of different architectures. iPhone 5 or earlier simulator is running as 32-bit process.
43,483,282
I'm building a web application that connects to a Predix Timeseries instance to ingest data through a websocket. When I attempt to create the socket, I get this exception: > > System.Net.WebSockets.WebSocketException: 'Unable to connect to the > remote server' > > > I'm using this code to create my websocket, wi...
2017/04/18
[ "https://Stackoverflow.com/questions/43483282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6253419/" ]
I figured out the issue. The three required headers for the Predix Timeseries are: * Predix-Zone-Id: *zone\_id\_here* * Authorization: Bearer *auth\_token\_here* * Origin: "**https://** *hostname\_here* My problem is that I tried the Origin header, but the Predix VCAP\_APPLCIATION environmental variable for the appli...
I haven't done this in C#, but "Unable to connect" sounds like it could be a network issue. Can you open a websocket to another server? Maybe this one? <https://www.websocket.org/echo.html> Could be a proxy server issue? Can you try from a different network?
43,779,685
### In swift3 document. It is recommended to use `lazy` by the two following ways: 1. directly init ---------------- ``` `lazy var someViews: UILabel = UILabel()` ``` 2. init with block ------------------ ``` lazy var overlayView: UILabel = { [unowned self] in let overlayView = UILabel() overla...
2017/05/04
[ "https://Stackoverflow.com/questions/43779685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5372683/" ]
I advice **NOT** to use the closure variant: ``` lazy var overlayView: UILabel = { [unowned self] in let overlayView = UILabel() // ... return UILabel() }() ``` Why? I made a small research myself. Follow [this link](https://stackoverflow.com/questions/41647354/default-property-value-with-closure-makes-...
Yes thats okay but your `initSomeViews()` has same concept as of using blocks. You can either directly assign a clouser to it or a method for that. > > Note: > > > If you use your lazy property in viewDidLoad: then there is no > need for declaring it as lazy. > > > -They are initialised just once and never comput...
43,779,685
### In swift3 document. It is recommended to use `lazy` by the two following ways: 1. directly init ---------------- ``` `lazy var someViews: UILabel = UILabel()` ``` 2. init with block ------------------ ``` lazy var overlayView: UILabel = { [unowned self] in let overlayView = UILabel() overla...
2017/05/04
[ "https://Stackoverflow.com/questions/43779685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5372683/" ]
I advice **NOT** to use the closure variant: ``` lazy var overlayView: UILabel = { [unowned self] in let overlayView = UILabel() // ... return UILabel() }() ``` Why? I made a small research myself. Follow [this link](https://stackoverflow.com/questions/41647354/default-property-value-with-closure-makes-...
As a matter of *safety* and *style* (I probably gonna be downvoted for this…) I savor using *implicitly unwrapped* optionals for this: ``` private var someViews: UILabel! override func viewDidLoad() { self.someViews = createSomeViews() } private func createSomeViews() -> UILabel { ... } ``` **Safety**. Running...
447,799
I'm currently playing Crysis, but I also like to play Worms Armageddon sometimes and both of them need their respective DVDs to run. I'd like to know if there's a way to copy the files off the DVD, store them in my computer and load it with a virtual DVD drive like Daemon Tools Lite?
2012/07/11
[ "https://superuser.com/questions/447799", "https://superuser.com", "https://superuser.com/users/145424/" ]
Not a buying recommendation, but Slysoft's [Game Jackal](http://www.slysoft.com/en/gamejackal.html) might be what you are after. Personally have used their DVD/BluRay equivalent for years without a problem.
this is a great app that is free and very simple to use. You can have multiple iso files mounted at once as well. And it will burn folders to isos, copy disks to isos. Lots of great stuff <http://arainia.com/software/gizmo/>
447,799
I'm currently playing Crysis, but I also like to play Worms Armageddon sometimes and both of them need their respective DVDs to run. I'd like to know if there's a way to copy the files off the DVD, store them in my computer and load it with a virtual DVD drive like Daemon Tools Lite?
2012/07/11
[ "https://superuser.com/questions/447799", "https://superuser.com", "https://superuser.com/users/145424/" ]
Yes. They're generally referred to as "NO-CD Cracks" and they're illegal to use in many countries, as you are trying to circumvent copyright protection mechanisms (that you agreed to when you bought/opened/used the game). Good news is, many countries DO allow them because it's the only way you can make your "one legit...
Not a buying recommendation, but Slysoft's [Game Jackal](http://www.slysoft.com/en/gamejackal.html) might be what you are after. Personally have used their DVD/BluRay equivalent for years without a problem.
447,799
I'm currently playing Crysis, but I also like to play Worms Armageddon sometimes and both of them need their respective DVDs to run. I'd like to know if there's a way to copy the files off the DVD, store them in my computer and load it with a virtual DVD drive like Daemon Tools Lite?
2012/07/11
[ "https://superuser.com/questions/447799", "https://superuser.com", "https://superuser.com/users/145424/" ]
Yes. They're generally referred to as "NO-CD Cracks" and they're illegal to use in many countries, as you are trying to circumvent copyright protection mechanisms (that you agreed to when you bought/opened/used the game). Good news is, many countries DO allow them because it's the only way you can make your "one legit...
this is a great app that is free and very simple to use. You can have multiple iso files mounted at once as well. And it will burn folders to isos, copy disks to isos. Lots of great stuff <http://arainia.com/software/gizmo/>
23,122,782
I've set up this rock, paper scissors game. However, the Javascript is not running and I'm not receiving any errors. Any suggestions? ``` function play(humanScore) { var computerScore = getcomputerScore(); if (humanScore == "rock") { if (computerScore == "rock") { } else if (computerScore...
2014/04/17
[ "https://Stackoverflow.com/questions/23122782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3263446/" ]
You can use `FOR XML PATH('')` in an inner query to get the concatenated values and then use it to match with `CourseEventKey` from the outer query: ``` ;WITH CTE AS ( SELECT DISTINCT ces.CourseEventKey, up.Firstname + ' ' + up.Lastname AS Name FROM InstructorCourseEventSchedule ...
You make a function that takes as a parameter of CourseEventScheduleKey and returns a concatenated string of the users. Then you can use it like: ``` select CourseEventScheduleKey, dbo.getUsersForCourse(CourseEventScheduleKey) as Users from CourseEventSchedule order by CourseEventScheduleKey ...
23,122,782
I've set up this rock, paper scissors game. However, the Javascript is not running and I'm not receiving any errors. Any suggestions? ``` function play(humanScore) { var computerScore = getcomputerScore(); if (humanScore == "rock") { if (computerScore == "rock") { } else if (computerScore...
2014/04/17
[ "https://Stackoverflow.com/questions/23122782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3263446/" ]
You can use `FOR XML PATH('')` in an inner query to get the concatenated values and then use it to match with `CourseEventKey` from the outer query: ``` ;WITH CTE AS ( SELECT DISTINCT ces.CourseEventKey, up.Firstname + ' ' + up.Lastname AS Name FROM InstructorCourseEventSchedule ...
``` select distinct ces.CourseEventKey,STUFF((SELECT ', ' +up.Firstname + ' ' + up.Lastname) AS Name FROM UserProfile up where UP.id = UserKey = ices.UserKey FOR XML PATH ('')) , 1, 1, '') AS Name) FROM InstructorCourseEventSchedule ices INNER JOIN CourseEventSchedule ...
32,191,809
```html DateTime ChangedBy ChangedColumn OldVal NewVal 08/24/2015 08:50:27 AM john@test.com lastname John Doe 08/24/2015 08:50:27 AM john@test.com lastname NULL Doe 08/25/2015 05:40:27 AM jane@test.com lastname Jane Doe 08/25/2015 05:40:27 AM jane@test.com...
2015/08/24
[ "https://Stackoverflow.com/questions/32191809", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1603559/" ]
It really works for me with Vaadin 7.4.5: ``` calendar.setHandler((EventMoveHandler)null); calendar.setHandler((EventResizeHandler)null); ```
If you want to disable all handlers and make the calendar completely read-only, this worked for me. ``` calendar.setReadOnly(true); ``` EDIT1: This approach however doesn't disable resize pointers for the events. Thus, the best solution I see is to use it together with [asmellado](https://stackoverflow.com/users/372...
13,114,268
Environment: Fedora 15 x64 (yes, we are moving away from it), git 1.7.11.1. We're hitting a problem with git clone which fails on an https repository because the cipher that's used by the Git server isn't enabled by default on the client. We managed to replicate the problem with plain "curl -v" (curl 7.21.3, but git ...
2012/10/28
[ "https://Stackoverflow.com/questions/13114268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/164137/" ]
You could calculate the average performance difference caused by the difference in file size as the time it would take to fetch one more TCP/IP package times the probability that it would happen because of that change (i.e. package size divived by the number of characters added). You might get something like `10 ms * ...
The difference between the two would be very marginal, I'd be more concerned about code maintainability and *maybe* [selector performance](https://stackoverflow.com/a/11218699/1081234). If you're really in a position where the benefit from individual bytes shaved off html adds up to something significant, you may want...
43,105,138
I have a script that scraps a list of IPs from a router. The final output should look like this: ``` if net ~ [ 12.5.161.0/24, 12.9.242.0/24, 12.11.215.0/24, 12.17.239.0/24, .... etc etc 216.248.237.0/24, 216.248.238.0/24, 216.248.239.0/24, 216.251.224.0/19, 216.253.79.0/24 ] then { accept; } else { reject; } ...
2017/03/29
[ "https://Stackoverflow.com/questions/43105138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7323221/" ]
You've placed `style="display: flex;"` on your `ul`. By default `flex` containers do not wrap. If you want it to wrap, you need to add ``` flex-wrap:wrap; ``` ...to it. Or, if you only want it to apply on some screen widths, move that declaration in a `CSS` file, where you'll be able to use `@media` queries. Not...
You better use @media queries. Set the @media query based on your target screen. Your button's text is too lengthy as well so it would be best if you display your lists by block to prevent overlapping the screen size. Mobile View: ``` @media all and (max-width: 479px) { ul.btn-group { display: block; } ul.btn-group l...
43,105,138
I have a script that scraps a list of IPs from a router. The final output should look like this: ``` if net ~ [ 12.5.161.0/24, 12.9.242.0/24, 12.11.215.0/24, 12.17.239.0/24, .... etc etc 216.248.237.0/24, 216.248.238.0/24, 216.248.239.0/24, 216.251.224.0/19, 216.253.79.0/24 ] then { accept; } else { reject; } ...
2017/03/29
[ "https://Stackoverflow.com/questions/43105138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7323221/" ]
You've placed `style="display: flex;"` on your `ul`. By default `flex` containers do not wrap. If you want it to wrap, you need to add ``` flex-wrap:wrap; ``` ...to it. Or, if you only want it to apply on some screen widths, move that declaration in a `CSS` file, where you'll be able to use `@media` queries. Not...
I would remove the `style="display: flex;"` from you `ul`tag. Without it the two buttons will be full width (they have the `col-xs-12` class). To have them in one line in case the modal is displayed larger on larger screens you can add an additional class like `col-sm-6` or `col-md-6` to both.
27,149,787
In old jsf the following code was working ``` <navigation-rule> <from-view-id>/page1.xhtml</from-view-id> <navigation-case> <from-outcome>true</from-outcome> <to-view-id>/page2.xhtml</to-view-id> <redirect> <view-param> <name>id</name> <value>...
2014/11/26
[ "https://Stackoverflow.com/questions/27149787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3041392/" ]
You can do it the old way. Instead of using `<redirect-param>` use `<view-param>`. The xsd (<http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd>) will mark it as false but mojarra javax.faces-2.2.8 will silently use it the right way you want it. Edit: The XSD will be fixed in the Mojarra 2.3 release, see the o...
Try using `include-view-params="true"` attribute in `<redirect>` element of `faces-config.xml` instead of declaring parameters using `<view-param>` tag. Also be sure to declare `<f:viewParam>` in the target page (`page2.xhtml`). I believe I made your example work as you expected like this: **Navigation rule in...
27,149,787
In old jsf the following code was working ``` <navigation-rule> <from-view-id>/page1.xhtml</from-view-id> <navigation-case> <from-outcome>true</from-outcome> <to-view-id>/page2.xhtml</to-view-id> <redirect> <view-param> <name>id</name> <value>...
2014/11/26
[ "https://Stackoverflow.com/questions/27149787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3041392/" ]
You can do it the old way. Instead of using `<redirect-param>` use `<view-param>`. The xsd (<http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd>) will mark it as false but mojarra javax.faces-2.2.8 will silently use it the right way you want it. Edit: The XSD will be fixed in the Mojarra 2.3 release, see the o...
Use the old `<view-param>` tag on configuration, as Jaxt0r mentioned on <https://stackoverflow.com/a/34773335/2521247> This is a bug on JSF that is fixed for 2.3. See <https://github.com/eclipse-ee4j/mojarra/issues/3403>
73,564,525
How can I perform List Comprehension on following Code. ``` records = [] for _ in range(int(input("Enter Range:"))): name = input('Enter Name') score = float(input('Enter Score')) records.append([name, score]) print(records) ```
2022/09/01
[ "https://Stackoverflow.com/questions/73564525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12251760/" ]
The thing is here, You have `List<User>users`, To add data on it, you need to provide a User model. You've single TextFiled, for now just add name from getting text from it. Firstly, put `user` outside the build method. ```dart List<User> users = User.fromJsonToList(allData()); @override Widget build(BuildCont...
You can add user on press ok in your dialog then pop the dialog eg ``` actions: <Widget>[ MaterialButton( elevation: 5.0, child: Text("OK"), onPressed: () { final myuserData=User(firstName: customController.text...other fields)) users.add(myuserData...
73,564,525
How can I perform List Comprehension on following Code. ``` records = [] for _ in range(int(input("Enter Range:"))): name = input('Enter Name') score = float(input('Enter Score')) records.append([name, score]) print(records) ```
2022/09/01
[ "https://Stackoverflow.com/questions/73564525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12251760/" ]
First do this: ``` Future<String> createAlertDialog(BuildContext context) async { TextEditingController customController = new TextEditingController(); var reault = await showDialog( context: context, builder: (context) { return AlertDialog( title: Text("Name of the User")...
You can add user on press ok in your dialog then pop the dialog eg ``` actions: <Widget>[ MaterialButton( elevation: 5.0, child: Text("OK"), onPressed: () { final myuserData=User(firstName: customController.text...other fields)) users.add(myuserData...
73,564,525
How can I perform List Comprehension on following Code. ``` records = [] for _ in range(int(input("Enter Range:"))): name = input('Enter Name') score = float(input('Enter Score')) records.append([name, score]) print(records) ```
2022/09/01
[ "https://Stackoverflow.com/questions/73564525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12251760/" ]
The thing is here, You have `List<User>users`, To add data on it, you need to provide a User model. You've single TextFiled, for now just add name from getting text from it. Firstly, put `user` outside the build method. ```dart List<User> users = User.fromJsonToList(allData()); @override Widget build(BuildCont...
First do this: ``` Future<String> createAlertDialog(BuildContext context) async { TextEditingController customController = new TextEditingController(); var reault = await showDialog( context: context, builder: (context) { return AlertDialog( title: Text("Name of the User")...
27,513,169
I have data from two different source locations that need to be combined into one. I am assuming I would want to do this with a merge or a merge join, but I am unsure of what exactly I need to do. `Table 1` has the same fields as `Table 2` but the data is different which is why I would like to combine them into one d...
2014/12/16
[ "https://Stackoverflow.com/questions/27513169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1480714/" ]
Instead of making an entirely new table which will need to be updated again every time Table 1 or 2 changes, you could use a combination of views and UNIONs. In other words create a view that is the result of a UNION query between your two tables. To get rid of duplicates you could group by whatever column uniquely ide...
This sounds like a pretty classic merge. Create your source and destination connections. Put in a Data Flow task. Put both sources into the Data Flow. Make sure the sources are both sorted and connect them to a Merge. You can either add in a Sort transformation between the connection and the Merge or sort them using a ...
27,513,169
I have data from two different source locations that need to be combined into one. I am assuming I would want to do this with a merge or a merge join, but I am unsure of what exactly I need to do. `Table 1` has the same fields as `Table 2` but the data is different which is why I would like to combine them into one d...
2014/12/16
[ "https://Stackoverflow.com/questions/27513169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1480714/" ]
Instead of Merge and Sort , Use union all Sort. because Merge transform need two sorted input and performance will be decreased 1)Give Source1 & Source2 as input to UnionALL Transformation 2) Give Output of UnionALL transfromation to Sort transformation and check remove duplicate keys.
This sounds like a pretty classic merge. Create your source and destination connections. Put in a Data Flow task. Put both sources into the Data Flow. Make sure the sources are both sorted and connect them to a Merge. You can either add in a Sort transformation between the connection and the Merge or sort them using a ...
960,470
True of false: if G and H are two groups with the same order and both are abelian, then they are isomorphic.
2014/10/06
[ "https://math.stackexchange.com/questions/960470", "https://math.stackexchange.com", "https://math.stackexchange.com/users/179888/" ]
False. $\mathbb{Z\_4}$ and $\mathbb{Z\_2}\times\mathbb{Z\_2}$ have order $4$ but not isomorphic
Only if the order is square-free.
1,796,715
> > Find the value of the integral $$\int\limits\_{0}^{+\infty}\left(\frac{x^2}{e^x-1}\right)^2\;\mathrm{d}x\;.$$ > > > We can let $x=\ln{t}$ to get $$\int\limits\_{1}^{+\infty}\frac{(\ln{t})^4}{t(t-1)^2}\;\mathrm{d}t\;.$$ But how can we evaluate it from there?
2016/05/23
[ "https://math.stackexchange.com/questions/1796715", "https://math.stackexchange.com", "https://math.stackexchange.com/users/58742/" ]
Since $$ \frac{1}{(e^x-1)^2} = \sum\_{n\geq 1} n e^{-(n+1)x} \tag{1}$$ and $$ \int\_{0}^{+\infty} nx^4 e^{-(n+1)x}\,dx = \frac{24\,n}{(1+n)^5}\tag{2}$$ it follows that: > > $$ \int\_{0}^{+\infty}\left(\frac{x^2}{e^{x}-1}\right)^2\,dx = 24\sum\_{n\geq 1}\frac{n}{(1+n)^5} = \color{red}{\frac{4}{15}\left(\pi^4-90\,\zet...
Using your substitution, we can continue in the following way: $$I=\int\_{1}^{+\infty}\dfrac{\ln^4{t}}{t(t-1)^2}dt$$ Let's make another substitution: $$y=\frac{1}{t}$$ $$I=\int\_{0}^{1}\frac{y \ln^4{y}}{(1-y)^2}dy$$ Integrating by parts with: $$u=y \ln^4{y},~~~~~~~dv=\frac{dy}{(1-y)^2}$$ We obtain: $$I=\int\_{0...
1,796,715
> > Find the value of the integral $$\int\limits\_{0}^{+\infty}\left(\frac{x^2}{e^x-1}\right)^2\;\mathrm{d}x\;.$$ > > > We can let $x=\ln{t}$ to get $$\int\limits\_{1}^{+\infty}\frac{(\ln{t})^4}{t(t-1)^2}\;\mathrm{d}t\;.$$ But how can we evaluate it from there?
2016/05/23
[ "https://math.stackexchange.com/questions/1796715", "https://math.stackexchange.com", "https://math.stackexchange.com/users/58742/" ]
Since $$ \frac{1}{(e^x-1)^2} = \sum\_{n\geq 1} n e^{-(n+1)x} \tag{1}$$ and $$ \int\_{0}^{+\infty} nx^4 e^{-(n+1)x}\,dx = \frac{24\,n}{(1+n)^5}\tag{2}$$ it follows that: > > $$ \int\_{0}^{+\infty}\left(\frac{x^2}{e^{x}-1}\right)^2\,dx = 24\sum\_{n\geq 1}\frac{n}{(1+n)^5} = \color{red}{\frac{4}{15}\left(\pi^4-90\,\zet...
The integral representation of polylogarithm function is $$ \mathrm{Li}\_\nu(z)=\frac{z}{\Gamma(\nu)}\int\_0^\infty\frac{x^{\nu-1}}{\mathrm e^x-z}\mathrm d x $$ and differentiating with respect to $z$ we have $$ \mathrm{Li}'\_\nu(z)=\frac{1}{\Gamma(\nu)}\int\_0^\infty\frac{x^{\nu-1}}{\mathrm e^x-z}\mathrm d x+\frac{z}{...
1,796,715
> > Find the value of the integral $$\int\limits\_{0}^{+\infty}\left(\frac{x^2}{e^x-1}\right)^2\;\mathrm{d}x\;.$$ > > > We can let $x=\ln{t}$ to get $$\int\limits\_{1}^{+\infty}\frac{(\ln{t})^4}{t(t-1)^2}\;\mathrm{d}t\;.$$ But how can we evaluate it from there?
2016/05/23
[ "https://math.stackexchange.com/questions/1796715", "https://math.stackexchange.com", "https://math.stackexchange.com/users/58742/" ]
Since $$ \frac{1}{(e^x-1)^2} = \sum\_{n\geq 1} n e^{-(n+1)x} \tag{1}$$ and $$ \int\_{0}^{+\infty} nx^4 e^{-(n+1)x}\,dx = \frac{24\,n}{(1+n)^5}\tag{2}$$ it follows that: > > $$ \int\_{0}^{+\infty}\left(\frac{x^2}{e^{x}-1}\right)^2\,dx = 24\sum\_{n\geq 1}\frac{n}{(1+n)^5} = \color{red}{\frac{4}{15}\left(\pi^4-90\,\zet...
Let \begin{equation} f(x) = \frac{1}{(\mathrm{e}^{x}-1)^{2}} \end{equation} Then the Mellin transform of the function is \begin{equation} \mathcal{M}[f](s) = \int\limits\_{0}^{\infty} \frac{x^{s-1}}{(\mathrm{e}^{x}-1)^{2}} \mathrm{d} x = \Gamma(s)[\zeta(s-1) - \zeta(s)] \end{equation} For $s=5$, we have \begin{equation...
1,796,715
> > Find the value of the integral $$\int\limits\_{0}^{+\infty}\left(\frac{x^2}{e^x-1}\right)^2\;\mathrm{d}x\;.$$ > > > We can let $x=\ln{t}$ to get $$\int\limits\_{1}^{+\infty}\frac{(\ln{t})^4}{t(t-1)^2}\;\mathrm{d}t\;.$$ But how can we evaluate it from there?
2016/05/23
[ "https://math.stackexchange.com/questions/1796715", "https://math.stackexchange.com", "https://math.stackexchange.com/users/58742/" ]
Using your substitution, we can continue in the following way: $$I=\int\_{1}^{+\infty}\dfrac{\ln^4{t}}{t(t-1)^2}dt$$ Let's make another substitution: $$y=\frac{1}{t}$$ $$I=\int\_{0}^{1}\frac{y \ln^4{y}}{(1-y)^2}dy$$ Integrating by parts with: $$u=y \ln^4{y},~~~~~~~dv=\frac{dy}{(1-y)^2}$$ We obtain: $$I=\int\_{0...
Let \begin{equation} f(x) = \frac{1}{(\mathrm{e}^{x}-1)^{2}} \end{equation} Then the Mellin transform of the function is \begin{equation} \mathcal{M}[f](s) = \int\limits\_{0}^{\infty} \frac{x^{s-1}}{(\mathrm{e}^{x}-1)^{2}} \mathrm{d} x = \Gamma(s)[\zeta(s-1) - \zeta(s)] \end{equation} For $s=5$, we have \begin{equation...
1,796,715
> > Find the value of the integral $$\int\limits\_{0}^{+\infty}\left(\frac{x^2}{e^x-1}\right)^2\;\mathrm{d}x\;.$$ > > > We can let $x=\ln{t}$ to get $$\int\limits\_{1}^{+\infty}\frac{(\ln{t})^4}{t(t-1)^2}\;\mathrm{d}t\;.$$ But how can we evaluate it from there?
2016/05/23
[ "https://math.stackexchange.com/questions/1796715", "https://math.stackexchange.com", "https://math.stackexchange.com/users/58742/" ]
The integral representation of polylogarithm function is $$ \mathrm{Li}\_\nu(z)=\frac{z}{\Gamma(\nu)}\int\_0^\infty\frac{x^{\nu-1}}{\mathrm e^x-z}\mathrm d x $$ and differentiating with respect to $z$ we have $$ \mathrm{Li}'\_\nu(z)=\frac{1}{\Gamma(\nu)}\int\_0^\infty\frac{x^{\nu-1}}{\mathrm e^x-z}\mathrm d x+\frac{z}{...
Let \begin{equation} f(x) = \frac{1}{(\mathrm{e}^{x}-1)^{2}} \end{equation} Then the Mellin transform of the function is \begin{equation} \mathcal{M}[f](s) = \int\limits\_{0}^{\infty} \frac{x^{s-1}}{(\mathrm{e}^{x}-1)^{2}} \mathrm{d} x = \Gamma(s)[\zeta(s-1) - \zeta(s)] \end{equation} For $s=5$, we have \begin{equation...
57,028,042
What does the line ``` import m from '..'; ``` really means? Source: [Here](https://github.com/sindresorhus/eslint-formatter-pretty/blob/master/test/test.js#L5)
2019/07/14
[ "https://Stackoverflow.com/questions/57028042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9514156/" ]
It's the same as ``` import m from '../index.js' ```
`..` mean the parent directory of that file, so the import should bring in all modules found in the parent directory, in this case that's importing `index.js`.
57,028,042
What does the line ``` import m from '..'; ``` really means? Source: [Here](https://github.com/sindresorhus/eslint-formatter-pretty/blob/master/test/test.js#L5)
2019/07/14
[ "https://Stackoverflow.com/questions/57028042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9514156/" ]
It's a default import from the parent folder. It's short for ``` import { default as m } from '../index.js'; ``` (assuming [node.js rules](https://nodejs.org/api/esm.html) for resolving module paths) and refers to [this file](https://github.com/sindresorhus/eslint-formatter-pretty/blob/master/index.js).
`..` mean the parent directory of that file, so the import should bring in all modules found in the parent directory, in this case that's importing `index.js`.
48,298
First off, I'll state that I'm aware many questions get asked about the c-index. I've searched this site and others, and I haven't found an answer for my situation. I can successfully use `validate()` in the `rms` package to calculate the Dxy and c-index for my boot-strapped internal validation. Now I need a c-index fo...
2013/01/22
[ "https://stats.stackexchange.com/questions/48298", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/18008/" ]
I just got an explanation from a colleague about how to use this feature. In the help page for `rcorr.cens()`, it states that `x` is a "numeric predictor variable". I thought that this meant it had to be a model variable like Age, Stage, Metastasis, etc. What I found out is that `x` can just be a vector of your model's...
There is a package, which is a component of bioconductor that can help you calculate the c-index : [survcomp](http://www.bioconductor.org/packages/release/bioc/html/survcomp.html) If you don't include survival data, than cindex in survcomp is basically the same as the AUC you get from the ROC curve.
48,298
First off, I'll state that I'm aware many questions get asked about the c-index. I've searched this site and others, and I haven't found an answer for my situation. I can successfully use `validate()` in the `rms` package to calculate the Dxy and c-index for my boot-strapped internal validation. Now I need a c-index fo...
2013/01/22
[ "https://stats.stackexchange.com/questions/48298", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/18008/" ]
I just got an explanation from a colleague about how to use this feature. In the help page for `rcorr.cens()`, it states that `x` is a "numeric predictor variable". I thought that this meant it had to be a model variable like Age, Stage, Metastasis, etc. What I found out is that `x` can just be a vector of your model's...
I think code provided by @JJM could work with some changes. The point raised by @Seanosapien could be addressed by following edited code. ``` library(rms) surv.obj=with(veteran,Surv(time,status)) ####This will NOT be used for rcorr.cens cox.mod=cph(surv.obj~celltype+karno,data=veteran,x=T,y=T,surv=TRUE,time.inc=5*36...
48,298
First off, I'll state that I'm aware many questions get asked about the c-index. I've searched this site and others, and I haven't found an answer for my situation. I can successfully use `validate()` in the `rms` package to calculate the Dxy and c-index for my boot-strapped internal validation. Now I need a c-index fo...
2013/01/22
[ "https://stats.stackexchange.com/questions/48298", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/18008/" ]
There is a package, which is a component of bioconductor that can help you calculate the c-index : [survcomp](http://www.bioconductor.org/packages/release/bioc/html/survcomp.html) If you don't include survival data, than cindex in survcomp is basically the same as the AUC you get from the ROC curve.
I think code provided by @JJM could work with some changes. The point raised by @Seanosapien could be addressed by following edited code. ``` library(rms) surv.obj=with(veteran,Surv(time,status)) ####This will NOT be used for rcorr.cens cox.mod=cph(surv.obj~celltype+karno,data=veteran,x=T,y=T,surv=TRUE,time.inc=5*36...
5,018,269
I'm following along with Yehuda's example on how to build a custom renderer for Rails 3, according to this post: <http://www.engineyard.com/blog/2010/render-options-in-rails-3/> I've got my code working, but I'm having a hard time figuring out where this code should live. Right now, I've got my code stuck right inside...
2011/02/16
[ "https://Stackoverflow.com/questions/5018269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93448/" ]
I'd put it in an initializer, or in lib and require it in application controller.
In Jose Valim's book, [Crafting Rails applications](http://pragprog.com/titles/jvrails/crafting-rails-applications), this is the first chapter. He creates a PDF mime type & renderer using Prawn. In his example, he created `lib/pdf_renderer.rb` with this: ``` require "action_controller" Mime::Type.register "applicati...
5,018,269
I'm following along with Yehuda's example on how to build a custom renderer for Rails 3, according to this post: <http://www.engineyard.com/blog/2010/render-options-in-rails-3/> I've got my code working, but I'm having a hard time figuring out where this code should live. Right now, I've got my code stuck right inside...
2011/02/16
[ "https://Stackoverflow.com/questions/5018269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93448/" ]
I'd put it in an initializer, or in lib and require it in application controller.
i did some more digging around on this based on the suggestions here. i found a "mime\_types" initializer was already in our code base. i think this is created by rails, by default. it had several commented out examples in it. so i added my custom mime type to this file. i also decided to use an initializer for the ...
5,018,269
I'm following along with Yehuda's example on how to build a custom renderer for Rails 3, according to this post: <http://www.engineyard.com/blog/2010/render-options-in-rails-3/> I've got my code working, but I'm having a hard time figuring out where this code should live. Right now, I've got my code stuck right inside...
2011/02/16
[ "https://Stackoverflow.com/questions/5018269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93448/" ]
In Jose Valim's book, [Crafting Rails applications](http://pragprog.com/titles/jvrails/crafting-rails-applications), this is the first chapter. He creates a PDF mime type & renderer using Prawn. In his example, he created `lib/pdf_renderer.rb` with this: ``` require "action_controller" Mime::Type.register "applicati...
i did some more digging around on this based on the suggestions here. i found a "mime\_types" initializer was already in our code base. i think this is created by rails, by default. it had several commented out examples in it. so i added my custom mime type to this file. i also decided to use an initializer for the ...
37,797,937
I would like to create an incidence matrix. I have a file with 3 columns, like: ``` id x y A 22 2 B 4 21 C 21 360 D 26 2 E 22 58 F 2 347 ``` And I want a matrix like (without col and row names): ``` 2 4 21 22 26 58 347 360 A 1 0 0 1 0 0 0 0 B 0 1 1 0 0 0 ...
2016/06/13
[ "https://Stackoverflow.com/questions/37797937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6406139/" ]
`NamedArrays` is a neat package which allows naming both rows and columns and seems to fit the bill for this problem. Suppose the data is in `data.csv`, here is one method to go about it (install `NamedArrays` with `Pkg.add("NamedArrays")`): ``` data,header = readcsv("data.csv",header=true); # get the column names by ...
Here is a slight variation on something that I use for creating sparse matrices out of categorical variables for regression analyses. The function includes a variety of comments and options to suit it to your needs. Note: as written, it treats the appearances of "2" and "21" in x and y as separate. It is far less elega...
28,106,055
I am trying to grasp the concept of recursion and I just cannot make sense of it. Can someone please explain to me why it works the way it does? When I see this code, I expect the only thing to print is 1, as that is when it finally quits calling itself, and that is what it returns on the last call. ``` def Fib(n): ...
2015/01/23
[ "https://Stackoverflow.com/questions/28106055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3724263/" ]
``` class noisyOne(): def __init__(self, val=1): self.val = val def __add__(self, other): print("**Adding {0} with {1}**".format(self.val, other.val)) return noisyOne(self.val + other.val) def __str__(self): return str(self.val) def Fib(n, side): if n == 1 or n == 2: ...
You forgot return the value of foo(n-1) which will not be a recursion function, it will return None by default. Try this way: ``` def foo(n): if n == 1: return 1 else: return foo(n-1) print foo(10) ``` When you call the function, no matter which the number is, it will return 1 forever. First...
28,106,055
I am trying to grasp the concept of recursion and I just cannot make sense of it. Can someone please explain to me why it works the way it does? When I see this code, I expect the only thing to print is 1, as that is when it finally quits calling itself, and that is what it returns on the last call. ``` def Fib(n): ...
2015/01/23
[ "https://Stackoverflow.com/questions/28106055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3724263/" ]
The code won't print 1 because the only way for the function to return 1 is when the parameter `n` is either 1 or 2. So when you say `print Fib(10)`, the result will not be 1. Instead, the control goes to the next line after the `if` statement (`return Fib(n-1) + Fib(n-2)`), which calls `Fib` again, this time with 9 a...
You forgot return the value of foo(n-1) which will not be a recursion function, it will return None by default. Try this way: ``` def foo(n): if n == 1: return 1 else: return foo(n-1) print foo(10) ``` When you call the function, no matter which the number is, it will return 1 forever. First...
28,106,055
I am trying to grasp the concept of recursion and I just cannot make sense of it. Can someone please explain to me why it works the way it does? When I see this code, I expect the only thing to print is 1, as that is when it finally quits calling itself, and that is what it returns on the last call. ``` def Fib(n): ...
2015/01/23
[ "https://Stackoverflow.com/questions/28106055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3724263/" ]
I think the key you're missing is that method calling creates a *stack*. So think about the sequence of calls. The first call is with the argument `10`. So here's our call stack: ``` __main__ Fib(10) ``` where our current subroutine (method) is at the bottom. Then `Fib(10)` calls the subroutine with the argument `...
You forgot return the value of foo(n-1) which will not be a recursion function, it will return None by default. Try this way: ``` def foo(n): if n == 1: return 1 else: return foo(n-1) print foo(10) ``` When you call the function, no matter which the number is, it will return 1 forever. First...
38,117,298
[Screenshot of the file](http://i.stack.imgur.com/qNYFU.png)I have a file which contains multiple lines ``` Source Path Target Path xxxx/out/reportname1.pdf xxxx/out/Reports/reportname1.pdf xxxx/out/reportname2.txt xxxx/out/Reports/reportname2.txt xxxx/out/reportname3.csv ...
2016/06/30
[ "https://Stackoverflow.com/questions/38117298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5702606/" ]
Search for `\/Reports\/(.*?\.pdf)` and replace with `/PDFReports/$1`
You would need to use replacing with regex syntax (ctrl+H by default) Try something like: Find what: ``` \/Reports\/(.*\.pdf) ``` Replace with: ``` /PDFReports/$1 ``` And use "regular expression" search mode. This mechanism is called [capture group](http://www.regular-expressions.info/brackets.html) - braces i...
38,117,298
[Screenshot of the file](http://i.stack.imgur.com/qNYFU.png)I have a file which contains multiple lines ``` Source Path Target Path xxxx/out/reportname1.pdf xxxx/out/Reports/reportname1.pdf xxxx/out/reportname2.txt xxxx/out/Reports/reportname2.txt xxxx/out/reportname3.csv ...
2016/06/30
[ "https://Stackoverflow.com/questions/38117298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5702606/" ]
You would need to use replacing with regex syntax (ctrl+H by default) Try something like: Find what: ``` \/Reports\/(.*\.pdf) ``` Replace with: ``` /PDFReports/$1 ``` And use "regular expression" search mode. This mechanism is called [capture group](http://www.regular-expressions.info/brackets.html) - braces i...
searching pattern: `([\w\_]+\.\w+)` replace to: `Reports/$1` output: ``` xxxx/out/Reports/reportname1.pdf xxxx/out/Reports/reportname2.txt xxxx/out/Reports/reportname3.csv ``` EDIT: since filenames could containt \_, little upgrade.
38,117,298
[Screenshot of the file](http://i.stack.imgur.com/qNYFU.png)I have a file which contains multiple lines ``` Source Path Target Path xxxx/out/reportname1.pdf xxxx/out/Reports/reportname1.pdf xxxx/out/reportname2.txt xxxx/out/Reports/reportname2.txt xxxx/out/reportname3.csv ...
2016/06/30
[ "https://Stackoverflow.com/questions/38117298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5702606/" ]
Search for `\/Reports\/(.*?\.pdf)` and replace with `/PDFReports/$1`
searching pattern: `([\w\_]+\.\w+)` replace to: `Reports/$1` output: ``` xxxx/out/Reports/reportname1.pdf xxxx/out/Reports/reportname2.txt xxxx/out/Reports/reportname3.csv ``` EDIT: since filenames could containt \_, little upgrade.
63,114,489
I am writing a code where the program draws the amount of cards that was determined by the user. This is my code: ``` from random import randrange class Card: def __init__(self, rank, suit): self.rank = rank self.suit = suit self.ranks = [None, "ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "ja...
2020/07/27
[ "https://Stackoverflow.com/questions/63114489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13708512/" ]
Try converting the string to an integer: ``` for i in range(int(n)): ``` In addition, to handle input errors: ``` try: n = int(n) except ValueError: print('{} was not recognized as an integer.'.format(n)) ```
You can use [`int()`](https://docs.python.org/3.4/library/functions.html?highlight=int#int) to convert the string into an integer. You might also want to use some form of error handling to catch any exceptions in case the user enters something that cannot be parsed.
63,114,489
I am writing a code where the program draws the amount of cards that was determined by the user. This is my code: ``` from random import randrange class Card: def __init__(self, rank, suit): self.rank = rank self.suit = suit self.ranks = [None, "ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "ja...
2020/07/27
[ "https://Stackoverflow.com/questions/63114489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13708512/" ]
Try converting the string to an integer: ``` for i in range(int(n)): ``` In addition, to handle input errors: ``` try: n = int(n) except ValueError: print('{} was not recognized as an integer.'.format(n)) ```
The error is here: ``` n = input("Enter the number of cards to draw: ") ``` The `n` variable type is: `str` [![enter image description here](https://i.stack.imgur.com/r3n2V.png)](https://i.stack.imgur.com/r3n2V.png) One solution is: ``` n = int(input("Enter the number of cards to draw: ")) ``` Here is the full ...
12,729,187
This includes a sample code from a previous question "[IndexedDB Fuzzy Search](https://stackoverflow.com/questions/7086180/indexeddb-fuzzy-search/8961462#8961462)". How can I bound the cursor result to a input box to create a auto-complete effect and fill multiple input boxes of a form with the different values from th...
2012/10/04
[ "https://Stackoverflow.com/questions/12729187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1639234/" ]
It's a strange setup that you want with this. To disable a parent menu link, you just set the page properties to 'disabled'. This makes a page not clickable in the menu. However, if for some reason you want admins to be able to click a menu item, but no other users, then I would suggest that you set up the parent me...
In DNN 9.00.01 the Disabled option is not there.So in that case u need to Go to your DNN database and update the `Tabs table` `DisableLink` Column value from `0` to `1`
18,043,432
Iv almost finished working on a website. The website is a html5 one page site. But the problem is that one page of the page isn't working. Its the weblinks section. Its a drop down box that displays links when a selection is made I'm not sure why. It uses java script , so that may be the issue. (I'm not good with ja...
2013/08/04
[ "https://Stackoverflow.com/questions/18043432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1577142/" ]
> > "I don´t like to read the order of functions from right to left in haskell. To fix this, I added a little useful operator." > > > "still don`t know anything about monads, types and classes" > > > I don't think that trying to "fix" something in the language without understanding its basic concepts is a good i...
`>>=` has the type `m a -> (a -> m b) -> m b`. In the case where `m` is a `[]` (a list), it does behave like `concatMap` because then the types line up nicely. What you've written is a completely different type so you can't expect them to work the same. Incidentally, what you've written is already defined exactly that...
18,043,432
Iv almost finished working on a website. The website is a html5 one page site. But the problem is that one page of the page isn't working. Its the weblinks section. Its a drop down box that displays links when a selection is made I'm not sure why. It uses java script , so that may be the issue. (I'm not good with ja...
2013/08/04
[ "https://Stackoverflow.com/questions/18043432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1577142/" ]
`>>=` has the type `m a -> (a -> m b) -> m b`. In the case where `m` is a `[]` (a list), it does behave like `concatMap` because then the types line up nicely. What you've written is a completely different type so you can't expect them to work the same. Incidentally, what you've written is already defined exactly that...
The monadic bind operator `>>=` always returns something 'wrapped' in a monad, so it probably isn't what you want. Your `>>>` operator should work fine with a little adjustment, although it might not make sense to mix it with `$` as you are doing there. If anything it's just confusing! The adjustment you will need is...
18,043,432
Iv almost finished working on a website. The website is a html5 one page site. But the problem is that one page of the page isn't working. Its the weblinks section. Its a drop down box that displays links when a selection is made I'm not sure why. It uses java script , so that may be the issue. (I'm not good with ja...
2013/08/04
[ "https://Stackoverflow.com/questions/18043432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1577142/" ]
`>>=` has the type `m a -> (a -> m b) -> m b`. In the case where `m` is a `[]` (a list), it does behave like `concatMap` because then the types line up nicely. What you've written is a completely different type so you can't expect them to work the same. Incidentally, what you've written is already defined exactly that...
1. I think it's called `|>` in F#: `main = print $ [1..10] |> map (*2) |> filter (>5) |> foldr1 (+)` Note that `|>` is asymmetric in its argument types: it expects a value, and a function, and applies the value to a function: `x |> f = f x`. It is, of course, just `($)` flipped: `x |> f = f x = f $ x = ($) f x = f...
18,043,432
Iv almost finished working on a website. The website is a html5 one page site. But the problem is that one page of the page isn't working. Its the weblinks section. Its a drop down box that displays links when a selection is made I'm not sure why. It uses java script , so that may be the issue. (I'm not good with ja...
2013/08/04
[ "https://Stackoverflow.com/questions/18043432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1577142/" ]
> > "I don´t like to read the order of functions from right to left in haskell. To fix this, I added a little useful operator." > > > "still don`t know anything about monads, types and classes" > > > I don't think that trying to "fix" something in the language without understanding its basic concepts is a good i...
The monadic bind operator `>>=` always returns something 'wrapped' in a monad, so it probably isn't what you want. Your `>>>` operator should work fine with a little adjustment, although it might not make sense to mix it with `$` as you are doing there. If anything it's just confusing! The adjustment you will need is...
18,043,432
Iv almost finished working on a website. The website is a html5 one page site. But the problem is that one page of the page isn't working. Its the weblinks section. Its a drop down box that displays links when a selection is made I'm not sure why. It uses java script , so that may be the issue. (I'm not good with ja...
2013/08/04
[ "https://Stackoverflow.com/questions/18043432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1577142/" ]
> > "I don´t like to read the order of functions from right to left in haskell. To fix this, I added a little useful operator." > > > "still don`t know anything about monads, types and classes" > > > I don't think that trying to "fix" something in the language without understanding its basic concepts is a good i...
1. I think it's called `|>` in F#: `main = print $ [1..10] |> map (*2) |> filter (>5) |> foldr1 (+)` Note that `|>` is asymmetric in its argument types: it expects a value, and a function, and applies the value to a function: `x |> f = f x`. It is, of course, just `($)` flipped: `x |> f = f x = f $ x = ($) f x = f...
43,798,519
I have created a Xamarin Forms project and i am unable to change my Android status bar color to transparent. I am changing my colors programmatically in the OnCreate() method of my MainActivity as follow: ``` if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { Window.ClearFlags(WindowManage...
2017/05/05
[ "https://Stackoverflow.com/questions/43798519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5888416/" ]
Did you try this ? ``` <item name="android:windowTranslucentStatus">true</item> ```
Use below mentioned code. That has worked for me perfectly. ``` public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity { protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; ...
43,798,519
I have created a Xamarin Forms project and i am unable to change my Android status bar color to transparent. I am changing my colors programmatically in the OnCreate() method of my MainActivity as follow: ``` if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { Window.ClearFlags(WindowManage...
2017/05/05
[ "https://Stackoverflow.com/questions/43798519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5888416/" ]
Did you try this ? ``` <item name="android:windowTranslucentStatus">true</item> ```
You can try adding this in styles.xml (Android proj) ``` <style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:windowTranslucentStatus">true</item> </style> ``` Looks something like this:- [![enter i...
43,798,519
I have created a Xamarin Forms project and i am unable to change my Android status bar color to transparent. I am changing my colors programmatically in the OnCreate() method of my MainActivity as follow: ``` if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { Window.ClearFlags(WindowManage...
2017/05/05
[ "https://Stackoverflow.com/questions/43798519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5888416/" ]
Did you try this ? ``` <item name="android:windowTranslucentStatus">true</item> ```
To achieve this please put that code before `LoadApplication(new App())` in `OnCreate()` Method of your Xamarin.Android Project's `MainActivity` class. ```cs private void TransparentStatusBar() { if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat) { // for covering the full screen in android.. ...
43,798,519
I have created a Xamarin Forms project and i am unable to change my Android status bar color to transparent. I am changing my colors programmatically in the OnCreate() method of my MainActivity as follow: ``` if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { Window.ClearFlags(WindowManage...
2017/05/05
[ "https://Stackoverflow.com/questions/43798519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5888416/" ]
You can try adding this in styles.xml (Android proj) ``` <style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:windowTranslucentStatus">true</item> </style> ``` Looks something like this:- [![enter i...
Use below mentioned code. That has worked for me perfectly. ``` public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity { protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; ...
43,798,519
I have created a Xamarin Forms project and i am unable to change my Android status bar color to transparent. I am changing my colors programmatically in the OnCreate() method of my MainActivity as follow: ``` if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { Window.ClearFlags(WindowManage...
2017/05/05
[ "https://Stackoverflow.com/questions/43798519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5888416/" ]
To achieve this please put that code before `LoadApplication(new App())` in `OnCreate()` Method of your Xamarin.Android Project's `MainActivity` class. ```cs private void TransparentStatusBar() { if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat) { // for covering the full screen in android.. ...
Use below mentioned code. That has worked for me perfectly. ``` public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity { protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; ...
43,798,519
I have created a Xamarin Forms project and i am unable to change my Android status bar color to transparent. I am changing my colors programmatically in the OnCreate() method of my MainActivity as follow: ``` if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { Window.ClearFlags(WindowManage...
2017/05/05
[ "https://Stackoverflow.com/questions/43798519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5888416/" ]
You can try adding this in styles.xml (Android proj) ``` <style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:windowTranslucentStatus">true</item> </style> ``` Looks something like this:- [![enter i...
To achieve this please put that code before `LoadApplication(new App())` in `OnCreate()` Method of your Xamarin.Android Project's `MainActivity` class. ```cs private void TransparentStatusBar() { if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat) { // for covering the full screen in android.. ...
221,172
I'm searching for a story, I believe it was a novel, in which someone answers an ad, and meets up with a group of different people in some suburban strip mall basement (I may be completely misremembering this, however). I think after some selection process, a smaller group is basically hired to steal something. One of ...
2019/10/06
[ "https://scifi.stackexchange.com/questions/221172", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/66133/" ]
This is (at least part of) the plot of *The Magician King* by Lev Grossman. Takes place in our modern world, but where magic is real. The god they summon in Murs, France is Reynard the Fox, who does indeed rape one of them and kill the rest. It's possible some of your plot elements are from other books or shows.
A secondary note to [Lak's answer](https://scifi.stackexchange.com/a/221175/28460), is that there has recently been a TV series (2015) aired called [*The Magicians*](https://www.imdb.com/title/tt4254242/) in which this scene is prominently featured as the series finale of season 1. The character you remember in this ca...
44,172,452
Suppose the tag is an embed link from Google maps: ``` <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3025.306387423317!2d-74.04668908414591!3d40.68924937933434!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c25090129c363d%3A0x40c6a5770d25022b!2sStatue+of+Liberty+National+Monument!5e0!3m2!1...
2017/05/25
[ "https://Stackoverflow.com/questions/44172452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7364168/" ]
```js $(document).ready(function() { $(".save_button").on('click', function() { var embed_link = $($("#embed_link").val()).attr('src'); //var embed_src = $('#embed_link').val().attr('src'); alert(embed_link); // Works }); }); ``` ```html <script src="https://ajax.googleapis.com/ajax/libs/jquer...
``` $(document).ready(function() { $(".save_button").on('click', function() { var embed_link = $("#embed_link").val(); //var embed_src = $('#embed_link').val().attr('src'); console.log($(embed_link)[0].src); }); }); ```