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
41,647
When using the php include function the include is succesfully executed, but it is also outputting a char before the output of the include is outputted, the char is of hex value 3F and I have no idea where it is coming from, although it seems to happen with every include. At first I thbought it was file encoding, but...
2008/09/03
[ "https://Stackoverflow.com/questions/41647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1111/" ]
What you are seeing is a UTF-8 Byte Order Mark: > > The UTF-8 representation of the BOM is the byte sequence EF BB BF, which appears as the ISO-8859-1 characters  in most text editors and web browsers not prepared to handle UTF-8. > > > [Byte Order Mark on Wikipedia](http://en.wikipedia.org/wiki/Byte_Order_Mark)...
Your web server (or your text editor) apparently includes a [BOM](http://en.wikipedia.org/wiki/Byte_order_mark) into the document. I don't see the rogue character in my browser except when I set the site's encoding explicitly to Latin-1. Then, I see two (!) UTF-8 BOMs. /EDIT: From the fact that there are *two* BOMs I ...
41,647
When using the php include function the include is succesfully executed, but it is also outputting a char before the output of the include is outputted, the char is of hex value 3F and I have no idea where it is coming from, although it seems to happen with every include. At first I thbought it was file encoding, but...
2008/09/03
[ "https://Stackoverflow.com/questions/41647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1111/" ]
It doesn't show up on the rendered page in Firefox or IE but you can see the funny character when you View Source in IE ![enter image description here](https://i.stack.imgur.com/cyPAq.png) Is this on a Linux machine? Could you do find & replace with vim or sed to see if you can get rid of the 3F that way? If it's o...
I see `hello, world` on the page you linked to. No problems that I can see... I'm using Firefox 3.0.1 and Windows XP. What browser/OS are you running? Perhaps that might be the problem.
41,647
When using the php include function the include is succesfully executed, but it is also outputting a char before the output of the include is outputted, the char is of hex value 3F and I have no idea where it is coming from, although it seems to happen with every include. At first I thbought it was file encoding, but...
2008/09/03
[ "https://Stackoverflow.com/questions/41647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1111/" ]
Your web server (or your text editor) apparently includes a [BOM](http://en.wikipedia.org/wiki/Byte_order_mark) into the document. I don't see the rogue character in my browser except when I set the site's encoding explicitly to Latin-1. Then, I see two (!) UTF-8 BOMs. /EDIT: From the fact that there are *two* BOMs I ...
> > I'd also be curious to see what > happens if you copy the code out of > the include and just run it by itself. > > > Mark: this is on a shared hosting solution, so I can not get shell access to the file. However, as you can see [here](http://driveefficiently.com/include.inc), there are no characters that sho...
41,647
When using the php include function the include is succesfully executed, but it is also outputting a char before the output of the include is outputted, the char is of hex value 3F and I have no idea where it is coming from, although it seems to happen with every include. At first I thbought it was file encoding, but...
2008/09/03
[ "https://Stackoverflow.com/questions/41647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1111/" ]
Your web server (or your text editor) apparently includes a [BOM](http://en.wikipedia.org/wiki/Byte_order_mark) into the document. I don't see the rogue character in my browser except when I set the site's encoding explicitly to Latin-1. Then, I see two (!) UTF-8 BOMs. /EDIT: From the fact that there are *two* BOMs I ...
I see `hello, world` on the page you linked to. No problems that I can see... I'm using Firefox 3.0.1 and Windows XP. What browser/OS are you running? Perhaps that might be the problem.
41,647
When using the php include function the include is succesfully executed, but it is also outputting a char before the output of the include is outputted, the char is of hex value 3F and I have no idea where it is coming from, although it seems to happen with every include. At first I thbought it was file encoding, but...
2008/09/03
[ "https://Stackoverflow.com/questions/41647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1111/" ]
Your web server (or your text editor) apparently includes a [BOM](http://en.wikipedia.org/wiki/Byte_order_mark) into the document. I don't see the rogue character in my browser except when I set the site's encoding explicitly to Latin-1. Then, I see two (!) UTF-8 BOMs. /EDIT: From the fact that there are *two* BOMs I ...
It doesn't show up on the rendered page in Firefox or IE but you can see the funny character when you View Source in IE ![enter image description here](https://i.stack.imgur.com/cyPAq.png) Is this on a Linux machine? Could you do find & replace with vim or sed to see if you can get rid of the 3F that way? If it's o...
48,849
How to get image from database and display it in magento? my imgs.php is: ``` $a = $_SESSION['id']; $ob = Mage::getModel('management/file')->getCollection(); $res = $ob->addFieldToFilter('task_id',$a); // $res = $ob->addFieldToFilter('comment_id',$id); //$img = ""; foreach($res as $v...
2014/12/19
[ "https://magento.stackexchange.com/questions/48849", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/18609/" ]
The only way to really disable your module is to change ``` <active>true</active> ``` to ``` <active>false</active> ``` in your app/etc/modules/foo.xml If you want an admin account to be able to do it in the back-end, you can create a config option (with system.xml) to control your module. Although it's not exac...
By doing the way is two. 1. in admin, `system->configuration->advanced` and then `disable` the module you want. 2. making your modulename.xml file this line as `<active>true</active>` to `<active>false</active>`.(need to flush the cache) Hope this is what you need.
48,849
How to get image from database and display it in magento? my imgs.php is: ``` $a = $_SESSION['id']; $ob = Mage::getModel('management/file')->getCollection(); $res = $ob->addFieldToFilter('task_id',$a); // $res = $ob->addFieldToFilter('comment_id',$id); //$img = ""; foreach($res as $v...
2014/12/19
[ "https://magento.stackexchange.com/questions/48849", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/18609/" ]
The only way to really disable your module is to change ``` <active>true</active> ``` to ``` <active>false</active> ``` in your app/etc/modules/foo.xml If you want an admin account to be able to do it in the back-end, you can create a config option (with system.xml) to control your module. Although it's not exac...
Below are the three ways to disable the modules. 1. Disabling modules in the Magento backend : Go to Magento backend - System > Configuration > Advanced > Disable modules output you can easily disable certain modules. You can even select the scope of the configuration (in the top left of the page) and there for disa...
48,849
How to get image from database and display it in magento? my imgs.php is: ``` $a = $_SESSION['id']; $ob = Mage::getModel('management/file')->getCollection(); $res = $ob->addFieldToFilter('task_id',$a); // $res = $ob->addFieldToFilter('comment_id',$id); //$img = ""; foreach($res as $v...
2014/12/19
[ "https://magento.stackexchange.com/questions/48849", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/18609/" ]
The only way to really disable your module is to change ``` <active>true</active> ``` to ``` <active>false</active> ``` in your app/etc/modules/foo.xml If you want an admin account to be able to do it in the back-end, you can create a config option (with system.xml) to control your module. Although it's not exac...
I stumbled over another way to disable extension in an answer to my own question (admitedly very similar to this one) in this regards which I wanted to share here. This was provided by @[nintenic](https://magento.stackexchange.com/users/52309/nintenic) (thanks for that) : > > 1. In your FTP go to `app/etc/modules`....
48,849
How to get image from database and display it in magento? my imgs.php is: ``` $a = $_SESSION['id']; $ob = Mage::getModel('management/file')->getCollection(); $res = $ob->addFieldToFilter('task_id',$a); // $res = $ob->addFieldToFilter('comment_id',$id); //$img = ""; foreach($res as $v...
2014/12/19
[ "https://magento.stackexchange.com/questions/48849", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/18609/" ]
Below are the three ways to disable the modules. 1. Disabling modules in the Magento backend : Go to Magento backend - System > Configuration > Advanced > Disable modules output you can easily disable certain modules. You can even select the scope of the configuration (in the top left of the page) and there for disa...
By doing the way is two. 1. in admin, `system->configuration->advanced` and then `disable` the module you want. 2. making your modulename.xml file this line as `<active>true</active>` to `<active>false</active>`.(need to flush the cache) Hope this is what you need.
48,849
How to get image from database and display it in magento? my imgs.php is: ``` $a = $_SESSION['id']; $ob = Mage::getModel('management/file')->getCollection(); $res = $ob->addFieldToFilter('task_id',$a); // $res = $ob->addFieldToFilter('comment_id',$id); //$img = ""; foreach($res as $v...
2014/12/19
[ "https://magento.stackexchange.com/questions/48849", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/18609/" ]
Below are the three ways to disable the modules. 1. Disabling modules in the Magento backend : Go to Magento backend - System > Configuration > Advanced > Disable modules output you can easily disable certain modules. You can even select the scope of the configuration (in the top left of the page) and there for disa...
I stumbled over another way to disable extension in an answer to my own question (admitedly very similar to this one) in this regards which I wanted to share here. This was provided by @[nintenic](https://magento.stackexchange.com/users/52309/nintenic) (thanks for that) : > > 1. In your FTP go to `app/etc/modules`....
35,579,650
The gist of the argument is the following: A function that I wrote, takes into consideration one argument, an alphanumeric string, and should output a string where the values of each element of this alphanumeric string are switched for some 'mapping'. MRE as follows: ``` #This is the original and switches value map m...
2016/02/23
[ "https://Stackoverflow.com/questions/35579650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3285115/" ]
Using `Reduce` and `gsub`, you could define the following function ``` replacer <- function(x) Reduce(function(x,r) gsub(map$original[r], map$mapped[r], x, fixed=T), seq_len(nrow(map)),x) # Let's test it replacer("549300JV8KEETQJYUG13") #[1] "5493001931820141429261934301613" ```
Seems like a merge: ``` map[as.data.table(unlist(strsplit(string, ""))), .(mapped), on = c(original = "V1")][ , paste0(mapped, collapse = "")] ``` Note that both "D1" and "1V" will be mapped to "131"... On your example output is: `"5493001931820141429261934301613"` You can use `sep = "."` if you actually want ...
35,579,650
The gist of the argument is the following: A function that I wrote, takes into consideration one argument, an alphanumeric string, and should output a string where the values of each element of this alphanumeric string are switched for some 'mapping'. MRE as follows: ``` #This is the original and switches value map m...
2016/02/23
[ "https://Stackoverflow.com/questions/35579650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3285115/" ]
We can use base conversion: ``` #input and expected output x <- "549300JV8KEETQJYUG13" # "5493001931820141429261934301613" #output res <- paste0(strtoi(unlist(strsplit(x, "")), base = 36), collapse = "") #test output as_numbers(x) == res # [1] TRUE ``` --- Performance =========== Since this post is about perform...
Seems like a merge: ``` map[as.data.table(unlist(strsplit(string, ""))), .(mapped), on = c(original = "V1")][ , paste0(mapped, collapse = "")] ``` Note that both "D1" and "1V" will be mapped to "131"... On your example output is: `"5493001931820141429261934301613"` You can use `sep = "."` if you actually want ...
35,579,650
The gist of the argument is the following: A function that I wrote, takes into consideration one argument, an alphanumeric string, and should output a string where the values of each element of this alphanumeric string are switched for some 'mapping'. MRE as follows: ``` #This is the original and switches value map m...
2016/02/23
[ "https://Stackoverflow.com/questions/35579650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3285115/" ]
Using `Reduce` and `gsub`, you could define the following function ``` replacer <- function(x) Reduce(function(x,r) gsub(map$original[r], map$mapped[r], x, fixed=T), seq_len(nrow(map)),x) # Let's test it replacer("549300JV8KEETQJYUG13") #[1] "5493001931820141429261934301613" ```
I would use `match`: ``` as_numbers <- function(string) { lapply(strsplit(string, ""), function(y) { paste0(map$mapped[match(y, map$original)], collapse= "")}) } as_numbers(c("549300JV8KEETQJYUG13", "5493V8KE300J")) #[[1]] #[1] "5493001931820141429261934301613" # #[[2]] #[1] "5493318201430019" ``` Added an `l...
35,579,650
The gist of the argument is the following: A function that I wrote, takes into consideration one argument, an alphanumeric string, and should output a string where the values of each element of this alphanumeric string are switched for some 'mapping'. MRE as follows: ``` #This is the original and switches value map m...
2016/02/23
[ "https://Stackoverflow.com/questions/35579650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3285115/" ]
We can use base conversion: ``` #input and expected output x <- "549300JV8KEETQJYUG13" # "5493001931820141429261934301613" #output res <- paste0(strtoi(unlist(strsplit(x, "")), base = 36), collapse = "") #test output as_numbers(x) == res # [1] TRUE ``` --- Performance =========== Since this post is about perform...
I would use `match`: ``` as_numbers <- function(string) { lapply(strsplit(string, ""), function(y) { paste0(map$mapped[match(y, map$original)], collapse= "")}) } as_numbers(c("549300JV8KEETQJYUG13", "5493V8KE300J")) #[[1]] #[1] "5493001931820141429261934301613" # #[[2]] #[1] "5493318201430019" ``` Added an `l...
50,637,420
I have a column 'A' in two dataframes, say df1 and df2. df1: ``` | ID | A | | |------|---|--| | ID1 | 5 | | | ID2 | 6 | | | ID3 | 7 | | | ID4 | 8 | | ``` df2: ``` | ID | A | | |------|---|--| | ID1 | 5 | | | ID2 | 1 | | | ID3 | 8 | | | ID5 | 7 | | | ID6 | 8 | | | ID7 | 9 | | ``` Requi...
2018/06/01
[ "https://Stackoverflow.com/questions/50637420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9863102/" ]
I believe need: ``` df = pd.concat([df1, df2]).drop_duplicates(subset=['ID'], keep='last').sort_values('ID') print (df) ID A 0 ID1 5 1 ID2 1 2 ID3 8 3 ID4 8 3 ID5 7 4 ID6 8 5 ID7 9 ``` **Explanation**: First [`concat`](http://pands.pydata.org/pandas-docs/stable/generated/pandas.concat.html) both ...
You can do the same thing using the merge method of Pandas. You can merge df1 and df2 using the merge function as follows: ``` df = pd.merge(df2,df1, how ='outer') ``` Here I am merging df2 with df1. outer uses union of keys from both dataframes. Union will take all the keys from df2 and only those keys from df1 wh...
12,703,942
When calling a function from ajax. Program flow does not recognized the expired session i.e not redirect to the login page. Instead of that, it saves the record. I am working in c# .net mvc. So how can i handle session while ajax call. Here i gave my codes. ``` $.ajax({ type: "POST", url:'/Em...
2012/10/03
[ "https://Stackoverflow.com/questions/12703942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1517867/" ]
The result of your AJAX call will still likely end up appearing successful (although, don't worry, it won't actually execute your action method), and invoke your `success` handler. This is because you are expecting HTML, and that is what you are receiving (albeit, the resulting HTML is likely your login page, and not t...
I would like to sugguest you to use StatusCode = 306. I met some problem when use 401.IIS treat 401 different from what I understand. 306 works fine for me. Regards.
28,301,358
I'm facing this weird issue with `off()` and `on()` event binding to a `select` dropdown: If I unbind and then rebind the `change` event to the `select` dropdown I won't be able to change the dropdown shown value. In other words, the selected value is not updated properly in the dropdown, even if the change event is t...
2015/02/03
[ "https://Stackoverflow.com/questions/28301358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1054151/" ]
You have essentially two ways of achieving this: 1. Configure your apache-camel runtime container to handle the authentication i.e. if you are deploying to Tomcat then configure Tomcat to handle the Digest authentication. ServiceMix and Karaf will use the OSGI PAX web server which will need to be configured. 2. To sec...
There's somes ways to secure a rest service and in my opinion it doesn't depends on Camel. For example, you want to allow access to the service event if the client is not logged. So you have to check his information in the body of you service. That's one way. One other way, is to use authentication (by login/pwd, tok...
60,886,490
I have created a wrapper service for MessageService from PrimeNG instead of calling `add()` method directly in the app but it is not working neither throwing any compiletime/runtime error. The code is getting executed verified by debugger. It works when i call use MessageService directly. Is there anything like the Me...
2020/03/27
[ "https://Stackoverflow.com/questions/60886490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5576205/" ]
You can use `par(mgp = plot_coords)`, as stated in [this post.](https://stackoverflow.com/a/26246955/6478701) e.g : ``` par(mfrow = c(2,2)) plot(1:10, col = 1, main = 1) plot(1:10, col = 2, main = 2) plot(1:10, col = 3, main = 3) plot(1:10, col = 4, main = 4) par(mfg = c(1,2)) points(10:1, col = "hotpink") ``` [![...
RoB is correct, but this only works if all the graphs are the same scale. If plots have different scales, you will need to reset the window scaling to the appropriate values for the panel before adding a new element. To demonstrate with a modified version of RoB's example, this code does not generate the expected plot...
23,295,356
I've got a menu build by a list like below: ``` <ul> <li></li> <li></li> <li> <ul> <li></li> </ul> </li> <li></li> <li></li> </ul> ``` The sub menu items in the list are only displayed when you hover their parent list element. However the child list elements width will force t...
2014/04/25
[ "https://Stackoverflow.com/questions/23295356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1053445/" ]
Make sure you are accessing the application from the correct 'entrance'. Thus, accessing it from **app/public/index.php**. The app/public/index.php file loads the autoloader. ``` <?php /** * Laravel - A PHP Framework For Web Artisans * * @package Laravel * @author Taylor Otwell <taylorotwell@gmail.com> */ /...
It's possible your is namespacing. Try adding the backslash before the class being extended. ``` class Stack extends \Eloquent { } ```
23,295,356
I've got a menu build by a list like below: ``` <ul> <li></li> <li></li> <li> <ul> <li></li> </ul> </li> <li></li> <li></li> </ul> ``` The sub menu items in the list are only displayed when you hover their parent list element. However the child list elements width will force t...
2014/04/25
[ "https://Stackoverflow.com/questions/23295356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1053445/" ]
Make sure you are accessing the application from the correct 'entrance'. Thus, accessing it from **app/public/index.php**. The app/public/index.php file loads the autoloader. ``` <?php /** * Laravel - A PHP Framework For Web Artisans * * @package Laravel * @author Taylor Otwell <taylorotwell@gmail.com> */ /...
Make sure your are setting the `Eloquent` alias in the app config. (app/config/app.php) Alternatively use the class directly. I believe it's: `Illuminate\Database\Eloquent\Model` ``` class Stack extends \Illuminate\Database\Eloquent\Model {} ```
21,382,128
I am using zlib along with fstream now for zipping and sending to the client, Now I need to unzip an archive(which may contains sub folders) into a folder maintaining the folder structure. How do I do that?
2014/01/27
[ "https://Stackoverflow.com/questions/21382128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1177295/" ]
There are plenty of node modules that can do this for you. One of them is node-unzip. You can extract a .zip file to a directory as simple as this. `fs.createReadStream('path/to/archive.zip').pipe(unzip.Extract({ path: 'output/path' }));` Further reading: <https://github.com/EvanOxfeld/node-unzip>
Rar is a closed-source software. The only way you can do it -- install command-line rar (rar.exe or linux version of rar, which is available on most platforms) and call it by means of this: ``` var exec = require('child_process').exec; exec("rar.exe x file.rar", function (error) { if (error) { // error code ...
21,382,128
I am using zlib along with fstream now for zipping and sending to the client, Now I need to unzip an archive(which may contains sub folders) into a folder maintaining the folder structure. How do I do that?
2014/01/27
[ "https://Stackoverflow.com/questions/21382128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1177295/" ]
There are plenty of node modules that can do this for you. One of them is node-unzip. You can extract a .zip file to a directory as simple as this. `fs.createReadStream('path/to/archive.zip').pipe(unzip.Extract({ path: 'output/path' }));` Further reading: <https://github.com/EvanOxfeld/node-unzip>
you can use this amazing module <http://node-machine.org/machinepack-zip> for uncompress a zip file with directory structure inside zip ``` var Zip = require('machinepack-zip'); ``` // Unzip the specified .zip file and write the decompressed files/directories as contents of the specified destination directory. ```...
21,382,128
I am using zlib along with fstream now for zipping and sending to the client, Now I need to unzip an archive(which may contains sub folders) into a folder maintaining the folder structure. How do I do that?
2014/01/27
[ "https://Stackoverflow.com/questions/21382128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1177295/" ]
There are plenty of node modules that can do this for you. One of them is node-unzip. You can extract a .zip file to a directory as simple as this. `fs.createReadStream('path/to/archive.zip').pipe(unzip.Extract({ path: 'output/path' }));` Further reading: <https://github.com/EvanOxfeld/node-unzip>
Use node js decompress-zip, first install it with npm: ``` npm install decompress-zip --save ``` Then you have to require it: ``` const DecompressZip = require('decompress-zip'); ``` Finally you can use it in the following way: ``` let unzipper = new DecompressZip( absolutePathFileZip ); ``` The directory to b...
21,382,128
I am using zlib along with fstream now for zipping and sending to the client, Now I need to unzip an archive(which may contains sub folders) into a folder maintaining the folder structure. How do I do that?
2014/01/27
[ "https://Stackoverflow.com/questions/21382128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1177295/" ]
There are plenty of node modules that can do this for you. One of them is node-unzip. You can extract a .zip file to a directory as simple as this. `fs.createReadStream('path/to/archive.zip').pipe(unzip.Extract({ path: 'output/path' }));` Further reading: <https://github.com/EvanOxfeld/node-unzip>
If anyone looking for async-await way syntax: ```js const request = require('request'); const unzip = require('unzip'); await new Promise(resolve => request('url') .pipe(fs.createWriteStream('path/zipfilename')) .on('finish', () => { resolve(); ...
21,382,128
I am using zlib along with fstream now for zipping and sending to the client, Now I need to unzip an archive(which may contains sub folders) into a folder maintaining the folder structure. How do I do that?
2014/01/27
[ "https://Stackoverflow.com/questions/21382128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1177295/" ]
Rar is a closed-source software. The only way you can do it -- install command-line rar (rar.exe or linux version of rar, which is available on most platforms) and call it by means of this: ``` var exec = require('child_process').exec; exec("rar.exe x file.rar", function (error) { if (error) { // error code ...
you can use this amazing module <http://node-machine.org/machinepack-zip> for uncompress a zip file with directory structure inside zip ``` var Zip = require('machinepack-zip'); ``` // Unzip the specified .zip file and write the decompressed files/directories as contents of the specified destination directory. ```...
21,382,128
I am using zlib along with fstream now for zipping and sending to the client, Now I need to unzip an archive(which may contains sub folders) into a folder maintaining the folder structure. How do I do that?
2014/01/27
[ "https://Stackoverflow.com/questions/21382128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1177295/" ]
Rar is a closed-source software. The only way you can do it -- install command-line rar (rar.exe or linux version of rar, which is available on most platforms) and call it by means of this: ``` var exec = require('child_process').exec; exec("rar.exe x file.rar", function (error) { if (error) { // error code ...
Use node js decompress-zip, first install it with npm: ``` npm install decompress-zip --save ``` Then you have to require it: ``` const DecompressZip = require('decompress-zip'); ``` Finally you can use it in the following way: ``` let unzipper = new DecompressZip( absolutePathFileZip ); ``` The directory to b...
21,382,128
I am using zlib along with fstream now for zipping and sending to the client, Now I need to unzip an archive(which may contains sub folders) into a folder maintaining the folder structure. How do I do that?
2014/01/27
[ "https://Stackoverflow.com/questions/21382128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1177295/" ]
Rar is a closed-source software. The only way you can do it -- install command-line rar (rar.exe or linux version of rar, which is available on most platforms) and call it by means of this: ``` var exec = require('child_process').exec; exec("rar.exe x file.rar", function (error) { if (error) { // error code ...
If anyone looking for async-await way syntax: ```js const request = require('request'); const unzip = require('unzip'); await new Promise(resolve => request('url') .pipe(fs.createWriteStream('path/zipfilename')) .on('finish', () => { resolve(); ...
21,382,128
I am using zlib along with fstream now for zipping and sending to the client, Now I need to unzip an archive(which may contains sub folders) into a folder maintaining the folder structure. How do I do that?
2014/01/27
[ "https://Stackoverflow.com/questions/21382128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1177295/" ]
you can use this amazing module <http://node-machine.org/machinepack-zip> for uncompress a zip file with directory structure inside zip ``` var Zip = require('machinepack-zip'); ``` // Unzip the specified .zip file and write the decompressed files/directories as contents of the specified destination directory. ```...
Use node js decompress-zip, first install it with npm: ``` npm install decompress-zip --save ``` Then you have to require it: ``` const DecompressZip = require('decompress-zip'); ``` Finally you can use it in the following way: ``` let unzipper = new DecompressZip( absolutePathFileZip ); ``` The directory to b...
21,382,128
I am using zlib along with fstream now for zipping and sending to the client, Now I need to unzip an archive(which may contains sub folders) into a folder maintaining the folder structure. How do I do that?
2014/01/27
[ "https://Stackoverflow.com/questions/21382128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1177295/" ]
you can use this amazing module <http://node-machine.org/machinepack-zip> for uncompress a zip file with directory structure inside zip ``` var Zip = require('machinepack-zip'); ``` // Unzip the specified .zip file and write the decompressed files/directories as contents of the specified destination directory. ```...
If anyone looking for async-await way syntax: ```js const request = require('request'); const unzip = require('unzip'); await new Promise(resolve => request('url') .pipe(fs.createWriteStream('path/zipfilename')) .on('finish', () => { resolve(); ...
49,388,971
I have implemented this class in workbox 2, now I have upgraded to version 3 but workbox.runtimeCaching.Handler is deprecated. Can someone help me on how to develop it in workbox 3?\* ``` importScripts('workbox-sw.prod.v2.1.2.js'); importScripts('workbox-runtime-caching.prod.v2.0.3.js'); importScripts('wo...
2018/03/20
[ "https://Stackoverflow.com/questions/49388971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9521979/" ]
One way to resolve this is to create a `base` environment, and then symlink the common elements, for example: ``` ├─ modules ├── x ├── y ├─ environments ├── base │ ├── output.tf │ └── variables.tf ├── dev │ ├── main.tf │ ├── output.tf -> ../base/output.tf │ └── variables.tf -> ../base/variables.tf ├── uat │ ...
If your `dev`, `uat` and `prod` environments have the same shape, but different properties you could leverage [workspaces](https://www.terraform.io/docs/state/workspaces.html) to separate your environment state, along with separate `*.tfvars` files to specify the different configurations. This could look like: ``` ├─...
49,388,971
I have implemented this class in workbox 2, now I have upgraded to version 3 but workbox.runtimeCaching.Handler is deprecated. Can someone help me on how to develop it in workbox 3?\* ``` importScripts('workbox-sw.prod.v2.1.2.js'); importScripts('workbox-runtime-caching.prod.v2.0.3.js'); importScripts('wo...
2018/03/20
[ "https://Stackoverflow.com/questions/49388971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9521979/" ]
We built and open sourced [Terragrunt](https://github.com/gruntwork-io/terragrunt) to solve this very issue. One of Terragrunt's features is the ability to download remote Terraform configurations. The idea is that you define the Terraform code for your infrastructure just once, in a single repo, called, for example, `...
One way to resolve this is to create a `base` environment, and then symlink the common elements, for example: ``` ├─ modules ├── x ├── y ├─ environments ├── base │ ├── output.tf │ └── variables.tf ├── dev │ ├── main.tf │ ├── output.tf -> ../base/output.tf │ └── variables.tf -> ../base/variables.tf ├── uat │ ...
49,388,971
I have implemented this class in workbox 2, now I have upgraded to version 3 but workbox.runtimeCaching.Handler is deprecated. Can someone help me on how to develop it in workbox 3?\* ``` importScripts('workbox-sw.prod.v2.1.2.js'); importScripts('workbox-runtime-caching.prod.v2.0.3.js'); importScripts('wo...
2018/03/20
[ "https://Stackoverflow.com/questions/49388971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9521979/" ]
We built and open sourced [Terragrunt](https://github.com/gruntwork-io/terragrunt) to solve this very issue. One of Terragrunt's features is the ability to download remote Terraform configurations. The idea is that you define the Terraform code for your infrastructure just once, in a single repo, called, for example, `...
If your `dev`, `uat` and `prod` environments have the same shape, but different properties you could leverage [workspaces](https://www.terraform.io/docs/state/workspaces.html) to separate your environment state, along with separate `*.tfvars` files to specify the different configurations. This could look like: ``` ├─...
2,223,879
I am trying to write a regular expression to capture this string: ``` <td style="white-space:nowrap;">###.##</td> ``` I can't even match it if include the string as it is in the regex pattern! I am using `preg_match_all()`, however, I am not finding the correct pattern. I am thinking that `"white-space:nowrap;"` is ...
2010/02/08
[ "https://Stackoverflow.com/questions/2223879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/268851/" ]
When I'm having problems with regular expressions, I like to test them in real time with one of the following websites: * [preg\_match Regular Expression Tester](http://www.switchplane.com/utilities/preg_match-regular-expression-tester.php) * [Regular Expression Test Tool](http://www.spaweditor.com/scripts/regex/)
Did you see any warnings? You have to escape some bits of that, namely the `/` before the td close tag. This seemed to work for me: ``` $string='cow cow cow <td style="white-space:nowrap;">###.##</td> cat cat cat cat'; php > preg_match_all('/<td style="white-space:nowrap;">###\.##<\/td>/',$string,$result); php > va...
2,223,879
I am trying to write a regular expression to capture this string: ``` <td style="white-space:nowrap;">###.##</td> ``` I can't even match it if include the string as it is in the regex pattern! I am using `preg_match_all()`, however, I am not finding the correct pattern. I am thinking that `"white-space:nowrap;"` is ...
2010/02/08
[ "https://Stackoverflow.com/questions/2223879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/268851/" ]
When I'm having problems with regular expressions, I like to test them in real time with one of the following websites: * [preg\_match Regular Expression Tester](http://www.switchplane.com/utilities/preg_match-regular-expression-tester.php) * [Regular Expression Test Tool](http://www.spaweditor.com/scripts/regex/)
Are you aware that the regex argument to any of PHP's `preg_` functions has to be double-delimited? For example: ``` preg_match_all(`'/foo/'`, $target, $results) ``` `'...'` are the *string* delimiters, `/.../` are the *regex* delimiters, and the actual regex is `foo`. The regex delimiters don't have to be slashes, ...
2,223,879
I am trying to write a regular expression to capture this string: ``` <td style="white-space:nowrap;">###.##</td> ``` I can't even match it if include the string as it is in the regex pattern! I am using `preg_match_all()`, however, I am not finding the correct pattern. I am thinking that `"white-space:nowrap;"` is ...
2010/02/08
[ "https://Stackoverflow.com/questions/2223879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/268851/" ]
Why not try using DOM document instead? Then you do not have to worry about having the HTML formatted properly. Using the Dom Doc collection will also improve readability and ensure fast performance since its part of the PHP Core rather then living in user space
Did you see any warnings? You have to escape some bits of that, namely the `/` before the td close tag. This seemed to work for me: ``` $string='cow cow cow <td style="white-space:nowrap;">###.##</td> cat cat cat cat'; php > preg_match_all('/<td style="white-space:nowrap;">###\.##<\/td>/',$string,$result); php > va...
2,223,879
I am trying to write a regular expression to capture this string: ``` <td style="white-space:nowrap;">###.##</td> ``` I can't even match it if include the string as it is in the regex pattern! I am using `preg_match_all()`, however, I am not finding the correct pattern. I am thinking that `"white-space:nowrap;"` is ...
2010/02/08
[ "https://Stackoverflow.com/questions/2223879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/268851/" ]
Why not try using DOM document instead? Then you do not have to worry about having the HTML formatted properly. Using the Dom Doc collection will also improve readability and ensure fast performance since its part of the PHP Core rather then living in user space
Are you aware that the regex argument to any of PHP's `preg_` functions has to be double-delimited? For example: ``` preg_match_all(`'/foo/'`, $target, $results) ``` `'...'` are the *string* delimiters, `/.../` are the *regex* delimiters, and the actual regex is `foo`. The regex delimiters don't have to be slashes, ...
38,119,548
In my WPF application I'm following the MMV pattern. I have a main View with nested child Views. I have a main VM that holds instances of the child VMs. At some point, the main VM needs to be informed when certain properties of the child VM change. I have searched the Web a lot. The prefered approach seems to be to us...
2016/06/30
[ "https://Stackoverflow.com/questions/38119548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4536787/" ]
The problem with the first approach is that the main VM has to know about child VMs properties, so you'd be kinda closely tying those two together. While using some kind of a messaging system you'd be able to only pass the data to the 'parent' and no info about internals of its child objects. The problem with the seco...
Looking at the options of communicating changes made in child viewmodels to their parent viewmodel. For a small application, you are quite right that you don't need to use a messaging bus, event aggregator. 1. There is nothing wrong with the parent subscribing to the INotifyPropertyChanged events emitted by the child ...
38,119,548
In my WPF application I'm following the MMV pattern. I have a main View with nested child Views. I have a main VM that holds instances of the child VMs. At some point, the main VM needs to be informed when certain properties of the child VM change. I have searched the Web a lot. The prefered approach seems to be to us...
2016/06/30
[ "https://Stackoverflow.com/questions/38119548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4536787/" ]
We use a simple approach for this. When you create this child viewmodels just pass an Action or Func into the contructor. Then invoke that action anytime you need to update the parent view model. Example ``` public class ParentViewModel { public ParentViewModel() { childViewModel = new ChildViewModel(...
Looking at the options of communicating changes made in child viewmodels to their parent viewmodel. For a small application, you are quite right that you don't need to use a messaging bus, event aggregator. 1. There is nothing wrong with the parent subscribing to the INotifyPropertyChanged events emitted by the child ...
578,999
I'm creating a simple Silverlight 2 application - a guestbook. I'm using MSSQL as the data source, I've managed to load the data but I can't find out how to add new rows (messages) to the database. I crawled all the internet but didn't find any working solution. The SCMEssages table has four columns - MessageID, Messa...
2009/02/23
[ "https://Stackoverflow.com/questions/578999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69541/" ]
I'm not sure I complete understand the context (like do you control your WCF service and/or your DB). But did you consider ADO.Net Data services? (also known as [astoria](http://michaelsync.net/2008/01/29/adonet-data-service-in-plain-english)) ([http://msdn.microsoft.com/en-us/library/cc668792.aspx)](http://msdn.micros...
Is SCMessage decorated with the [DataContract] attribute or is it [Serializable]? Please provide us with the definition of SCMessage.
578,999
I'm creating a simple Silverlight 2 application - a guestbook. I'm using MSSQL as the data source, I've managed to load the data but I can't find out how to add new rows (messages) to the database. I crawled all the internet but didn't find any working solution. The SCMEssages table has four columns - MessageID, Messa...
2009/02/23
[ "https://Stackoverflow.com/questions/578999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69541/" ]
I'm not sure I complete understand the context (like do you control your WCF service and/or your DB). But did you consider ADO.Net Data services? (also known as [astoria](http://michaelsync.net/2008/01/29/adonet-data-service-in-plain-english)) ([http://msdn.microsoft.com/en-us/library/cc668792.aspx)](http://msdn.micros...
SCMessage is name of a Data Class - I created a file from template "Linq to SQL Classes" (.dbml) and drag&dropped the SCMessages table to the Designer. It's decorated with the [DataContract] attribute and I set it's DataContext's Serialiation Mode property to Unidirectional. So the content of the SCMessage class is aut...
578,999
I'm creating a simple Silverlight 2 application - a guestbook. I'm using MSSQL as the data source, I've managed to load the data but I can't find out how to add new rows (messages) to the database. I crawled all the internet but didn't find any working solution. The SCMEssages table has four columns - MessageID, Messa...
2009/02/23
[ "https://Stackoverflow.com/questions/578999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69541/" ]
I'm not sure I complete understand the context (like do you control your WCF service and/or your DB). But did you consider ADO.Net Data services? (also known as [astoria](http://michaelsync.net/2008/01/29/adonet-data-service-in-plain-english)) ([http://msdn.microsoft.com/en-us/library/cc668792.aspx)](http://msdn.micros...
And here's a little problem with Astoria - it doesn't work for me. I followed the Michael Sync's tutorial and made a few modifications, such as using of DataServiceQuery because WebDataQuery doesn't exist in final version of Astoria, etc. I ended up with two code snippets - the first is almost identical copy of the one...
578,999
I'm creating a simple Silverlight 2 application - a guestbook. I'm using MSSQL as the data source, I've managed to load the data but I can't find out how to add new rows (messages) to the database. I crawled all the internet but didn't find any working solution. The SCMEssages table has four columns - MessageID, Messa...
2009/02/23
[ "https://Stackoverflow.com/questions/578999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69541/" ]
I'm not sure I complete understand the context (like do you control your WCF service and/or your DB). But did you consider ADO.Net Data services? (also known as [astoria](http://michaelsync.net/2008/01/29/adonet-data-service-in-plain-english)) ([http://msdn.microsoft.com/en-us/library/cc668792.aspx)](http://msdn.micros...
Chrasty, I don't see any obvious errors yet. So in theory it shoulld work (I currently work almost daily with these kind of queries. A few questions: 1. can you use fiddler2 to see what is going over the wire. (If you don't know what fiddler is then google :-) and if after that you are using fiddler on localhost, the...
54,656,369
I know that the question is elsewhere, but it does not work for me. Unexpected block statement surrounding arrow body; parenthesize the returned value and move it immediately after the `=>` arrow-body-style## --------------------------------------------------------------------------------------------------------------...
2019/02/12
[ "https://Stackoverflow.com/questions/54656369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6851448/" ]
This should be ``` changePage = id => { this.setState(prevState => ({ ...prevState, selectedPageId: id })); }; ``` I did 2 things here * changePage = id => {} (this ensures that `this` is binded properly to it's lexcial context in the function) * `this.setState(prevState => ({ ...prevState, selectedPageId: id })...
You will have to put parenthesis around your callback's input values if there are more than a single one. You also have to surround your returned value with brackets to indicate that you want to return a JSON object : ``` changePage(id) { this.setState((prevState, props) => ({ ...prevState, selectedPageId: id }))...
54,656,369
I know that the question is elsewhere, but it does not work for me. Unexpected block statement surrounding arrow body; parenthesize the returned value and move it immediately after the `=>` arrow-body-style## --------------------------------------------------------------------------------------------------------------...
2019/02/12
[ "https://Stackoverflow.com/questions/54656369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6851448/" ]
You will have to put parenthesis around your callback's input values if there are more than a single one. You also have to surround your returned value with brackets to indicate that you want to return a JSON object : ``` changePage(id) { this.setState((prevState, props) => ({ ...prevState, selectedPageId: id }))...
If you have installed babel in your VS Code extension then uninstall it . It will resolve the error .
54,656,369
I know that the question is elsewhere, but it does not work for me. Unexpected block statement surrounding arrow body; parenthesize the returned value and move it immediately after the `=>` arrow-body-style## --------------------------------------------------------------------------------------------------------------...
2019/02/12
[ "https://Stackoverflow.com/questions/54656369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6851448/" ]
This should be ``` changePage = id => { this.setState(prevState => ({ ...prevState, selectedPageId: id })); }; ``` I did 2 things here * changePage = id => {} (this ensures that `this` is binded properly to it's lexcial context in the function) * `this.setState(prevState => ({ ...prevState, selectedPageId: id })...
If you have installed babel in your VS Code extension then uninstall it . It will resolve the error .
6,388,698
I will start by saying I've read this topic: [C++ Return reference / stack memory](https://stackoverflow.com/questions/3252292/c-return-reference-stack-memory). But there, the question was with an `std::vector<int>` as object-type. But I though the behavior of `std::string` was different. Wasn't this class especially m...
2011/06/17
[ "https://Stackoverflow.com/questions/6388698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155137/" ]
You are really close to making those functions work: ``` std::string function() { string s = "Faz"; s += "Far"; s += "Boo"; return s; } ``` Simply make them return a copy instead of a reference and you're set. This is what you want, a copy of the stack-based string. It gets better too, because the ...
It doesn't matter what the type is; this pattern is always completely, 100% wrong for any object type `T`: ``` T& f() { T x; return x; } // x is destroyed here and the returned reference is thus unusable ``` If you return a reference from a function, you must ensure that the object to which it refers will ...
6,388,698
I will start by saying I've read this topic: [C++ Return reference / stack memory](https://stackoverflow.com/questions/3252292/c-return-reference-stack-memory). But there, the question was with an `std::vector<int>` as object-type. But I though the behavior of `std::string` was different. Wasn't this class especially m...
2011/06/17
[ "https://Stackoverflow.com/questions/6388698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155137/" ]
It doesn't matter what the type is; this pattern is always completely, 100% wrong for any object type `T`: ``` T& f() { T x; return x; } // x is destroyed here and the returned reference is thus unusable ``` If you return a reference from a function, you must ensure that the object to which it refers will ...
Don't return references, return by value: ``` std::string function() // no ref { string s = "Faz"; s += "Far"; s += "Boo"; return s; } ``` If your compiler can do named return value optimization, aka NRVO, (which is likely), it will transform this into something roughly equivalent to the following, w...
6,388,698
I will start by saying I've read this topic: [C++ Return reference / stack memory](https://stackoverflow.com/questions/3252292/c-return-reference-stack-memory). But there, the question was with an `std::vector<int>` as object-type. But I though the behavior of `std::string` was different. Wasn't this class especially m...
2011/06/17
[ "https://Stackoverflow.com/questions/6388698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155137/" ]
It doesn't matter what the type is; this pattern is always completely, 100% wrong for any object type `T`: ``` T& f() { T x; return x; } // x is destroyed here and the returned reference is thus unusable ``` If you return a reference from a function, you must ensure that the object to which it refers will ...
The problem with this (regardless of the type) is that you're returning a reference to memory that goes out of scope oncee the return is hit. ``` std::string &function() { string s = "Faz"; s += "Far"; s += "Boo"; // s is about to go out scope here and therefore the caller cannot access it return ...
6,388,698
I will start by saying I've read this topic: [C++ Return reference / stack memory](https://stackoverflow.com/questions/3252292/c-return-reference-stack-memory). But there, the question was with an `std::vector<int>` as object-type. But I though the behavior of `std::string` was different. Wasn't this class especially m...
2011/06/17
[ "https://Stackoverflow.com/questions/6388698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155137/" ]
It doesn't matter what the type is; this pattern is always completely, 100% wrong for any object type `T`: ``` T& f() { T x; return x; } // x is destroyed here and the returned reference is thus unusable ``` If you return a reference from a function, you must ensure that the object to which it refers will ...
You can take the address of the returned string and compare it with the address of the original string, as shown below: ``` #include <iostream> using namespace std; string f() { string orig = "Baz"; string copy1 = string(orig); string copy2(orig); string copy3 = orig; cout << "orig addr: " <<...
6,388,698
I will start by saying I've read this topic: [C++ Return reference / stack memory](https://stackoverflow.com/questions/3252292/c-return-reference-stack-memory). But there, the question was with an `std::vector<int>` as object-type. But I though the behavior of `std::string` was different. Wasn't this class especially m...
2011/06/17
[ "https://Stackoverflow.com/questions/6388698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155137/" ]
You are really close to making those functions work: ``` std::string function() { string s = "Faz"; s += "Far"; s += "Boo"; return s; } ``` Simply make them return a copy instead of a reference and you're set. This is what you want, a copy of the stack-based string. It gets better too, because the ...
Don't return references, return by value: ``` std::string function() // no ref { string s = "Faz"; s += "Far"; s += "Boo"; return s; } ``` If your compiler can do named return value optimization, aka NRVO, (which is likely), it will transform this into something roughly equivalent to the following, w...
6,388,698
I will start by saying I've read this topic: [C++ Return reference / stack memory](https://stackoverflow.com/questions/3252292/c-return-reference-stack-memory). But there, the question was with an `std::vector<int>` as object-type. But I though the behavior of `std::string` was different. Wasn't this class especially m...
2011/06/17
[ "https://Stackoverflow.com/questions/6388698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155137/" ]
You are really close to making those functions work: ``` std::string function() { string s = "Faz"; s += "Far"; s += "Boo"; return s; } ``` Simply make them return a copy instead of a reference and you're set. This is what you want, a copy of the stack-based string. It gets better too, because the ...
The problem with this (regardless of the type) is that you're returning a reference to memory that goes out of scope oncee the return is hit. ``` std::string &function() { string s = "Faz"; s += "Far"; s += "Boo"; // s is about to go out scope here and therefore the caller cannot access it return ...
6,388,698
I will start by saying I've read this topic: [C++ Return reference / stack memory](https://stackoverflow.com/questions/3252292/c-return-reference-stack-memory). But there, the question was with an `std::vector<int>` as object-type. But I though the behavior of `std::string` was different. Wasn't this class especially m...
2011/06/17
[ "https://Stackoverflow.com/questions/6388698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155137/" ]
You are really close to making those functions work: ``` std::string function() { string s = "Faz"; s += "Far"; s += "Boo"; return s; } ``` Simply make them return a copy instead of a reference and you're set. This is what you want, a copy of the stack-based string. It gets better too, because the ...
You can take the address of the returned string and compare it with the address of the original string, as shown below: ``` #include <iostream> using namespace std; string f() { string orig = "Baz"; string copy1 = string(orig); string copy2(orig); string copy3 = orig; cout << "orig addr: " <<...
6,388,698
I will start by saying I've read this topic: [C++ Return reference / stack memory](https://stackoverflow.com/questions/3252292/c-return-reference-stack-memory). But there, the question was with an `std::vector<int>` as object-type. But I though the behavior of `std::string` was different. Wasn't this class especially m...
2011/06/17
[ "https://Stackoverflow.com/questions/6388698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155137/" ]
Don't return references, return by value: ``` std::string function() // no ref { string s = "Faz"; s += "Far"; s += "Boo"; return s; } ``` If your compiler can do named return value optimization, aka NRVO, (which is likely), it will transform this into something roughly equivalent to the following, w...
The problem with this (regardless of the type) is that you're returning a reference to memory that goes out of scope oncee the return is hit. ``` std::string &function() { string s = "Faz"; s += "Far"; s += "Boo"; // s is about to go out scope here and therefore the caller cannot access it return ...
6,388,698
I will start by saying I've read this topic: [C++ Return reference / stack memory](https://stackoverflow.com/questions/3252292/c-return-reference-stack-memory). But there, the question was with an `std::vector<int>` as object-type. But I though the behavior of `std::string` was different. Wasn't this class especially m...
2011/06/17
[ "https://Stackoverflow.com/questions/6388698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155137/" ]
Don't return references, return by value: ``` std::string function() // no ref { string s = "Faz"; s += "Far"; s += "Boo"; return s; } ``` If your compiler can do named return value optimization, aka NRVO, (which is likely), it will transform this into something roughly equivalent to the following, w...
You can take the address of the returned string and compare it with the address of the original string, as shown below: ``` #include <iostream> using namespace std; string f() { string orig = "Baz"; string copy1 = string(orig); string copy2(orig); string copy3 = orig; cout << "orig addr: " <<...
352,706
I loved [vimari](https://github.com/guyht/vimari) but the Mojave update made it no longer work because of the stronger permissions system. Is there any way to install this safely, or barring that make extensions work again?
2019/02/28
[ "https://apple.stackexchange.com/questions/352706", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/321240/" ]
`vimari` currently has a somewhat experimental process to compile and install it locally for Safari 12, detailed here: <https://github.com/guyht/vimari/blob/master/docs/safari_12.md> > > **Note: We are currently working on improving this installation flow, as well as the extension itself. Because vimari now has to b...
I am working on Vimac, which is Vimium but for macOS. It supports Safari. Check out the demo: <https://www.youtube.com/watch?v=9WwZtN8_7Tc> You can try out the beta here: <https://vimacapp.com/>
647,785
I got a CD which data requires Codonics Clarity Viewer which is licenced [program](http://www.codonics.com/Products/Viewers/). I recall in viewing such data with some free OSX application last year. I did not find the software or its substitute by `apt-cache/apt-file search`. Is there any substitute for Codonics Clar...
2015/07/13
[ "https://askubuntu.com/questions/647785", "https://askubuntu.com", "https://askubuntu.com/users/25388/" ]
Most likely it's a DICOM file format file, in Ubuntu, you have at least two alternatives: * **DicomImageViewer**: To install, run `sudo apt-get install pixelmed-webstart-apps` * **Aeskulap**: To install, run `sudo apt-get install aeskulap` Also you can search the application names in the Ubuntu Software Center. Is sl...
There is also [Weasis](https://dcm4che.atlassian.net/wiki/display/WEA/Installing+Weasis+in+DCM4CHEE) which is a system that can launch an image viewer. It follows some DICOM standards.
526,979
I switched on my laptop at 9 o’clock this morning and it is now 14:00 hours, where in after a series of reboots, hard or soft, I am able to open my browser. I opened a notepad and noted down following services and processes running on my system which right from the start consumes 1.32 GB of memory. 1.32 GB Memory is ...
2013/01/02
[ "https://superuser.com/questions/526979", "https://superuser.com", "https://superuser.com/users/63915/" ]
Two things to note here: 1) Chrome is very resource intensive depending on what is installed. Open up the browser, in the upper right corner you should see the three bars next to the favorites star icon- click it. Go to tools > Task manager > view the resources it's running. Above task manager, in the drop down menu, ...
Use RAMMap to see why Windows uses the Memory: <http://blogs.technet.com/b/askperf/archive/2010/08/13/introduction-to-the-new-sysinternals-tool-rammap.aspx> If you're unsure, save the data in RAMMAP as rmp, zip and upload them.
526,979
I switched on my laptop at 9 o’clock this morning and it is now 14:00 hours, where in after a series of reboots, hard or soft, I am able to open my browser. I opened a notepad and noted down following services and processes running on my system which right from the start consumes 1.32 GB of memory. 1.32 GB Memory is ...
2013/01/02
[ "https://superuser.com/questions/526979", "https://superuser.com", "https://superuser.com/users/63915/" ]
Scan your system with [SpyBot - Search & Destroy](http://www.safer-networking.org/private/) , [link2](http://download.cnet.com/Spybot-Search-Destroy/3000-8022_4-10122137.html) (choose language on setup). It will guide you step-by-step through saving the registry, updating the database, immunizing and finally the scan i...
Use RAMMap to see why Windows uses the Memory: <http://blogs.technet.com/b/askperf/archive/2010/08/13/introduction-to-the-new-sysinternals-tool-rammap.aspx> If you're unsure, save the data in RAMMAP as rmp, zip and upload them.
526,979
I switched on my laptop at 9 o’clock this morning and it is now 14:00 hours, where in after a series of reboots, hard or soft, I am able to open my browser. I opened a notepad and noted down following services and processes running on my system which right from the start consumes 1.32 GB of memory. 1.32 GB Memory is ...
2013/01/02
[ "https://superuser.com/questions/526979", "https://superuser.com", "https://superuser.com/users/63915/" ]
I have solved my problem I booted the system with Linux and deleted 1) C:\Program Files\KIS <-- Kaspersky Anti Virus 2) C:\Program Files\Java\JRE and rebooted the system works perfectly,now. Windows updates and antivirus software's are a problem in itself. I wanted to do some programming using eclipse and Java en...
Use RAMMap to see why Windows uses the Memory: <http://blogs.technet.com/b/askperf/archive/2010/08/13/introduction-to-the-new-sysinternals-tool-rammap.aspx> If you're unsure, save the data in RAMMAP as rmp, zip and upload them.
27,562,993
I having a table like this ``` --------------------------- |id |condition_values | --------------------------- |1 |2012-05-12 | |2 |2012-06-12 | |3 |2012-07-12 | |4 |2012-08-12 | --------------------------- ``` So when I trying to query like ``` select * from tableNam...
2014/12/19
[ "https://Stackoverflow.com/questions/27562993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2534236/" ]
``` select * from tableName where "value" >= TO_DATE('2012-05-12', 'yyyy-mm-dd') AND "value" <= TO_DATE('2012-07-12','yyyy-mm-dd'); -- ^^^^^ ``` You have an [implicit type conversion](http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements002.htm#sthref328) here using you NLS da...
~~`VALUE` is a reserved word. Either change the column name or:~~ ``` select * from tableName where `value` >= TO_DATE('2012-05-12', 'yyyy-mm-dd') AND value <= TO_DATE('2012-07-12','yyyy-mm-dd'); ``` Reference: [Reserved Words in Oracle](http://docs.oracle.com/cd/B19306_01/em.102/b40103/app_oracle_reserved_words.ht...
21,696
For building a cashback site, is there a WordPress theme or plugin that offers custom user registration + 'My account' panel?
2011/07/01
[ "https://wordpress.stackexchange.com/questions/21696", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5411/" ]
Just echoing what Chip already said: **Themes** are for *presentation*, **plugins** are for functionality. Custom user registration and a 'My Account' panel would be in the realm of custom functionality. To quote another WordPress developer: > > If you're building a bathroom and you change the wallpaper, the toilet ...
Themes shouldn't be incorporating user management. Themes are for *presentation* of content. Try the [Members Plugin](http://wordpress.org/extend/plugins/members/) instead.
12,293,427
I'm reading about the Factory Method pattern. I can understand when there is a single factory class, i.e. `StoreFactory#getStore()`, that returns a `Store` implementation based on some runtime or other state. But, from reading (e.g. [this link](http://www.blackwasp.co.uk/FactoryMethod.aspx)), there seems to be a ge...
2012/09/06
[ "https://Stackoverflow.com/questions/12293427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/512994/" ]
The link you are reading unfortunately does not give a realistic example of the pattern. In fact, as per the original GoF Design Patterns, this pattern is called **Abstract Factory** (Factory method is a different pattern). Abstract Factory pattern is used when you have factories that can create a **family of objects*...
The pattern gets interesting especially when it comes to testing. Now you can inject an `AbstractFactory` into a class and choose different types for different environments or tests without the need to change the classes (if the factory creates types that share common interfaces). The using classes don't have to depen...
12,293,427
I'm reading about the Factory Method pattern. I can understand when there is a single factory class, i.e. `StoreFactory#getStore()`, that returns a `Store` implementation based on some runtime or other state. But, from reading (e.g. [this link](http://www.blackwasp.co.uk/FactoryMethod.aspx)), there seems to be a ge...
2012/09/06
[ "https://Stackoverflow.com/questions/12293427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/512994/" ]
The link you are reading unfortunately does not give a realistic example of the pattern. In fact, as per the original GoF Design Patterns, this pattern is called **Abstract Factory** (Factory method is a different pattern). Abstract Factory pattern is used when you have factories that can create a **family of objects*...
When using Factory method, the method is still in the object, and you need to instantiate the correct object to access the method. The only abstraction you achieve, is because of the Abstract class. The Factory Method pattern is designed in this way. Perhaps, you were expecting it to be something like the Abstract Fac...
12,293,427
I'm reading about the Factory Method pattern. I can understand when there is a single factory class, i.e. `StoreFactory#getStore()`, that returns a `Store` implementation based on some runtime or other state. But, from reading (e.g. [this link](http://www.blackwasp.co.uk/FactoryMethod.aspx)), there seems to be a ge...
2012/09/06
[ "https://Stackoverflow.com/questions/12293427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/512994/" ]
The link you are reading unfortunately does not give a realistic example of the pattern. In fact, as per the original GoF Design Patterns, this pattern is called **Abstract Factory** (Factory method is a different pattern). Abstract Factory pattern is used when you have factories that can create a **family of objects*...
You gain extensibility and decoupling through inversion of control, while still allowing the object a margin of control over the actual process and timing.
26,179,840
Can you tell me how to get the object on which a form is based on from the Form object itself exemple : ``` $form = createForm(....., $objectForm); $form->handleRequest(); ``` Let's say I want to get $objectForm from $form. is it possible ?
2014/10/03
[ "https://Stackoverflow.com/questions/26179840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/690022/" ]
If you're developing a custom *FormType*, then you can simply use `$builder->getData()`; i.e. like this: ``` class ApplicationNetworkType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $object = $builder->getData(); } } ``` In your controller, ho...
You could get it from options array: ``` class YourFormType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $object = $options['data']; } } ```
54,826,964
I would like to remove some items from a table using Impex. The following example throws no errors, but nothing is removed. ``` REMOVE ProductReference;pk[unique=true] "#% impex.exportItemsFlexibleSearch(""select {pk} from {ProductReference as pr} where {pr.referenceType}=( {{select {pk} from {ProductReferenceTypeEnum...
2019/02/22
[ "https://Stackoverflow.com/questions/54826964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3751845/" ]
Importing the query- ``` REMOVE ProductReference;pk[unique=true] "#% impex.exportItemsFlexibleSearch(""select {pk} from {ProductReference as pr} where {pr.referenceType}=( {{select {pk} from {ProductReferenceTypeEnum as prte} where {prte.code} = 'CROSSELLING'}})"");" ``` is not working because you have not selected ...
use HAC -> SQL Query console to delete using direct SQL command. Enable Commit code After running the update go to Monitoring tab and clear the cache
54,826,964
I would like to remove some items from a table using Impex. The following example throws no errors, but nothing is removed. ``` REMOVE ProductReference;pk[unique=true] "#% impex.exportItemsFlexibleSearch(""select {pk} from {ProductReference as pr} where {pr.referenceType}=( {{select {pk} from {ProductReferenceTypeEnum...
2019/02/22
[ "https://Stackoverflow.com/questions/54826964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3751845/" ]
We need to export the script to generate zip file of import script and media file.Resultant zip file need to be imported with enablecodeexecution checked Alternatively groovy script can be executed, an example: ``` import de.hybris.platform.servicelayer.search.FlexibleSearchQuery; flexibleSearchService = spring.getBe...
use HAC -> SQL Query console to delete using direct SQL command. Enable Commit code After running the update go to Monitoring tab and clear the cache
3,498,849
everytime i test my selenium test, the instant of firefox will popup and show page of selenium rc. It's ok and cool. But i have problem. For every test i also have to see a firefox's page pop up and shown selenium plugin have been add to firefox. is there any way to configure selenium so it initiate firefox without a ...
2010/08/17
[ "https://Stackoverflow.com/questions/3498849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/293221/" ]
I'm sure this is a duplicate of another SO question, as I feel like I've answered it before, but I can't find it. If I do subsequently find it then I will update my answer. You need to set the `extensions.lastAppVersion` preference to match the version of Firefox that you're launching. Otherwise you will generally hav...
Removing the extensions.rdf file from profile directory will fix this issue . I have created a separate profile for Selenium tests, which is only used for Selenium Tests. I would love to hear if there is other way around . My "extensions.lastAppVersion" is updated and reflects the current browser version therefore the ...
3,498,849
everytime i test my selenium test, the instant of firefox will popup and show page of selenium rc. It's ok and cool. But i have problem. For every test i also have to see a firefox's page pop up and shown selenium plugin have been add to firefox. is there any way to configure selenium so it initiate firefox without a ...
2010/08/17
[ "https://Stackoverflow.com/questions/3498849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/293221/" ]
I'm sure this is a duplicate of another SO question, as I feel like I've answered it before, but I can't find it. If I do subsequently find it then I will update my answer. You need to set the `extensions.lastAppVersion` preference to match the version of Firefox that you're launching. Otherwise you will generally hav...
Use this - From the address bar type “about:config” and add/update the following: - `extensions.update.notifyUser (type=boolean; value=false)` - `extensions.newAddons (type=boolean; value=false)` It worked for me.
3,498,849
everytime i test my selenium test, the instant of firefox will popup and show page of selenium rc. It's ok and cool. But i have problem. For every test i also have to see a firefox's page pop up and shown selenium plugin have been add to firefox. is there any way to configure selenium so it initiate firefox without a ...
2010/08/17
[ "https://Stackoverflow.com/questions/3498849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/293221/" ]
I'm sure this is a duplicate of another SO question, as I feel like I've answered it before, but I can't find it. If I do subsequently find it then I will update my answer. You need to set the `extensions.lastAppVersion` preference to match the version of Firefox that you're launching. Otherwise you will generally hav...
Having found this answer and had a go, I found that merging the Extensions.rdf and extensions.ini file from the temporary profile created in a Selenium session and putting that into your Custom Profile directory solves this problem. When merging extensions.ini, be careful to avoid getting the pathnames wrong.
3,498,849
everytime i test my selenium test, the instant of firefox will popup and show page of selenium rc. It's ok and cool. But i have problem. For every test i also have to see a firefox's page pop up and shown selenium plugin have been add to firefox. is there any way to configure selenium so it initiate firefox without a ...
2010/08/17
[ "https://Stackoverflow.com/questions/3498849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/293221/" ]
Removing the extensions.rdf file from profile directory will fix this issue . I have created a separate profile for Selenium tests, which is only used for Selenium Tests. I would love to hear if there is other way around . My "extensions.lastAppVersion" is updated and reflects the current browser version therefore the ...
Use this - From the address bar type “about:config” and add/update the following: - `extensions.update.notifyUser (type=boolean; value=false)` - `extensions.newAddons (type=boolean; value=false)` It worked for me.
3,498,849
everytime i test my selenium test, the instant of firefox will popup and show page of selenium rc. It's ok and cool. But i have problem. For every test i also have to see a firefox's page pop up and shown selenium plugin have been add to firefox. is there any way to configure selenium so it initiate firefox without a ...
2010/08/17
[ "https://Stackoverflow.com/questions/3498849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/293221/" ]
Having found this answer and had a go, I found that merging the Extensions.rdf and extensions.ini file from the temporary profile created in a Selenium session and putting that into your Custom Profile directory solves this problem. When merging extensions.ini, be careful to avoid getting the pathnames wrong.
Use this - From the address bar type “about:config” and add/update the following: - `extensions.update.notifyUser (type=boolean; value=false)` - `extensions.newAddons (type=boolean; value=false)` It worked for me.
66,804,027
I want to produce a string that is a single letter (A, B or C), followed by two random numbers. I have written the following code: ``` enum ReportType {CHILD, ELDER, BOOMER}; public String setNumber(Report.ReportType type) { Random rand = new Random(); String number = String.valueOf(rand.nextInt...
2021/03/25
[ "https://Stackoverflow.com/questions/66804027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13841793/" ]
The statement accountNumber = number + prefix is never reached/executed. When the case happens, prefix is set, and then break statement causes the program to jump to the next line just after the closing switch curly bracket. You need to put it outside de switch block, so, after the decision of which prefix to set, the ...
You need to move the line `accoutNumber = prefix + number;` outside of the switch statement.
66,804,027
I want to produce a string that is a single letter (A, B or C), followed by two random numbers. I have written the following code: ``` enum ReportType {CHILD, ELDER, BOOMER}; public String setNumber(Report.ReportType type) { Random rand = new Random(); String number = String.valueOf(rand.nextInt...
2021/03/25
[ "https://Stackoverflow.com/questions/66804027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13841793/" ]
Java 12 introduced [switch expressions](https://docs.oracle.com/en/java/javase/13/language/switch-expressions.html): ``` String prefix = switch (type) { case CHILD -> "A"; case ELDER -> "B"; case BOOMER -> "C"; }; String accountNumber = prefix + number; ``` The advantage of this is that the compiler checks to ...
You need to move the line `accoutNumber = prefix + number;` outside of the switch statement.
66,804,027
I want to produce a string that is a single letter (A, B or C), followed by two random numbers. I have written the following code: ``` enum ReportType {CHILD, ELDER, BOOMER}; public String setNumber(Report.ReportType type) { Random rand = new Random(); String number = String.valueOf(rand.nextInt...
2021/03/25
[ "https://Stackoverflow.com/questions/66804027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13841793/" ]
Immediate fix is shown here. But better solutions are shown in [Answer by Andy Turner](https://stackoverflow.com/a/66804216/642706). * We expanded the scope of `prefix` by declaring *outside* your `switch` rather than *inside*. * We moved the `accountNumber` assignment to *below* the `switch` rather than *inside*. In ...
You need to move the line `accoutNumber = prefix + number;` outside of the switch statement.
66,804,027
I want to produce a string that is a single letter (A, B or C), followed by two random numbers. I have written the following code: ``` enum ReportType {CHILD, ELDER, BOOMER}; public String setNumber(Report.ReportType type) { Random rand = new Random(); String number = String.valueOf(rand.nextInt...
2021/03/25
[ "https://Stackoverflow.com/questions/66804027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13841793/" ]
Java 12 introduced [switch expressions](https://docs.oracle.com/en/java/javase/13/language/switch-expressions.html): ``` String prefix = switch (type) { case CHILD -> "A"; case ELDER -> "B"; case BOOMER -> "C"; }; String accountNumber = prefix + number; ``` The advantage of this is that the compiler checks to ...
The statement accountNumber = number + prefix is never reached/executed. When the case happens, prefix is set, and then break statement causes the program to jump to the next line just after the closing switch curly bracket. You need to put it outside de switch block, so, after the decision of which prefix to set, the ...
66,804,027
I want to produce a string that is a single letter (A, B or C), followed by two random numbers. I have written the following code: ``` enum ReportType {CHILD, ELDER, BOOMER}; public String setNumber(Report.ReportType type) { Random rand = new Random(); String number = String.valueOf(rand.nextInt...
2021/03/25
[ "https://Stackoverflow.com/questions/66804027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13841793/" ]
Immediate fix is shown here. But better solutions are shown in [Answer by Andy Turner](https://stackoverflow.com/a/66804216/642706). * We expanded the scope of `prefix` by declaring *outside* your `switch` rather than *inside*. * We moved the `accountNumber` assignment to *below* the `switch` rather than *inside*. In ...
The statement accountNumber = number + prefix is never reached/executed. When the case happens, prefix is set, and then break statement causes the program to jump to the next line just after the closing switch curly bracket. You need to put it outside de switch block, so, after the decision of which prefix to set, the ...
1,130,800
I would like to know if there are any common techniques of powering your computer off after a number of failed login attempts from the machine locally (from the terminal login, or from lightdm for example). For SSH or any remote login, I would just use fail2ban. I'm asking this for the purposes of a personal computer,...
2016/10/03
[ "https://superuser.com/questions/1130800", "https://superuser.com", "https://superuser.com/users/42683/" ]
Related to PAM, You would want to research how to implement pam\_exec.so to run a script to power off the machine for failed login attempts during authentication. There's a good resource here where someone implemented the same type of setup where he kept track of login counts to determine when the shutdown script shou...
You could go with `logwatcher` or `swatch` and shutdown after X failed login attempts. Local bruteforce? -- You mean somebody has a FPGA physically attached to your server attempting brute force?
1,130,800
I would like to know if there are any common techniques of powering your computer off after a number of failed login attempts from the machine locally (from the terminal login, or from lightdm for example). For SSH or any remote login, I would just use fail2ban. I'm asking this for the purposes of a personal computer,...
2016/10/03
[ "https://superuser.com/questions/1130800", "https://superuser.com", "https://superuser.com/users/42683/" ]
Related to PAM, You would want to research how to implement pam\_exec.so to run a script to power off the machine for failed login attempts during authentication. There's a good resource here where someone implemented the same type of setup where he kept track of login counts to determine when the shutdown script shou...
\***First, to be safe**, open another tty (Alt+Ctrl+F3) and login, so if you mess with your system you can revert your changes. (If you don't do that, you can still recover your system by: 1. At boot, edit grub boot line (press e) and add `init=/bin/sh` to the line starting by "linux", and when you reach the console: 2...
53,381,152
I have following example ``` #include <cstdint> class FooC { public: FooC(uint16_t iPort, uint16_t iPin) : PORT(iPort) , PIN(iPin) { }; ~FooC() = default; FooC() = delete; FooC(const FooC&) = delete; FooC(FooC&&) = delete; private: const uint16_t PORT; const uint16_t PIN; }; int ...
2018/11/19
[ "https://Stackoverflow.com/questions/53381152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7200859/" ]
In C++11 and C++14, you can use nested braces: ``` FooC array[2] = {{1,2}, {3,4}}; ``` In C++17 your code should already work as written thanks to the new prvalue/materialization rules ("guaranteed copy elision").
> > Is it possible to force in this example the calling of constructor with the parameters and still delete the default, move and copy constructor? > > > No with your current syntax (before C++17) and yes (in C++17). **Pre-C++17:** This is not possible. The aggregate initialization copies the initializers into t...
53,381,152
I have following example ``` #include <cstdint> class FooC { public: FooC(uint16_t iPort, uint16_t iPin) : PORT(iPort) , PIN(iPin) { }; ~FooC() = default; FooC() = delete; FooC(const FooC&) = delete; FooC(FooC&&) = delete; private: const uint16_t PORT; const uint16_t PIN; }; int ...
2018/11/19
[ "https://Stackoverflow.com/questions/53381152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7200859/" ]
In C++11 and C++14, you can use nested braces: ``` FooC array[2] = {{1,2}, {3,4}}; ``` In C++17 your code should already work as written thanks to the new prvalue/materialization rules ("guaranteed copy elision").
No, not possible. What you can do is **don't** mention these lines : ``` FooC() = delete; FooC(const FooC&) = delete; FooC(FooC&&) = delete; ``` So, now your code only will have default destructor. The compiler will not generate any move constructor or move assignment operator as destructor is defined(default). Thi...
53,381,152
I have following example ``` #include <cstdint> class FooC { public: FooC(uint16_t iPort, uint16_t iPin) : PORT(iPort) , PIN(iPin) { }; ~FooC() = default; FooC() = delete; FooC(const FooC&) = delete; FooC(FooC&&) = delete; private: const uint16_t PORT; const uint16_t PIN; }; int ...
2018/11/19
[ "https://Stackoverflow.com/questions/53381152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7200859/" ]
> > Is it possible to force in this example the calling of constructor with the parameters and still delete the default, move and copy constructor? > > > No with your current syntax (before C++17) and yes (in C++17). **Pre-C++17:** This is not possible. The aggregate initialization copies the initializers into t...
No, not possible. What you can do is **don't** mention these lines : ``` FooC() = delete; FooC(const FooC&) = delete; FooC(FooC&&) = delete; ``` So, now your code only will have default destructor. The compiler will not generate any move constructor or move assignment operator as destructor is defined(default). Thi...
5,293,776
How do I access `UITableViewController` parameter from within a subclass'ed `UITableViewCell`? I have a parameter in the `UITableViewController` for the font size (i.e. users can change font size). So the `layoutSubviews` method in my custom subclassed `UITableViewCell` will need to access the latest font when it need...
2011/03/14
[ "https://Stackoverflow.com/questions/5293776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/173520/" ]
Accessing the `UITableViewController` object from within your cell isn't a good approach in terms of design. What you should be doing is creating an ivar in the table cell itself to store the `UIFont` object: ``` @interface CustomCell : UITableViewCell { UIFont *font; } @property (nonatomic, retain) UIFont *font; ...
There are a few ways to do it: access the UITableViewController via a property on the application delegate (which you can access from anywhere using `[UIApplication sharedApplication].delegate`), give the cell a reference to the UITableViewController when you create it in `tableView:cellForRowAtIndexPath:`, or follow t...
7,198,267
I'm seeing this on our production site as well as a small test site I setup just to test this out... Basically, it appears that requests handled by mvc never time out. I've set an executionTimeout in my web.config and turned off debug mode. I've then added an infinite loop of thread.sleeps to both a regular aspx page ...
2011/08/25
[ "https://Stackoverflow.com/questions/7198267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/268957/" ]
I found the cause for this, methinks: This method is in the WrappedAsyncResult class, which the MvcHandler class uses via BeginProcessRequest: ``` public static IAsyncResult BeginSynchronous<TResult>(AsyncCallback callback, object state, Func<TResult> func, object tag) { BeginInvokeDelegate beginDelegate = delega...
It should work when these conditions are met: 1) Domain name is not localhost (to test timeout you should use "YourComputerName" instead of "localhost"). 2) Project is compiled in Release mode. 3) compilation debug="false" if not look here for an alternative (ScriptTimeOut): [ASP.NET MVC and httpRuntime executionTi...
7,198,267
I'm seeing this on our production site as well as a small test site I setup just to test this out... Basically, it appears that requests handled by mvc never time out. I've set an executionTimeout in my web.config and turned off debug mode. I've then added an infinite loop of thread.sleeps to both a regular aspx page ...
2011/08/25
[ "https://Stackoverflow.com/questions/7198267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/268957/" ]
It should work when these conditions are met: 1) Domain name is not localhost (to test timeout you should use "YourComputerName" instead of "localhost"). 2) Project is compiled in Release mode. 3) compilation debug="false" if not look here for an alternative (ScriptTimeOut): [ASP.NET MVC and httpRuntime executionTi...
Still happening for me in MVC 4. I have submitted this to microsoft as a bug: <https://connect.microsoft.com/VisualStudio/feedback/details/781171/asp-net-mvc-executiontimeout-does-not-work> Update: Microsoft commented with the following: > > The execution timeout feature is not advised to be used in MVC > applica...
7,198,267
I'm seeing this on our production site as well as a small test site I setup just to test this out... Basically, it appears that requests handled by mvc never time out. I've set an executionTimeout in my web.config and turned off debug mode. I've then added an infinite loop of thread.sleeps to both a regular aspx page ...
2011/08/25
[ "https://Stackoverflow.com/questions/7198267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/268957/" ]
I found the cause for this, methinks: This method is in the WrappedAsyncResult class, which the MvcHandler class uses via BeginProcessRequest: ``` public static IAsyncResult BeginSynchronous<TResult>(AsyncCallback callback, object state, Func<TResult> func, object tag) { BeginInvokeDelegate beginDelegate = delega...
Still happening for me in MVC 4. I have submitted this to microsoft as a bug: <https://connect.microsoft.com/VisualStudio/feedback/details/781171/asp-net-mvc-executiontimeout-does-not-work> Update: Microsoft commented with the following: > > The execution timeout feature is not advised to be used in MVC > applica...
41,474,276
I want to write an extension that does the opposite of the ["focus-follows mouse"](http://worldofgnome.org/how-to-set-focus-follows-mouse-in-gnome-3-windows/) setting in GNOME Shell: I want to make my pointer move to the center of the currently focused window. Can this be done in a GNOME Shell extension? I see some GN...
2017/01/04
[ "https://Stackoverflow.com/questions/41474276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/730070/" ]
Found this code in `overview.js` ``` Gdk = imports.gi.Gdk let display = Gdk.Display.get_default(); let deviceManager = display.get_device_manager(); let pointer = deviceManager.get_client_pointer(); let [screen, pointerX, pointerY] = pointer.get_position(); pointer.warp(screen, 10, 10); ```
Are you willing to write your own script? If you are, I have found three tools, which, if used together, can get the job done for you. First, use [`xprop`](https://unix.stackexchange.com/questions/19161/getting-a-windows-pid-by-clicking-on-it) to get the PID of the window you have clicked on. Next, use [`xwininfo`]...
67,649,409
im attempting to group words by their length (e.g. number of characters in each words) so that the expected output can look something like this: 3:500, 4:232, 5:664, 6,:6311, 7:5553 etc. I have gotten the number of times certain words appear in the .txt file, though I don't know how to group these words into a tally o...
2021/05/22
[ "https://Stackoverflow.com/questions/67649409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15760368/" ]
You can create another dictionary that uses the word length as keys and increment values when you see another word of the same length. ``` fname = 'temp.txt' try: fhand = open(fname, encoding='utf-8') d = dict() for line in fhand: words = line.split() for word in words: d[wo...
Try this way, ``` from collections import Counter words = ['test','demo','test1','demo','nandy','azure','cloud','azure','dev','prod','test'] words_count = list(map(len,words)) data = Counter(words_count) print(data) # Counter({4: 5, 5: 5, 3: 1}) ``` Or without any modules do, ``` words = ['test','demo','test1',...
67,649,409
im attempting to group words by their length (e.g. number of characters in each words) so that the expected output can look something like this: 3:500, 4:232, 5:664, 6,:6311, 7:5553 etc. I have gotten the number of times certain words appear in the .txt file, though I don't know how to group these words into a tally o...
2021/05/22
[ "https://Stackoverflow.com/questions/67649409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15760368/" ]
You can try this ``` # Open the file in read mode text = open("sample.txt", "r") # Create an empty dictionary d = dict() # Loop through each line of the file for line in text: # Remove the leading spaces and newline character line = line.strip() # Convert the characters in line to # lowercase to avo...
Try this way, ``` from collections import Counter words = ['test','demo','test1','demo','nandy','azure','cloud','azure','dev','prod','test'] words_count = list(map(len,words)) data = Counter(words_count) print(data) # Counter({4: 5, 5: 5, 3: 1}) ``` Or without any modules do, ``` words = ['test','demo','test1',...
67,649,409
im attempting to group words by their length (e.g. number of characters in each words) so that the expected output can look something like this: 3:500, 4:232, 5:664, 6,:6311, 7:5553 etc. I have gotten the number of times certain words appear in the .txt file, though I don't know how to group these words into a tally o...
2021/05/22
[ "https://Stackoverflow.com/questions/67649409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15760368/" ]
You can create another dictionary that uses the word length as keys and increment values when you see another word of the same length. ``` fname = 'temp.txt' try: fhand = open(fname, encoding='utf-8') d = dict() for line in fhand: words = line.split() for word in words: d[wo...
You don't need to set the key to the word but to the length of the word. So the code would be: ``` fname= input('Enter file: ') #if len(fname) < 1: fname = 'LOTR.txt' try: fhand = open(fname, encoding = "utf8") d = dict() for line in fhand: words = line.split() for word in words: ...
67,649,409
im attempting to group words by their length (e.g. number of characters in each words) so that the expected output can look something like this: 3:500, 4:232, 5:664, 6,:6311, 7:5553 etc. I have gotten the number of times certain words appear in the .txt file, though I don't know how to group these words into a tally o...
2021/05/22
[ "https://Stackoverflow.com/questions/67649409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15760368/" ]
You can try this ``` # Open the file in read mode text = open("sample.txt", "r") # Create an empty dictionary d = dict() # Loop through each line of the file for line in text: # Remove the leading spaces and newline character line = line.strip() # Convert the characters in line to # lowercase to avo...
You don't need to set the key to the word but to the length of the word. So the code would be: ``` fname= input('Enter file: ') #if len(fname) < 1: fname = 'LOTR.txt' try: fhand = open(fname, encoding = "utf8") d = dict() for line in fhand: words = line.split() for word in words: ...
59,107,489
Are there any method to write spark dataframe directly to xls/xlsx format ???? Most of the example in the web showing there is example for panda dataframes. but I would like to use spark dataframe for working with my data. Any idea ?
2019/11/29
[ "https://Stackoverflow.com/questions/59107489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11446101/" ]
I'm assuming that because you have the "databricks" tag you are wanting to create an .xlsx file within databricks file store and that you are running code within databricks notebooks. I'm also going to assume that your notebooks are running python. There is no direct way to save an excel document from a spark datafram...
I believe you can do it like this. ``` sourcePropertySet.write .format("com.databricks.spark.csv") .option("header", "true") .save("D:\\resultset.csv") ``` I'm not sure you can write directly to Excel, but Excel can definitely consume a CSV. This is almost certainly the easiest way of doing this kind of ...
59,107,489
Are there any method to write spark dataframe directly to xls/xlsx format ???? Most of the example in the web showing there is example for panda dataframes. but I would like to use spark dataframe for working with my data. Any idea ?
2019/11/29
[ "https://Stackoverflow.com/questions/59107489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11446101/" ]
I believe you can do it like this. ``` sourcePropertySet.write .format("com.databricks.spark.csv") .option("header", "true") .save("D:\\resultset.csv") ``` I'm not sure you can write directly to Excel, but Excel can definitely consume a CSV. This is almost certainly the easiest way of doing this kind of ...
Yet Pyspark does not offer any method to save excel file. But you can save csv file, then it can be read in Excel. From pyspark.sql module version 2.3 you have write.csv: df.write.csv('path/filename')) Documentation: <https://spark.apache.org/docs/latest/api/python/pyspark.sql.html?highlight=save>
59,107,489
Are there any method to write spark dataframe directly to xls/xlsx format ???? Most of the example in the web showing there is example for panda dataframes. but I would like to use spark dataframe for working with my data. Any idea ?
2019/11/29
[ "https://Stackoverflow.com/questions/59107489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11446101/" ]
It **is** possible to generate an Excel file from pySpark. ``` df_spark.write.format("com.crealytics.spark.excel")\ .option("header", "true")\ .mode("overwrite")\ .save(path) ``` You need to install the `com.crealytics:spark-excel_2.12:0.13.5` (or a more recent version of course) library though, for example in...
I believe you can do it like this. ``` sourcePropertySet.write .format("com.databricks.spark.csv") .option("header", "true") .save("D:\\resultset.csv") ``` I'm not sure you can write directly to Excel, but Excel can definitely consume a CSV. This is almost certainly the easiest way of doing this kind of ...
59,107,489
Are there any method to write spark dataframe directly to xls/xlsx format ???? Most of the example in the web showing there is example for panda dataframes. but I would like to use spark dataframe for working with my data. Any idea ?
2019/11/29
[ "https://Stackoverflow.com/questions/59107489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11446101/" ]
I'm assuming that because you have the "databricks" tag you are wanting to create an .xlsx file within databricks file store and that you are running code within databricks notebooks. I'm also going to assume that your notebooks are running python. There is no direct way to save an excel document from a spark datafram...
Yet Pyspark does not offer any method to save excel file. But you can save csv file, then it can be read in Excel. From pyspark.sql module version 2.3 you have write.csv: df.write.csv('path/filename')) Documentation: <https://spark.apache.org/docs/latest/api/python/pyspark.sql.html?highlight=save>
59,107,489
Are there any method to write spark dataframe directly to xls/xlsx format ???? Most of the example in the web showing there is example for panda dataframes. but I would like to use spark dataframe for working with my data. Any idea ?
2019/11/29
[ "https://Stackoverflow.com/questions/59107489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11446101/" ]
I'm assuming that because you have the "databricks" tag you are wanting to create an .xlsx file within databricks file store and that you are running code within databricks notebooks. I'm also going to assume that your notebooks are running python. There is no direct way to save an excel document from a spark datafram...
You can not save it directly but you can have it as its stored in temp location and move it to your directory. My code piece is: ``` import xlsxwriter import pandas as pd1 workbook = xlsxwriter.Workbook('data_checks_output.xlsx') worksheet = workbook.add_worksheet('top_rows') ``` Create a Pandas Excel writer us...
59,107,489
Are there any method to write spark dataframe directly to xls/xlsx format ???? Most of the example in the web showing there is example for panda dataframes. but I would like to use spark dataframe for working with my data. Any idea ?
2019/11/29
[ "https://Stackoverflow.com/questions/59107489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11446101/" ]
It **is** possible to generate an Excel file from pySpark. ``` df_spark.write.format("com.crealytics.spark.excel")\ .option("header", "true")\ .mode("overwrite")\ .save(path) ``` You need to install the `com.crealytics:spark-excel_2.12:0.13.5` (or a more recent version of course) library though, for example in...
Yet Pyspark does not offer any method to save excel file. But you can save csv file, then it can be read in Excel. From pyspark.sql module version 2.3 you have write.csv: df.write.csv('path/filename')) Documentation: <https://spark.apache.org/docs/latest/api/python/pyspark.sql.html?highlight=save>
59,107,489
Are there any method to write spark dataframe directly to xls/xlsx format ???? Most of the example in the web showing there is example for panda dataframes. but I would like to use spark dataframe for working with my data. Any idea ?
2019/11/29
[ "https://Stackoverflow.com/questions/59107489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11446101/" ]
You can not save it directly but you can have it as its stored in temp location and move it to your directory. My code piece is: ``` import xlsxwriter import pandas as pd1 workbook = xlsxwriter.Workbook('data_checks_output.xlsx') worksheet = workbook.add_worksheet('top_rows') ``` Create a Pandas Excel writer us...
Yet Pyspark does not offer any method to save excel file. But you can save csv file, then it can be read in Excel. From pyspark.sql module version 2.3 you have write.csv: df.write.csv('path/filename')) Documentation: <https://spark.apache.org/docs/latest/api/python/pyspark.sql.html?highlight=save>
59,107,489
Are there any method to write spark dataframe directly to xls/xlsx format ???? Most of the example in the web showing there is example for panda dataframes. but I would like to use spark dataframe for working with my data. Any idea ?
2019/11/29
[ "https://Stackoverflow.com/questions/59107489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11446101/" ]
It **is** possible to generate an Excel file from pySpark. ``` df_spark.write.format("com.crealytics.spark.excel")\ .option("header", "true")\ .mode("overwrite")\ .save(path) ``` You need to install the `com.crealytics:spark-excel_2.12:0.13.5` (or a more recent version of course) library though, for example in...
You can not save it directly but you can have it as its stored in temp location and move it to your directory. My code piece is: ``` import xlsxwriter import pandas as pd1 workbook = xlsxwriter.Workbook('data_checks_output.xlsx') worksheet = workbook.add_worksheet('top_rows') ``` Create a Pandas Excel writer us...
47,034,073
Have a button on a mapview which is used to calculate the nearest location from the locations i have plotted on map. I have applied some code but when i click the button the app crashes by giving this error, > > [\_\_NSDictionaryI coordinate]: unrecognized selector sent to instance 0x174e61b40 > 2017-10-31 15:20:00....
2017/10/31
[ "https://Stackoverflow.com/questions/47034073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8861798/" ]
``` YourRepositoryName repo = new YourRepositoryName(); var _data = repo.GetStops(); ```
``` public JsonResult GetStops() { var repo = new TheRepository(); var listOfHeatMapVm = repo.GetStops(); //Convert the list of HeatMapVm to Json result here. return Json(listOfHeatMapVm); } ```