qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
3,996,844
Hello Suppose I have 3 references that goes one after another i.e [1][2][3]. But I want to see [1]-[3]. What should I do. Thank you.
2010/10/22
[ "https://Stackoverflow.com/questions/3996844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/466056/" ]
There are ways to change how bibtex formats your citations. One way is to use the [cite](https://ctan.org/pkg/cite) package. Another is the [natbib](http://ctan.org/pkg/natbib) package perhaps with the sort&compress option (i.e., \usepackage[sort&compress]{natbib}). Many publications also have their own styles that wil...
If you're using biblatex, you can use the `numeric-comp` style (see [Section 3.3.1](https://mirror.unpad.ac.id/ctan/macros/latex/contrib/biblatex/doc/biblatex.pdf#subsection.3.3) of the documentation) ```tex \usepackage[style=numeric-comp]{biblatex} ``` This will sort (and compress) the numbers inside the citation `...
18,990,952
I'm using an oracle table. Let's pretend I have a simple table that has names and datetimestamps: ``` Name Time --- --- joe 01JAN1970:00:00:01 jane 04MAR2010:20:55:11 julie 22DEC1984:11:11:11 ``` I want to add a third column. Let's call it date. I want to truncate off the time. ``` Name Time D...
2013/09/24
[ "https://Stackoverflow.com/questions/18990952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2812628/" ]
`created` is the wrong concept. You have a set of nodes in the "from" graph, and you're creating a set of *new* nodes in the "to" graph. `created.add(copyTo)` will add a new node, from the "to" graph, to the set. But when you go through `created.iterator` to see if a node is already there, you're looking for a node fro...
The simplest way to create a deep copy is to serialize into memory and then deserialize, see this question: [How do you make a deep copy of an object in Java?](https://stackoverflow.com/questions/64036/how-do-you-make-a-deep-copy-of-an-object-in-java)
18,990,952
I'm using an oracle table. Let's pretend I have a simple table that has names and datetimestamps: ``` Name Time --- --- joe 01JAN1970:00:00:01 jane 04MAR2010:20:55:11 julie 22DEC1984:11:11:11 ``` I want to add a third column. Let's call it date. I want to truncate off the time. ``` Name Time D...
2013/09/24
[ "https://Stackoverflow.com/questions/18990952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2812628/" ]
`created` is the wrong concept. You have a set of nodes in the "from" graph, and you're creating a set of *new* nodes in the "to" graph. `created.add(copyTo)` will add a new node, from the "to" graph, to the set. But when you go through `created.iterator` to see if a node is already there, you're looking for a node fro...
you need more consistent way to map source vertices onto resulting vertices. Declare `created` as hashmap, not hashset. Create new vertex only when `created.get(oldVertex)==null`.
8,491,173
Well, the question is; "Write a C code that finds zero of a function y = ax + b, without solving the equation. The zero will be found within the precision limit ϵ = 10 - 3. You'll start at x=0, and move x in the proper direction until |y|< ϵ." I'm a newbie, to programming, and don't know anything about this ϵ thing ei...
2011/12/13
[ "https://Stackoverflow.com/questions/8491173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1067005/" ]
It means you have to solve the inequality |ax+b| < 10^-3 by trying different values for x. Since this is a linear function it's easy. Start with a random number at x and then increase it or decrease it depending on the result of ax+b. I.e. if you move to one direction and the results go more away then you should follo...
|y| < 10⁻³, or well, -0.001 < y < 0.001. You must increase or decrease x (starting from 0, as you've said) in order to make y to take a value between -0.001 and 0.001. About ϵ, a.k.a. epsilon, is used to denote a very small value. For this problem, ϵ denotes a tolerance value, as it's not needed y to take a strict va...
54,046,486
I have a file `pattern.txt`: ``` pattern1 pattern2 pattern3 pattern4 ... ``` and I have another file called `text.txt` and it contains a huge random string with spaces, newlines, etc. I want to process the content of those two files to be able to make these calls (the order of `-p` and `-t` doesn't matter): ``` py...
2019/01/04
[ "https://Stackoverflow.com/questions/54046486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6147182/" ]
Use `xargs -a` to execute `main.py` once for each line in `pattern.txt`. ``` xargs -a pattern.txt -I {} python3 main.py -p {} -t "$(< text.txt)" ``` You can also use `-P` to run multiple copies of the script in parallel. If `main.py` is executable and has a shebang line such as `#!/usr/bin/env python3` then it's be...
You could loop each line through the pattern.txt: ``` while read line; do python3 main.py -p "$line" -t 'text.text content'; done < pattern.txt ```
69,423,284
if i place opacity : 0 inside fist-line pseudo class it is not working do you know why is it any priority issue. css code : ``` p::first-line{ color : green; font-size : 30px; opacity : 0 } <p>Really can't remember where I left my spine Carrying my body in a bag for dimes Hidden in the pa...
2021/10/03
[ "https://Stackoverflow.com/questions/69423284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17059009/" ]
open file in binary mode, and write in binary mode ```py original_file = open('C:\original.png', 'rb') # rb = Read Binary copied_file = open('C:\original-copy.png', 'wb') #wb = Write Binary copied_file.write(original_file.read()) original_file.close() copied_file.close() ``` [Python File Documentation](https://www...
You can use [`pathlib`](https://docs.python.org/3/library/pathlib.html): ```py from pathlib import Path Path("old_file.png").write_bytes(Path("new_file.png").read_bytes()) ```
104,065
PG&E intends to file for bankruptcy on January 29th. They state it is largely due to the estimated $30 billion in liabilities from the recent disasters, fire suppression costs, and attorney fees. How can they file for bankruptcy now, when they haven't even been found liable for anything yet?
2019/01/14
[ "https://money.stackexchange.com/questions/104065", "https://money.stackexchange.com", "https://money.stackexchange.com/users/49379/" ]
As of the most recent quarterly filing the company had $42 billion dollars of long term debt. The issue is the bond market knows the liabilities are coming and the company is all but incapable of issuing new debt at terms that are reasonable or sustainable. Rather than waiting for the death spiral the company is going ...
They know the lawsuits and liability are coming. If they expect to have liabilities that will exceed their ability to pay and continue operating, they will have to file bankruptcy at some time. Think about what happens if they wait to do this. How long do they wait? Say there's a few lawsuits that they are required to...
104,065
PG&E intends to file for bankruptcy on January 29th. They state it is largely due to the estimated $30 billion in liabilities from the recent disasters, fire suppression costs, and attorney fees. How can they file for bankruptcy now, when they haven't even been found liable for anything yet?
2019/01/14
[ "https://money.stackexchange.com/questions/104065", "https://money.stackexchange.com", "https://money.stackexchange.com/users/49379/" ]
They know the lawsuits and liability are coming. If they expect to have liabilities that will exceed their ability to pay and continue operating, they will have to file bankruptcy at some time. Think about what happens if they wait to do this. How long do they wait? Say there's a few lawsuits that they are required to...
Companies (like pg&e) declare bankruptcy before actually incurring the anticipated debt from lawsuits. That way all new debt typically gets treated in the same class as “unsecured debt”. Senior secured debt typically gets repaid 100%. All other unsecured debt generally gets treated the same way, so if the company can o...
104,065
PG&E intends to file for bankruptcy on January 29th. They state it is largely due to the estimated $30 billion in liabilities from the recent disasters, fire suppression costs, and attorney fees. How can they file for bankruptcy now, when they haven't even been found liable for anything yet?
2019/01/14
[ "https://money.stackexchange.com/questions/104065", "https://money.stackexchange.com", "https://money.stackexchange.com/users/49379/" ]
As of the most recent quarterly filing the company had $42 billion dollars of long term debt. The issue is the bond market knows the liabilities are coming and the company is all but incapable of issuing new debt at terms that are reasonable or sustainable. Rather than waiting for the death spiral the company is going ...
Companies (like pg&e) declare bankruptcy before actually incurring the anticipated debt from lawsuits. That way all new debt typically gets treated in the same class as “unsecured debt”. Senior secured debt typically gets repaid 100%. All other unsecured debt generally gets treated the same way, so if the company can o...
7,407,242
What if I have `handler.postDelayed` thread already under execution and I need to cancel it?
2011/09/13
[ "https://Stackoverflow.com/questions/7407242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397991/" ]
I do this to cancel postDelays, per the Android: [removeCallbacks](http://developer.android.com/reference/android/os/Handler.html#removeCallbacks%28java.lang.Runnable%29) removes any pending posts of Runnable r that are in the message queue. ``` handler.removeCallbacks(runnableRunner); ``` or use to remove all messa...
If you don't want to keep a reference of the runnable, you could simply call: ``` handler.removeCallbacksAndMessages(null); ``` [The official documentation](http://developer.android.com/reference/android/os/Handler.html#removeCallbacksAndMessages(java.lang.Object)) says: > > ... If token is null, all callbacks and...
7,407,242
What if I have `handler.postDelayed` thread already under execution and I need to cancel it?
2011/09/13
[ "https://Stackoverflow.com/questions/7407242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397991/" ]
I do this to cancel postDelays, per the Android: [removeCallbacks](http://developer.android.com/reference/android/os/Handler.html#removeCallbacks%28java.lang.Runnable%29) removes any pending posts of Runnable r that are in the message queue. ``` handler.removeCallbacks(runnableRunner); ``` or use to remove all messa...
I had an instance where I needed to cancel a postDelayed while it was in the process of running, so the code above didn't work for my example. What I ended up doing was having a boolean check inside of my Runnable so when the code was executed after the given time it would either fire based on what the boolean value at...
7,407,242
What if I have `handler.postDelayed` thread already under execution and I need to cancel it?
2011/09/13
[ "https://Stackoverflow.com/questions/7407242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397991/" ]
If you don't want to keep a reference of the runnable, you could simply call: ``` handler.removeCallbacksAndMessages(null); ``` [The official documentation](http://developer.android.com/reference/android/os/Handler.html#removeCallbacksAndMessages(java.lang.Object)) says: > > ... If token is null, all callbacks and...
I had an instance where I needed to cancel a postDelayed while it was in the process of running, so the code above didn't work for my example. What I ended up doing was having a boolean check inside of my Runnable so when the code was executed after the given time it would either fire based on what the boolean value at...
41,896,579
I have a column named "format", which contains rows with strings separated by coma `,` . Something like: -query: ``` SELECT DISTINCT [format] FROM [mydb].[dbo].[Demand_conditions] ``` -result: ``` format <- column's name ,one,two,three, <- row 1 ,paper,cardboard,metal, <- row 2 ...
2017/01/27
[ "https://Stackoverflow.com/questions/41896579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6937526/" ]
Your syntax is probably syntactically invalid, because I doubt that the split string function takes a table as an argument. Split string functions usually just take strings. The appropriate method is `apply`. You can assign column names in table aliases. I would do this as: ``` SELECT distinct s.format FROM [mydb].[d...
This should work. ``` SELECT * FROM [mydb].[dbo].splitstring( ( SELECT 'format' UNION SELECT DISTINCT [format] FROM [mydb].[dbo].[Demand_conditions])) ```
41,896,579
I have a column named "format", which contains rows with strings separated by coma `,` . Something like: -query: ``` SELECT DISTINCT [format] FROM [mydb].[dbo].[Demand_conditions] ``` -result: ``` format <- column's name ,one,two,three, <- row 1 ,paper,cardboard,metal, <- row 2 ...
2017/01/27
[ "https://Stackoverflow.com/questions/41896579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6937526/" ]
This is what worked for me: ``` SELECT f.[format] from ( SELECT * FROM [mydb].[dbo].splitstring( (SELECT DISTINCT [format] FROM [mydb].[dbo].[Demand_conditions])) ) f([format]) ```
This should work. ``` SELECT * FROM [mydb].[dbo].splitstring( ( SELECT 'format' UNION SELECT DISTINCT [format] FROM [mydb].[dbo].[Demand_conditions])) ```
41,896,579
I have a column named "format", which contains rows with strings separated by coma `,` . Something like: -query: ``` SELECT DISTINCT [format] FROM [mydb].[dbo].[Demand_conditions] ``` -result: ``` format <- column's name ,one,two,three, <- row 1 ,paper,cardboard,metal, <- row 2 ...
2017/01/27
[ "https://Stackoverflow.com/questions/41896579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6937526/" ]
Your syntax is probably syntactically invalid, because I doubt that the split string function takes a table as an argument. Split string functions usually just take strings. The appropriate method is `apply`. You can assign column names in table aliases. I would do this as: ``` SELECT distinct s.format FROM [mydb].[d...
This is what worked for me: ``` SELECT f.[format] from ( SELECT * FROM [mydb].[dbo].splitstring( (SELECT DISTINCT [format] FROM [mydb].[dbo].[Demand_conditions])) ) f([format]) ```
18,343
I was going to attempt Samba over SSH, any better ideas? Edit: My mom has been bugging me to do some offsite backing up of her files. She currently uses [Norton Ghost](http://en.wikipedia.org/wiki/Ghost_%28software%29). I have a VPS that I use for some other stuff and I figured that I could just setup a FTP server and...
2009/06/03
[ "https://serverfault.com/questions/18343", "https://serverfault.com", "https://serverfault.com/users/7705/" ]
Your approach might work but WebDAV might fit the bill as well.
scp (in PuTTY's PSCP or WinSCP), WebDAV, or rsync are probably your best options. Set (as a scheduled task) and forget! +1 for a Mom who's nagging you about providing you with an offsite-backup!
18,343
I was going to attempt Samba over SSH, any better ideas? Edit: My mom has been bugging me to do some offsite backing up of her files. She currently uses [Norton Ghost](http://en.wikipedia.org/wiki/Ghost_%28software%29). I have a VPS that I use for some other stuff and I figured that I could just setup a FTP server and...
2009/06/03
[ "https://serverfault.com/questions/18343", "https://serverfault.com", "https://serverfault.com/users/7705/" ]
An alternate suggestion that might help - It seems as though you might be over complicating the issue. There are multiple simple backup utilities for Windows, not withstanding your Norton solution. Admittedly it's a little low-tech, but it seriously fulfills the "offsite" requirement AND removes the network from the ...
scp (in PuTTY's PSCP or WinSCP), WebDAV, or rsync are probably your best options. Set (as a scheduled task) and forget! +1 for a Mom who's nagging you about providing you with an offsite-backup!
18,343
I was going to attempt Samba over SSH, any better ideas? Edit: My mom has been bugging me to do some offsite backing up of her files. She currently uses [Norton Ghost](http://en.wikipedia.org/wiki/Ghost_%28software%29). I have a VPS that I use for some other stuff and I figured that I could just setup a FTP server and...
2009/06/03
[ "https://serverfault.com/questions/18343", "https://serverfault.com", "https://serverfault.com/users/7705/" ]
This doesn't really answer the question but I'm a fan of [Mozy](http://mozy.com) for off-site backup. * Unlike Dropbox (which I do like too for sharing/syncing files), your files can be in any combination of directories. * Backups happens automatically in the background so you don't need to think about it * Backups ar...
If you prefer a commercial version (because of the suppport) to Dokan-SSH, you can try ExpanDrive for Windows [ExpanDrive for Windows website](http://www.expandrive.com/windows)
18,343
I was going to attempt Samba over SSH, any better ideas? Edit: My mom has been bugging me to do some offsite backing up of her files. She currently uses [Norton Ghost](http://en.wikipedia.org/wiki/Ghost_%28software%29). I have a VPS that I use for some other stuff and I figured that I could just setup a FTP server and...
2009/06/03
[ "https://serverfault.com/questions/18343", "https://serverfault.com", "https://serverfault.com/users/7705/" ]
It looks like there is a package that supports sshfs on Windows, it's called Dokan: <http://dokan-dev.net/en/> EDIT: in light of your recent edit you may find PSCP sufficient. PSCP is a command-line scp program from PuTTY: <http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html> You could dump all files to ...
Seems like a sensible idea to me. I've done this before. There is a slight snag in that your local windows machine is probably already running it's own file sharing server (so you can't bind to localhost:139 when forwarding) and I you can't specify which port to connect to for file sharing. Really simple solution is ...
18,343
I was going to attempt Samba over SSH, any better ideas? Edit: My mom has been bugging me to do some offsite backing up of her files. She currently uses [Norton Ghost](http://en.wikipedia.org/wiki/Ghost_%28software%29). I have a VPS that I use for some other stuff and I figured that I could just setup a FTP server and...
2009/06/03
[ "https://serverfault.com/questions/18343", "https://serverfault.com", "https://serverfault.com/users/7705/" ]
I just tested WinSCP for you, it works with nothing but an open SSH port on the server--was very straight-forward. It doesn't allow a true mount from looks of things, it gives you one of those left/right copy things instead. I bet there is an SSHFS client for windows out there somewhere though if you really need that...
scp (in PuTTY's PSCP or WinSCP), WebDAV, or rsync are probably your best options. Set (as a scheduled task) and forget! +1 for a Mom who's nagging you about providing you with an offsite-backup!
18,343
I was going to attempt Samba over SSH, any better ideas? Edit: My mom has been bugging me to do some offsite backing up of her files. She currently uses [Norton Ghost](http://en.wikipedia.org/wiki/Ghost_%28software%29). I have a VPS that I use for some other stuff and I figured that I could just setup a FTP server and...
2009/06/03
[ "https://serverfault.com/questions/18343", "https://serverfault.com", "https://serverfault.com/users/7705/" ]
This doesn't really answer the question but I'm a fan of [Mozy](http://mozy.com) for off-site backup. * Unlike Dropbox (which I do like too for sharing/syncing files), your files can be in any combination of directories. * Backups happens automatically in the background so you don't need to think about it * Backups ar...
I use a VPN for this. The file server runs poptop. Windows machines connect to it via the built in VPN client. SAMBA to share the folder, and voila. Use WINS for naming for extra credit so the Windows machines don't need shortcuts to things like \192.168.0.x\sharename on the desktop.
18,343
I was going to attempt Samba over SSH, any better ideas? Edit: My mom has been bugging me to do some offsite backing up of her files. She currently uses [Norton Ghost](http://en.wikipedia.org/wiki/Ghost_%28software%29). I have a VPS that I use for some other stuff and I figured that I could just setup a FTP server and...
2009/06/03
[ "https://serverfault.com/questions/18343", "https://serverfault.com", "https://serverfault.com/users/7705/" ]
It looks like there is a package that supports sshfs on Windows, it's called Dokan: <http://dokan-dev.net/en/> EDIT: in light of your recent edit you may find PSCP sufficient. PSCP is a command-line scp program from PuTTY: <http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html> You could dump all files to ...
Use [rsync for Windows](http://www.brentnorris.net/rsyncntdoc.html) to backup data on your Windows machine
18,343
I was going to attempt Samba over SSH, any better ideas? Edit: My mom has been bugging me to do some offsite backing up of her files. She currently uses [Norton Ghost](http://en.wikipedia.org/wiki/Ghost_%28software%29). I have a VPS that I use for some other stuff and I figured that I could just setup a FTP server and...
2009/06/03
[ "https://serverfault.com/questions/18343", "https://serverfault.com", "https://serverfault.com/users/7705/" ]
Seems like a sensible idea to me. I've done this before. There is a slight snag in that your local windows machine is probably already running it's own file sharing server (so you can't bind to localhost:139 when forwarding) and I you can't specify which port to connect to for file sharing. Really simple solution is ...
You can also install [Windows Services for UNIX](http://technet.microsoft.com/en-us/interopmigration/bb380242.aspx) on your Windows machine and access your Linux box via NFS
18,343
I was going to attempt Samba over SSH, any better ideas? Edit: My mom has been bugging me to do some offsite backing up of her files. She currently uses [Norton Ghost](http://en.wikipedia.org/wiki/Ghost_%28software%29). I have a VPS that I use for some other stuff and I figured that I could just setup a FTP server and...
2009/06/03
[ "https://serverfault.com/questions/18343", "https://serverfault.com", "https://serverfault.com/users/7705/" ]
Your approach might work but WebDAV might fit the bill as well.
rsync does not actually mount a filesystem but nonetheless lets you list contents of directories and transfer files to and from a Linux machine. rsync for Windows can be found, for example, in rsync.zip archive [there](http://www.brentnorris.net/rsyncntdoc.html)
18,343
I was going to attempt Samba over SSH, any better ideas? Edit: My mom has been bugging me to do some offsite backing up of her files. She currently uses [Norton Ghost](http://en.wikipedia.org/wiki/Ghost_%28software%29). I have a VPS that I use for some other stuff and I figured that I could just setup a FTP server and...
2009/06/03
[ "https://serverfault.com/questions/18343", "https://serverfault.com", "https://serverfault.com/users/7705/" ]
I just tested WinSCP for you, it works with nothing but an open SSH port on the server--was very straight-forward. It doesn't allow a true mount from looks of things, it gives you one of those left/right copy things instead. I bet there is an SSHFS client for windows out there somewhere though if you really need that...
I use a VPN for this. The file server runs poptop. Windows machines connect to it via the built in VPN client. SAMBA to share the folder, and voila. Use WINS for naming for extra credit so the Windows machines don't need shortcuts to things like \192.168.0.x\sharename on the desktop.
53,119,147
So I create a Docker hub image as follows, worked fine ``` Created new empty repository in DockerHub Uploaded my DockerFile to my webserver ssh *qnapserver* docker build *DockerFileUrl* docker login *DockerHubUsername* *DockerHubPassword* docker images (to get imageId of built image) docker tag *imageId* *DockerHubNam...
2018/11/02
[ "https://Stackoverflow.com/questions/53119147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1480018/" ]
The issue seems to be that I wasnt logged onto DockerHub properly ``` docker login *DockerHubUsername* *DockerHubPassword* ``` did not return an error, but I tried doing ``` docker login ``` and entering *username* and *password* at the prompt and then the push worked ok.
Are you using Docker for Mac ? There is a bug with the `docker login` CLI command. Please see this github issue and add your experience if you can : <https://github.com/docker/for-mac/issues/2016>
13,229,111
What I have: ``` char cmd[50] = "some text here"; char v[] = {'a','s','d','c','b'}; ``` So I want to concatenate `cmd` by adding a letter from `v`. Obviously: ``` strcat(cmd, v[3]); ``` doesn't work because `strcat` doesn't accept the `v[n]` parameter `n = int`.
2012/11/05
[ "https://Stackoverflow.com/questions/13229111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1713797/" ]
Do ***not*** use this: ``` strcat(cmd,&v[3]); ``` `&v[3]` is not a pointer to a null terminated string! instead use ``` strncat(cmd, &v[3], 1); ```
the problem is that you don't use strcat as well: ``` char *strcat (char *dest, const char *src); ``` because you do ``` char *strcat (char *dest, char src); ``` So you must declared a char \* as your char.
13,229,111
What I have: ``` char cmd[50] = "some text here"; char v[] = {'a','s','d','c','b'}; ``` So I want to concatenate `cmd` by adding a letter from `v`. Obviously: ``` strcat(cmd, v[3]); ``` doesn't work because `strcat` doesn't accept the `v[n]` parameter `n = int`.
2012/11/05
[ "https://Stackoverflow.com/questions/13229111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1713797/" ]
Hmm. As far as I understand you want to add a single char from the second array? so you have to use ``` strncat (cmd, &v[3], 1); ``` :-)
the problem is that you don't use strcat as well: ``` char *strcat (char *dest, const char *src); ``` because you do ``` char *strcat (char *dest, char src); ``` So you must declared a char \* as your char.
13,229,111
What I have: ``` char cmd[50] = "some text here"; char v[] = {'a','s','d','c','b'}; ``` So I want to concatenate `cmd` by adding a letter from `v`. Obviously: ``` strcat(cmd, v[3]); ``` doesn't work because `strcat` doesn't accept the `v[n]` parameter `n = int`.
2012/11/05
[ "https://Stackoverflow.com/questions/13229111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1713797/" ]
Problems with your approach. * C strings must end in 0 byte, in other words `'\0'` character. Using `""` adds that automatically, but otherwise you have to add it yourself, and all string functions depend on that 0 being there. * Your v array contains characters, not strings, and `strcat` takes strings. One solution:...
the problem is that you don't use strcat as well: ``` char *strcat (char *dest, const char *src); ``` because you do ``` char *strcat (char *dest, char src); ``` So you must declared a char \* as your char.
13,229,111
What I have: ``` char cmd[50] = "some text here"; char v[] = {'a','s','d','c','b'}; ``` So I want to concatenate `cmd` by adding a letter from `v`. Obviously: ``` strcat(cmd, v[3]); ``` doesn't work because `strcat` doesn't accept the `v[n]` parameter `n = int`.
2012/11/05
[ "https://Stackoverflow.com/questions/13229111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1713797/" ]
Do ***not*** use this: ``` strcat(cmd,&v[3]); ``` `&v[3]` is not a pointer to a null terminated string! instead use ``` strncat(cmd, &v[3], 1); ```
how about ``` strcat(cmd,&v[3]); ```
13,229,111
What I have: ``` char cmd[50] = "some text here"; char v[] = {'a','s','d','c','b'}; ``` So I want to concatenate `cmd` by adding a letter from `v`. Obviously: ``` strcat(cmd, v[3]); ``` doesn't work because `strcat` doesn't accept the `v[n]` parameter `n = int`.
2012/11/05
[ "https://Stackoverflow.com/questions/13229111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1713797/" ]
Do ***not*** use this: ``` strcat(cmd,&v[3]); ``` `&v[3]` is not a pointer to a null terminated string! instead use ``` strncat(cmd, &v[3], 1); ```
First, make sure the variable 'cmd' has enough memory allocated. Second, the mention to 'v[3]' is the value which is a signed byte. You have to use the following call to strncat (not strcat): ``` strncat(cmd,&v[3],1); ```
13,229,111
What I have: ``` char cmd[50] = "some text here"; char v[] = {'a','s','d','c','b'}; ``` So I want to concatenate `cmd` by adding a letter from `v`. Obviously: ``` strcat(cmd, v[3]); ``` doesn't work because `strcat` doesn't accept the `v[n]` parameter `n = int`.
2012/11/05
[ "https://Stackoverflow.com/questions/13229111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1713797/" ]
First, make sure the variable 'cmd' has enough memory allocated. Second, the mention to 'v[3]' is the value which is a signed byte. You have to use the following call to strncat (not strcat): ``` strncat(cmd,&v[3],1); ```
``` char buf[2]; sprintf(buf,"%c", V[3]); strcat(cmd, buf); ``` or ``` strncat (cmd, &v[3],1); ``` you can not do it with ``` strcat(cmd,&v[3]); ``` this will coppy the V array from cell 3 to the end of array and not copy only V[3] I can suggest another solution ``` int len = strlen(cmd); cmd[len]=v[3]; cmd...
13,229,111
What I have: ``` char cmd[50] = "some text here"; char v[] = {'a','s','d','c','b'}; ``` So I want to concatenate `cmd` by adding a letter from `v`. Obviously: ``` strcat(cmd, v[3]); ``` doesn't work because `strcat` doesn't accept the `v[n]` parameter `n = int`.
2012/11/05
[ "https://Stackoverflow.com/questions/13229111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1713797/" ]
Hmm. As far as I understand you want to add a single char from the second array? so you have to use ``` strncat (cmd, &v[3], 1); ``` :-)
``` char buf[2]; sprintf(buf,"%c", V[3]); strcat(cmd, buf); ``` or ``` strncat (cmd, &v[3],1); ``` you can not do it with ``` strcat(cmd,&v[3]); ``` this will coppy the V array from cell 3 to the end of array and not copy only V[3] I can suggest another solution ``` int len = strlen(cmd); cmd[len]=v[3]; cmd...
13,229,111
What I have: ``` char cmd[50] = "some text here"; char v[] = {'a','s','d','c','b'}; ``` So I want to concatenate `cmd` by adding a letter from `v`. Obviously: ``` strcat(cmd, v[3]); ``` doesn't work because `strcat` doesn't accept the `v[n]` parameter `n = int`.
2012/11/05
[ "https://Stackoverflow.com/questions/13229111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1713797/" ]
Problems with your approach. * C strings must end in 0 byte, in other words `'\0'` character. Using `""` adds that automatically, but otherwise you have to add it yourself, and all string functions depend on that 0 being there. * Your v array contains characters, not strings, and `strcat` takes strings. One solution:...
``` char buf[2]; sprintf(buf,"%c", V[3]); strcat(cmd, buf); ``` or ``` strncat (cmd, &v[3],1); ``` you can not do it with ``` strcat(cmd,&v[3]); ``` this will coppy the V array from cell 3 to the end of array and not copy only V[3] I can suggest another solution ``` int len = strlen(cmd); cmd[len]=v[3]; cmd...
13,229,111
What I have: ``` char cmd[50] = "some text here"; char v[] = {'a','s','d','c','b'}; ``` So I want to concatenate `cmd` by adding a letter from `v`. Obviously: ``` strcat(cmd, v[3]); ``` doesn't work because `strcat` doesn't accept the `v[n]` parameter `n = int`.
2012/11/05
[ "https://Stackoverflow.com/questions/13229111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1713797/" ]
Hmm. As far as I understand you want to add a single char from the second array? so you have to use ``` strncat (cmd, &v[3], 1); ``` :-)
Do ***not*** use this: ``` strcat(cmd,&v[3]); ``` `&v[3]` is not a pointer to a null terminated string! instead use ``` strncat(cmd, &v[3], 1); ```
13,229,111
What I have: ``` char cmd[50] = "some text here"; char v[] = {'a','s','d','c','b'}; ``` So I want to concatenate `cmd` by adding a letter from `v`. Obviously: ``` strcat(cmd, v[3]); ``` doesn't work because `strcat` doesn't accept the `v[n]` parameter `n = int`.
2012/11/05
[ "https://Stackoverflow.com/questions/13229111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1713797/" ]
First, make sure the variable 'cmd' has enough memory allocated. Second, the mention to 'v[3]' is the value which is a signed byte. You have to use the following call to strncat (not strcat): ``` strncat(cmd,&v[3],1); ```
the problem is that you don't use strcat as well: ``` char *strcat (char *dest, const char *src); ``` because you do ``` char *strcat (char *dest, char src); ``` So you must declared a char \* as your char.
60,827,114
I'm trying to upgrade a Django application from using AWS ElasticSearch 2.3 to 7.4 (and upgrade the Django packages at the same time). I have it running locally, but when I attempt to run with AWS ElasticSearch7.4 I get the following Traceback ``` Traceback (most recent call last): File "/home/henry/Documents/Sites...
2020/03/24
[ "https://Stackoverflow.com/questions/60827114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2740177/" ]
The following sorted it if anyone else has an issue ``` from elasticsearch import Elasticsearch, RequestsHttpConnection from requests_aws4auth import AWS4Auth AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID',"some key") AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY',"another secret key") AWS_SE...
It doesn't look like django-elasticsearch-dsl supports AWS ES request signing which is required when you have IAM auth enabled: <https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-request-signing.html> You can check if that's the problem by making the AWS ES instance completely open (no auth).
415,659
I am trying to get a double tilde symbol over a letter but I can't find a well suiting solution. I tried ``` $\tilde{\tilde{z}}$ ``` and ``` $\overset{\approx}{z}$ ``` but both solution look a bit off. I am trying to find something with less vertical space between the two tildes but a similar size like `\tilde{}...
2018/02/16
[ "https://tex.stackexchange.com/questions/415659", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/155115/" ]
One of these? ``` \documentclass[12pt]{article} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{calc} \usepackage{accents} \newcommand{\dbtilde}[1]{\accentset{\approx}{#1}} \newcommand{\vardbtilde}[1]{\tilde{\raisebox{0pt}[0.85\height]{$\tilde{#1}$}}} \begin{document} \[ \vardbtilde{z}\quad \dbtild...
A variation on my answer here: [double tilde symbol under letter](https://tex.stackexchange.com/questions/229543/double-tilde-symbol-under-letter/229598#229598). Here, `\tsup` takes an optional argument specifying the number of symbols to overset (default 2). ``` \documentclass{article} \usepackage{stackengine} \stack...
415,659
I am trying to get a double tilde symbol over a letter but I can't find a well suiting solution. I tried ``` $\tilde{\tilde{z}}$ ``` and ``` $\overset{\approx}{z}$ ``` but both solution look a bit off. I am trying to find something with less vertical space between the two tildes but a similar size like `\tilde{}...
2018/02/16
[ "https://tex.stackexchange.com/questions/415659", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/155115/" ]
A variation on my answer here: [double tilde symbol under letter](https://tex.stackexchange.com/questions/229543/double-tilde-symbol-under-letter/229598#229598). Here, `\tsup` takes an optional argument specifying the number of symbols to overset (default 2). ``` \documentclass{article} \usepackage{stackengine} \stack...
The `tipa` package has `\doubletilde`. However, it is not made for math mode, so you have to cheat a bit: ``` \documentclass{article} \usepackage{amsmath} \usepackage[extra]{tipa} \begin{document} $\doubletilde{\kern-1pt$z$}$ \end{document} ``` [![enter image description here](https://i.stack.imgur.com/yt222.png)...
415,659
I am trying to get a double tilde symbol over a letter but I can't find a well suiting solution. I tried ``` $\tilde{\tilde{z}}$ ``` and ``` $\overset{\approx}{z}$ ``` but both solution look a bit off. I am trying to find something with less vertical space between the two tildes but a similar size like `\tilde{}...
2018/02/16
[ "https://tex.stackexchange.com/questions/415659", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/155115/" ]
One of these? ``` \documentclass[12pt]{article} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{calc} \usepackage{accents} \newcommand{\dbtilde}[1]{\accentset{\approx}{#1}} \newcommand{\vardbtilde}[1]{\tilde{\raisebox{0pt}[0.85\height]{$\tilde{#1}$}}} \begin{document} \[ \vardbtilde{z}\quad \dbtild...
The `tipa` package has `\doubletilde`. However, it is not made for math mode, so you have to cheat a bit: ``` \documentclass{article} \usepackage{amsmath} \usepackage[extra]{tipa} \begin{document} $\doubletilde{\kern-1pt$z$}$ \end{document} ``` [![enter image description here](https://i.stack.imgur.com/yt222.png)...
479,789
I have four samples ``` x1 = [1,1,2,5] x2 = [1,1,1,2] x3 = [1,5,5,5] x4 = [1,1,2,2] ``` I am looking for a way to test whether the four populations are siginificantly different from each other. The only possible symbols the sample are 1, 2, 5. The symbols are ordinal. Is there a hypothesis test that does this? I wa...
2020/07/30
[ "https://stats.stackexchange.com/questions/479789", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/209905/" ]
I find it helpful to think about logistic regression as a special case of Generalized Linear Models (GLM). In GLMs, we assume that the conditional distribution of the response belongs to the exponential family of distributions. (I say the "conditional" distribution here because the response follows this distribution on...
We are not simply using the hypothesis from linear regression. And we plug it into the sigmoid function to convert into a new hypothesis for a couple of reasons! Before we start we must know that the Logistic Regression Model is applied to Classification Problems. Classification can be of two types: (1) Binary- (1 or ...
46,680,944
I have set up cmake tool under the Global tool configuration in Jenkins. I tried to reference it in my jenkinsfile but the build is giving this error: ``` 'cmake is not a recognised command'. ``` This is how i am referencing it in the jenkinsfile : ``` stage('run CMake') { bat ''' mkdir build ...
2017/10/11
[ "https://Stackoverflow.com/questions/46680944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8188393/" ]
Use the `tool` step: ``` stage('run CMake') { def cmakePath = tool 'CMake' bat """ mkdir build cd build ${cmakePath}\\cmake -DBOOST_ROOT=... """ } ```
Do you have cmake installed on jenkins master? if not try to install it using installer. Check the jenkins cmake wiki page screenshot check below, install it using installer if you haven't already check this help: * [Tool Configuration](https://wiki.jenkins.io/display/JENKINS/Tool+Configuration) * [Global Configurati...
23,465,440
Is it legal for a record to have a nullable field such as: ``` type MyRec = { startDate : System.Nullable<DateTime>; } ``` This example does build in my project, but is this good practice if it is legal, and what problems if any does this introduce?
2014/05/05
[ "https://Stackoverflow.com/questions/23465440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1206480/" ]
It is legal, but F# encourage using option types instead: ``` type MyRec = { startDate : option<DateTime>; } ``` By using option you can easily pattern match against options and other operations to transform option values as for example map values (by using `Option.map`), and abstractions such as the Maybe monad (by...
F# does not allow types that are declared in F# to be null. However, if you're using types that are not defined in F#, you are still allowed to use null. This is why your code is still legal. This is needed for inter-operability, because you may need to pass null to a .NET library or accept it as a result. But I would...
45,366,303
How do you pass an alias type defined by `using` to the generic class? I tried the following code: ``` using ID = Int32; // it might be replaced with `String`. using CC = C<ID>; public class C<T> { T id; } ``` and there will be an error: > > Error CS0246 The type or namespace name 'ID' could not be found (ar...
2017/07/28
[ "https://Stackoverflow.com/questions/45366303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1941881/" ]
I do not really know what you are trying to achieve with this, but you can, however, do something similar with inheritance ``` public class CC : C<ID> { } ``` The class `CC` will derive from `C<T>` with a concrete type. Hence `CC.T` will be of type `Int32` (or whatever).
Don't use an alias. ``` public class C<T> { T id; } ``` ... ``` void Foo() { var x = new C<Int32>(); var y = new C<string>(); } ```
58,002,346
The first time I submits a from triggers a duplicate submission but subsequent ones only happen once. I have used the preventDefault() method but still gets submitted twice at first instance but subsequent ones only submit once. The Form ``` <?php $form = ActiveForm::begin(['id' => 'verify_form']); ?> <div class="r...
2019/09/19
[ "https://Stackoverflow.com/questions/58002346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6696218/" ]
This isn’t a React Native specific error. You initialized `schedules` to `null` so on first render, you try to call `.map` on `null`. That’s what is causing your error. You `fetch` your data correctly in `componentDidMount` but that lifecycle method will fire after the initial render. One common way to fix this is t...
First initialise `schedules: []` in the state with empty array, not with the null. Fetching data in `componentDidMount()` is correct. `ComponentDidMount()` will be called after the first render of component so you have to update the state in the component from the updated store. you can check whether props is changi...
56,852,162
I have an Ooth authentication server with PassportJS, a GraphQL API and a Gatsby client, I want to get my error messages in a bootstrap alert when my handleLogin function returns the catch, how can I do that? auth.js ``` export const handleLogin = async ({ email, password }) => { const user = await ooth.authentic...
2019/07/02
[ "https://Stackoverflow.com/questions/56852162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11089216/" ]
Sort of. The authentication request from SP to IdP is allowed to have "custom" extensions (the Extensions parent element), the content of the extensions is up to you. From the spec: > > [Optional] This extension point contains optional > protocol message extension elements that are agreed on between the > communic...
The only thing that an SP can send to the IdP is the `Subject` (see [lines 585-589](https://www.oasis-open.org/committees/download.php/56782/sstc-saml-profiles-errata-2.0-wd-07.pdf#page=18) of the spec).
25,884,873
I have a Linux Mint machine I am working on. I want Laravel to install on it. When I search for this I got this command: `curl -sS https://getcomposer.org/installer | php` from "<https://getcomposer.org/download/>" to put in terminal but it gives me this: ``` The program 'php' is currently not installed. You can inst...
2014/09/17
[ "https://Stackoverflow.com/questions/25884873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3962951/" ]
I think you are probably looking for some sort of shortcut, but don't think there is one: ``` var Promise = require('bluebird'); var Book = bookshelf.Model.extend({ tableName: 'books' }); var Page = bookshelf.Model.extend({ tableName: 'pages' }); var Pages = bookshelf.Collection.extend({ model: Page }); B...
Here is the link to the cleanest way, in the bookshelf docs: <http://bookshelfjs.org/#Collection-instance-create> It will be something sort of like this: ``` return Promise.map(pages, (page) => book.related('pages').create(page)); ```
8,144,796
I am studying the SCJP, and while studying I have found an exercise that seemed very simple at first, but I failed resolving it, and I do not understand the answer. The exercise (taken from *OCP Java SE 6 Programmer Practice Exams*, Bert Bates and Kathy Sierra), says the following: Given: ``` import java.util.*; publ...
2011/11/15
[ "https://Stackoverflow.com/questions/8144796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/359198/" ]
It's very sad that it doesn't give you an answer as to *why* it would fail to compile - but fortunately when you've got a compiler, you can find out for yourself: ``` Test.java:11: error: doStuff(List<String>) in MyPancake cannot implement doStuff (List<String>) in Pancake List<String> doStuff(List<String> z) { ...
When you implement Pancake interface. You are providing an implementation of the method doStuff() in your class MyPancake When you provide an implementation of the method doStuff() in your MyPancake class you should also define it as public, because all member variables and methods in an interface are by default pub...
8,144,796
I am studying the SCJP, and while studying I have found an exercise that seemed very simple at first, but I failed resolving it, and I do not understand the answer. The exercise (taken from *OCP Java SE 6 Programmer Practice Exams*, Bert Bates and Kathy Sierra), says the following: Given: ``` import java.util.*; publ...
2011/11/15
[ "https://Stackoverflow.com/questions/8144796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/359198/" ]
It's very sad that it doesn't give you an answer as to *why* it would fail to compile - but fortunately when you've got a compiler, you can find out for yourself: ``` Test.java:11: error: doStuff(List<String>) in MyPancake cannot implement doStuff (List<String>) in Pancake List<String> doStuff(List<String> z) { ...
When you define the method ``` List<String> doStuff(List<String> s); ``` In the Pancake interface, what you are really saying is: ``` public List<String> doStuff(List<String> s); ``` As all methods in an interface are always public, even if you don't explicity mark them as such. Now, the class MyPancake has the ...
72,886,254
I'm new to XSLT and I'm stuck on the "grouping adjacent elements" problem. My XML input follows the schema: ``` <body> <aside class="1"> some tags + text </aside> <aside class="2"> some tags + text </aside> <aside class="2"> some tags + text </aside> <p>...</p> <img .../> <aside class="2"> some tags + t...
2022/07/06
[ "https://Stackoverflow.com/questions/72886254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19495697/" ]
What you can do is remove the original `order-status` column, and then add a new custom `order-status` column in the same location: ```php function filter_manage_edit_shop_order_columns( $columns ) { // Loop trough existing columns foreach ( $columns as $key => $name ) { // NOT equal if ( $key ...
For your specific case you can override the whole class, if you look at the source code it starts with: ``` if ( class_exists( 'WC_Admin_List_Table_Orders', false ) ) { return; } //rest of the code ``` That means that when WC loads that .php file if the class already exists it exit and live with your implementat...
49,712,491
I have two variations of CSV files. One of them uses double quotes, the other one doesn't. ``` A: "shipment_id","status","to_name","to_address_1" etc B: shipment_id,status,to_name,to_address_1 etc ``` How can read the CSV and print out the value for `shipment_id` regardless of which type of CSV is submitted? My co...
2018/04/07
[ "https://Stackoverflow.com/questions/49712491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7483410/" ]
* Use `setTimeout` instead of `setInterval` * Loop over the array and depending on the index set a proper interval to wait for the execution of the callback (i.e `i * 10000` instead of `5 * 1000` for the delay, where `i` is the current index in the array) * use [Array#map](https://developer.mozilla.org/en-US/docs/Web/J...
The key is to use a normal `for` loop instead of you're `of` `for` loop so that you can get the index of the array: ``` const randomArray = []; for (var i = 0; i < rows.length; ++i) { let row = rows[i]; randomArray.push(row); } for (var j = 0; j < randomArray.length; j++) { var data = [randomArray...
2,462,953
Hey you lot (again), I was wondering if anyone knew a fast and easy way to see if a file (namely a textfile), exists inside the App folder? And how to handle an Error correctly if the file doesn't exist. Help would be grand! :) ty!
2010/03/17
[ "https://Stackoverflow.com/questions/2462953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/285178/" ]
I believe you want to do something similar to this: ``` NSBundle *myBundle = [NSBundle mainBundle]; NSString *pathToFile = [myBundle pathForResource:@"MyImage" ofType:@"jpg"]; if (pathToFile != nil) { NSLog(@"MyImage.jpg found in the App bundle."); } ``` See <https://developer.apple.com/documentation/foundation/...
You can check for file existence with something like: ``` NSFileManager *fileManager = [NSFileManager defaultManager]; if ([fileManager fileExistsAtPath:aPath]) { ... } ``` Depending on what you're looking for, "aPath" might be something like: ``` NSString *aPath = [[self applicationDocumentsDirectory] stringByAppe...
36,787,536
I have a box of text, displayed vertically. My client wants the text in that box to be displayed in full when viewing on a computer/laptop, and to have a Show More button when viewing on mobile. I think the best way to do this, is to show, lets say 10 lines of text on a desktop, and 5 on mobile, and hide the rest, but ...
2016/04/22
[ "https://Stackoverflow.com/questions/36787536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5185660/" ]
I think you can use the media queries of CSS like that: ``` @media screen and (max-width: 768px) { p { max-height:60px; overflow: hidden; color:red; } } ``` <https://jsfiddle.net/wrbwpzwu/> (resize the result part to show differences)
To work out how many lines to show, you need to work out your line-height multiplied by the number of rows you want to show. The example below is worked out to three rows. ```js document.querySelector('.view-more .btn').addEventListener('click', function() { this.parentNode.previousElementSibling.classList.add('mor...
36,787,536
I have a box of text, displayed vertically. My client wants the text in that box to be displayed in full when viewing on a computer/laptop, and to have a Show More button when viewing on mobile. I think the best way to do this, is to show, lets say 10 lines of text on a desktop, and 5 on mobile, and hide the rest, but ...
2016/04/22
[ "https://Stackoverflow.com/questions/36787536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5185660/" ]
Here is the way to achieve your result CSS ``` .open { max-height:60px; overflow: hidden; } .remove{ max-height:100%; } ``` JS ``` jQuery(function($){ $('.event').click(function(){ $('.open').toggleClass('remove') }) }) ``` [DEMO](https://jsfiddle.net/fido3993/ns9az7wn/2/)
To work out how many lines to show, you need to work out your line-height multiplied by the number of rows you want to show. The example below is worked out to three rows. ```js document.querySelector('.view-more .btn').addEventListener('click', function() { this.parentNode.previousElementSibling.classList.add('mor...
220,685
My client's Salesforce codebase/metadata is fairly large and we're hoping to switch to SFDX. Figuring out which components go into which artifact is going to be a challenge - I expect we'll have a "main" artifact with most of the components and then a couple of other artifacts for things that are clearly dependency fr...
2018/06/06
[ "https://salesforce.stackexchange.com/questions/220685", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/13686/" ]
Andrew Fawcett has provided us with [an open source demo](https://github.com/afawcett/dx-di-demo) you can clone and peruse. Generally speaking, all of the artifacts related to your application should exist in one repo. This allows you to have dependencies and help automate the deployment process. Of course, the gener...
On our ISV project we use **"NVIE" git branches** <https://nvie.com/posts/a-successful-git-branching-model/> So **one repo** , but **multiple branches** :) We also have one SFDX Project ( folder ) by "artifact" * **Source** : + Dev branch (and its sub-branches for developments) + Quali branch + Pre-prod branch ...
12,349,728
I have this char in an xml file: ``` <data> <products> <color>fumè</color> </product> </data> ``` I try to generate an instance of ElementTree with the following code: ``` string_data = open('file.xml') x = ElementTree.fromstring(unicode(string_data.encode('utf-8'))) ``` and I get the following error: ...
2012/09/10
[ "https://Stackoverflow.com/questions/12349728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42636/" ]
You do *not* need to decode XML for ElementTree to work. XML carries it's own encoding information (defaulting to UTF-8) and ElementTree does the work for you, outputting unicode: ``` >>> data = '''\ ... <data> ... <products> ... <color>fumè</color> ... </products> ... </data> ... ''' >>> x = ElementTree.fro...
Function `open()` does not return a `string`. Instead use `open('file.xml').read()`.
12,349,728
I have this char in an xml file: ``` <data> <products> <color>fumè</color> </product> </data> ``` I try to generate an instance of ElementTree with the following code: ``` string_data = open('file.xml') x = ElementTree.fromstring(unicode(string_data.encode('utf-8'))) ``` and I get the following error: ...
2012/09/10
[ "https://Stackoverflow.com/questions/12349728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42636/" ]
You do *not* need to decode XML for ElementTree to work. XML carries it's own encoding information (defaulting to UTF-8) and ElementTree does the work for you, outputting unicode: ``` >>> data = '''\ ... <data> ... <products> ... <color>fumè</color> ... </products> ... </data> ... ''' >>> x = ElementTree.fro...
The most likely your file is not UTF-8. `è` character can be from some other encoding, `latin-1` for example.
12,349,728
I have this char in an xml file: ``` <data> <products> <color>fumè</color> </product> </data> ``` I try to generate an instance of ElementTree with the following code: ``` string_data = open('file.xml') x = ElementTree.fromstring(unicode(string_data.encode('utf-8'))) ``` and I get the following error: ...
2012/09/10
[ "https://Stackoverflow.com/questions/12349728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42636/" ]
Might you have stumbled upon this problem while using [Requests (HTTP for Humans)](http://docs.python-requests.org/en/latest/index.html), `response.text` decodes the response by default, you can use `response.content` to get the undecoded data, so ElementTree can decode it itself. Just remember to use the correct encod...
Have you tried using the `parse` function, instead of opening the file... (which BTW would require a `.read()` after it for the `.fromstring()` to work...) ``` import xml.etree.ElementTree as ET tree = ET.parse('file.xml') root = tree.getroot() # etc... ```
12,349,728
I have this char in an xml file: ``` <data> <products> <color>fumè</color> </product> </data> ``` I try to generate an instance of ElementTree with the following code: ``` string_data = open('file.xml') x = ElementTree.fromstring(unicode(string_data.encode('utf-8'))) ``` and I get the following error: ...
2012/09/10
[ "https://Stackoverflow.com/questions/12349728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42636/" ]
You do *not* need to decode XML for ElementTree to work. XML carries it's own encoding information (defaulting to UTF-8) and ElementTree does the work for you, outputting unicode: ``` >>> data = '''\ ... <data> ... <products> ... <color>fumè</color> ... </products> ... </data> ... ''' >>> x = ElementTree.fro...
You need to **decode** utf-8 strings into a unicode object. So ``` string_data.encode('utf-8') ``` should be ``` string_data.decode('utf-8') ``` assuming `string_data` is actually an utf-8 string. So to summarize: To get an utf-8 string from a unicode object you **encode** the unicode (using the utf-8 encoding),...
12,349,728
I have this char in an xml file: ``` <data> <products> <color>fumè</color> </product> </data> ``` I try to generate an instance of ElementTree with the following code: ``` string_data = open('file.xml') x = ElementTree.fromstring(unicode(string_data.encode('utf-8'))) ``` and I get the following error: ...
2012/09/10
[ "https://Stackoverflow.com/questions/12349728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42636/" ]
Might you have stumbled upon this problem while using [Requests (HTTP for Humans)](http://docs.python-requests.org/en/latest/index.html), `response.text` decodes the response by default, you can use `response.content` to get the undecoded data, so ElementTree can decode it itself. Just remember to use the correct encod...
Function `open()` does not return a `string`. Instead use `open('file.xml').read()`.
12,349,728
I have this char in an xml file: ``` <data> <products> <color>fumè</color> </product> </data> ``` I try to generate an instance of ElementTree with the following code: ``` string_data = open('file.xml') x = ElementTree.fromstring(unicode(string_data.encode('utf-8'))) ``` and I get the following error: ...
2012/09/10
[ "https://Stackoverflow.com/questions/12349728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42636/" ]
You need to **decode** utf-8 strings into a unicode object. So ``` string_data.encode('utf-8') ``` should be ``` string_data.decode('utf-8') ``` assuming `string_data` is actually an utf-8 string. So to summarize: To get an utf-8 string from a unicode object you **encode** the unicode (using the utf-8 encoding),...
The most likely your file is not UTF-8. `è` character can be from some other encoding, `latin-1` for example.
12,349,728
I have this char in an xml file: ``` <data> <products> <color>fumè</color> </product> </data> ``` I try to generate an instance of ElementTree with the following code: ``` string_data = open('file.xml') x = ElementTree.fromstring(unicode(string_data.encode('utf-8'))) ``` and I get the following error: ...
2012/09/10
[ "https://Stackoverflow.com/questions/12349728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42636/" ]
You do *not* need to decode XML for ElementTree to work. XML carries it's own encoding information (defaulting to UTF-8) and ElementTree does the work for you, outputting unicode: ``` >>> data = '''\ ... <data> ... <products> ... <color>fumè</color> ... </products> ... </data> ... ''' >>> x = ElementTree.fro...
Have you tried using the `parse` function, instead of opening the file... (which BTW would require a `.read()` after it for the `.fromstring()` to work...) ``` import xml.etree.ElementTree as ET tree = ET.parse('file.xml') root = tree.getroot() # etc... ```
12,349,728
I have this char in an xml file: ``` <data> <products> <color>fumè</color> </product> </data> ``` I try to generate an instance of ElementTree with the following code: ``` string_data = open('file.xml') x = ElementTree.fromstring(unicode(string_data.encode('utf-8'))) ``` and I get the following error: ...
2012/09/10
[ "https://Stackoverflow.com/questions/12349728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42636/" ]
Have you tried using the `parse` function, instead of opening the file... (which BTW would require a `.read()` after it for the `.fromstring()` to work...) ``` import xml.etree.ElementTree as ET tree = ET.parse('file.xml') root = tree.getroot() # etc... ```
The most likely your file is not UTF-8. `è` character can be from some other encoding, `latin-1` for example.
12,349,728
I have this char in an xml file: ``` <data> <products> <color>fumè</color> </product> </data> ``` I try to generate an instance of ElementTree with the following code: ``` string_data = open('file.xml') x = ElementTree.fromstring(unicode(string_data.encode('utf-8'))) ``` and I get the following error: ...
2012/09/10
[ "https://Stackoverflow.com/questions/12349728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42636/" ]
Might you have stumbled upon this problem while using [Requests (HTTP for Humans)](http://docs.python-requests.org/en/latest/index.html), `response.text` decodes the response by default, you can use `response.content` to get the undecoded data, so ElementTree can decode it itself. Just remember to use the correct encod...
The most likely your file is not UTF-8. `è` character can be from some other encoding, `latin-1` for example.
12,349,728
I have this char in an xml file: ``` <data> <products> <color>fumè</color> </product> </data> ``` I try to generate an instance of ElementTree with the following code: ``` string_data = open('file.xml') x = ElementTree.fromstring(unicode(string_data.encode('utf-8'))) ``` and I get the following error: ...
2012/09/10
[ "https://Stackoverflow.com/questions/12349728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42636/" ]
You need to **decode** utf-8 strings into a unicode object. So ``` string_data.encode('utf-8') ``` should be ``` string_data.decode('utf-8') ``` assuming `string_data` is actually an utf-8 string. So to summarize: To get an utf-8 string from a unicode object you **encode** the unicode (using the utf-8 encoding),...
Function `open()` does not return a `string`. Instead use `open('file.xml').read()`.
38,817,344
Sonarqube official docker image, is not persisting any configuration changes like: `creating users, changing root password or even installing new plugins`. Once the container is restarted, all the configuration changes disappear and the installed plugins are lost. Even the projects' keys and their previous QA analyti...
2016/08/07
[ "https://Stackoverflow.com/questions/38817344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2546381/" ]
* Sonarqube image comes with a temporary h2 database engine which is not recommended for production and doesn't persist across container restarts. * We need to setup a database of our own and point it to Sonarqube at the time of starting the container. * Sonarqube docker images exposes two volumes `"$SONARQUBE_HOME/dat...
Hi @VanagaS and others landing here. I just wanted to provide an alternative to the above. Maybe some would even consider it an easier one. Notice this line [SONARQUBE\_HOME](https://github.com/SonarSource/docker-sonarqube/blob/442f950dae232fca8e1e919e017270971cee46f6/4.5.6/Dockerfile#L5) in the Dockerfile for the `d...
38,817,344
Sonarqube official docker image, is not persisting any configuration changes like: `creating users, changing root password or even installing new plugins`. Once the container is restarted, all the configuration changes disappear and the installed plugins are lost. Even the projects' keys and their previous QA analyti...
2016/08/07
[ "https://Stackoverflow.com/questions/38817344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2546381/" ]
* Sonarqube image comes with a temporary h2 database engine which is not recommended for production and doesn't persist across container restarts. * We need to setup a database of our own and point it to Sonarqube at the time of starting the container. * Sonarqube docker images exposes two volumes `"$SONARQUBE_HOME/dat...
Since Sonarqube v7.9 , Mysql is not supported. One needs to use postgresql. Install Postgresql and configure to run on host ip rather than localhost, private ip is preferred. Reference: <https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-18-04> ``` postgres=# create database ...
38,817,344
Sonarqube official docker image, is not persisting any configuration changes like: `creating users, changing root password or even installing new plugins`. Once the container is restarted, all the configuration changes disappear and the installed plugins are lost. Even the projects' keys and their previous QA analyti...
2016/08/07
[ "https://Stackoverflow.com/questions/38817344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2546381/" ]
Hi @VanagaS and others landing here. I just wanted to provide an alternative to the above. Maybe some would even consider it an easier one. Notice this line [SONARQUBE\_HOME](https://github.com/SonarSource/docker-sonarqube/blob/442f950dae232fca8e1e919e017270971cee46f6/4.5.6/Dockerfile#L5) in the Dockerfile for the `d...
Since Sonarqube v7.9 , Mysql is not supported. One needs to use postgresql. Install Postgresql and configure to run on host ip rather than localhost, private ip is preferred. Reference: <https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-18-04> ``` postgres=# create database ...
46,062,748
I am trying to plot something with a huge number of data points (2mm-3mm) using plotly. When I run ``` py.iplot(fig, filename='test plot') ``` I get the following error: ``` Woah there! Look at all those points! Due to browser limitations, the Plotly SVG drawing functions have a hard time graphing more than 500k...
2017/09/05
[ "https://Stackoverflow.com/questions/46062748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3604836/" ]
one option would be down-sampling your data, not sure if you'd like that: <https://github.com/devoxi/lttb-py> I also have problems with plotly in the browser with large datasets - if anyone has solutions, please write! Thank you!
You can try the [`render_mode`](https://plotly.com/python/webgl-vs-svg/) argument. Example: ``` import plotly.express as px import pandas as pd import numpy as np N = int(1e6) # Number of points df = pd.DataFrame(dict(x=np.random.randn(N), y=np.random.randn(N))) fig = px.scatter(df, x="x", y=...
46,062,748
I am trying to plot something with a huge number of data points (2mm-3mm) using plotly. When I run ``` py.iplot(fig, filename='test plot') ``` I get the following error: ``` Woah there! Look at all those points! Due to browser limitations, the Plotly SVG drawing functions have a hard time graphing more than 500k...
2017/09/05
[ "https://Stackoverflow.com/questions/46062748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3604836/" ]
Plotly really seems to be very bad in this. I am just trying to create a boxplot with 5 Million points, which is no problem in the simple R function "boxplot", but plotly is calculating endlessly for this. It should be a major issue to improve this. Not all data has to be saved (and shown) in the plotly object. This ...
You can try the [`render_mode`](https://plotly.com/python/webgl-vs-svg/) argument. Example: ``` import plotly.express as px import pandas as pd import numpy as np N = int(1e6) # Number of points df = pd.DataFrame(dict(x=np.random.randn(N), y=np.random.randn(N))) fig = px.scatter(df, x="x", y=...
25,920
I'm thinking of putting a large wall paper with an astronomical motive on a wall. I found quite a number of wall papers by various vendors, but most of them are obviously computer generated images, which is a no-go. It must be an image of an astronomical object, a nebula or a galaxy. (There's also a size requirement, n...
2018/04/15
[ "https://astronomy.stackexchange.com/questions/25920", "https://astronomy.stackexchange.com", "https://astronomy.stackexchange.com/users/6593/" ]
This appears to be one of Sergii Tsololo's more convincing efforts in the synthetic "space" image genre. It is listed on various stock photo sites as "[Blue and purple space galaxy](http://www.alamy.com/stock-photo-blue-purple-space-galaxy-55997572.html)," or with added 4-way spikes, "[Blue space starfield with flares]...
> > I'm thinking of putting a large wall paper with an astronomical motive on a wall. I found quite a number of wall papers by various vendors, but most of them are obviously computer generated images, which is a no-go. > > > Buyer beware. Huge printers are expensive, few places have them; you don't want wallpape...
51,058,621
I am building an app in which I am trying to build my own logging system for each request. For each request, I'd like to log the timestamp, the method used, the route, and finally the response code that has been sent to the client. I have the following code for the moment : ```js // index.js const express = require...
2018/06/27
[ "https://Stackoverflow.com/questions/51058621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8886385/" ]
Create middleware and Override send function ``` app.use(function (req, res) { var send = res.send; res.send = function (body) { // Do something send.call(this, body); }; }); ```
What I understand is you need to add some status codes in the response You can simply set status codes like this ``` let code = { serverError:500, forbidden:401 } res.status(code.serverError).json({ message:'Server error' }) ``` If you want to set in the middleware **middleware.js** ``` const statuscode...
51,058,621
I am building an app in which I am trying to build my own logging system for each request. For each request, I'd like to log the timestamp, the method used, the route, and finally the response code that has been sent to the client. I have the following code for the moment : ```js // index.js const express = require...
2018/06/27
[ "https://Stackoverflow.com/questions/51058621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8886385/" ]
Using the `finish` event from the response was indeed the good solution. The problem was in the `finish` event callback, I just couldn't use the arrow function because it wouldn't bind the `this` keyword, and this is were was stored the response data. So the following code is working : ```js // ./lib/logging.js con...
What I understand is you need to add some status codes in the response You can simply set status codes like this ``` let code = { serverError:500, forbidden:401 } res.status(code.serverError).json({ message:'Server error' }) ``` If you want to set in the middleware **middleware.js** ``` const statuscode...
51,058,621
I am building an app in which I am trying to build my own logging system for each request. For each request, I'd like to log the timestamp, the method used, the route, and finally the response code that has been sent to the client. I have the following code for the moment : ```js // index.js const express = require...
2018/06/27
[ "https://Stackoverflow.com/questions/51058621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8886385/" ]
The Express response [extends](https://github.com/expressjs/express/blob/508936853a6e311099c9985d4c11a4b1b8f6af07/lib/response.js#L42) the Node.js [`http.ServerResponse`](https://nodejs.org/api/http.html#http_class_http_serverresponse), so you can listen for the [`'finish'`](https://nodejs.org/api/http.html#http_event_...
What I understand is you need to add some status codes in the response You can simply set status codes like this ``` let code = { serverError:500, forbidden:401 } res.status(code.serverError).json({ message:'Server error' }) ``` If you want to set in the middleware **middleware.js** ``` const statuscode...
51,058,621
I am building an app in which I am trying to build my own logging system for each request. For each request, I'd like to log the timestamp, the method used, the route, and finally the response code that has been sent to the client. I have the following code for the moment : ```js // index.js const express = require...
2018/06/27
[ "https://Stackoverflow.com/questions/51058621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8886385/" ]
Using the `finish` event from the response was indeed the good solution. The problem was in the `finish` event callback, I just couldn't use the arrow function because it wouldn't bind the `this` keyword, and this is were was stored the response data. So the following code is working : ```js // ./lib/logging.js con...
Create middleware and Override send function ``` app.use(function (req, res) { var send = res.send; res.send = function (body) { // Do something send.call(this, body); }; }); ```
51,058,621
I am building an app in which I am trying to build my own logging system for each request. For each request, I'd like to log the timestamp, the method used, the route, and finally the response code that has been sent to the client. I have the following code for the moment : ```js // index.js const express = require...
2018/06/27
[ "https://Stackoverflow.com/questions/51058621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8886385/" ]
The Express response [extends](https://github.com/expressjs/express/blob/508936853a6e311099c9985d4c11a4b1b8f6af07/lib/response.js#L42) the Node.js [`http.ServerResponse`](https://nodejs.org/api/http.html#http_class_http_serverresponse), so you can listen for the [`'finish'`](https://nodejs.org/api/http.html#http_event_...
Create middleware and Override send function ``` app.use(function (req, res) { var send = res.send; res.send = function (body) { // Do something send.call(this, body); }; }); ```
51,058,621
I am building an app in which I am trying to build my own logging system for each request. For each request, I'd like to log the timestamp, the method used, the route, and finally the response code that has been sent to the client. I have the following code for the moment : ```js // index.js const express = require...
2018/06/27
[ "https://Stackoverflow.com/questions/51058621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8886385/" ]
Using the `finish` event from the response was indeed the good solution. The problem was in the `finish` event callback, I just couldn't use the arrow function because it wouldn't bind the `this` keyword, and this is were was stored the response data. So the following code is working : ```js // ./lib/logging.js con...
The Express response [extends](https://github.com/expressjs/express/blob/508936853a6e311099c9985d4c11a4b1b8f6af07/lib/response.js#L42) the Node.js [`http.ServerResponse`](https://nodejs.org/api/http.html#http_class_http_serverresponse), so you can listen for the [`'finish'`](https://nodejs.org/api/http.html#http_event_...
19,241,409
I have a bunch of elements on a page which are draggable and determined by: ``` $( ".folder" ).draggable({ revert: true }); ``` I need to make one element, which has class `.folder`, not able to be dragged (it's the top folder in a tree). I tried removing the class ui-draggable from it but that didn't work so I'm g...
2013/10/08
[ "https://Stackoverflow.com/questions/19241409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/973552/" ]
Try this, ``` $(".folder:not(:first)").draggable({ revert: true }); ``` Read **[:not](http://api.jquery.com/not-selector/)** and **[:first](http://api.jquery.com/first-selector/)** **selectors**
just use: ``` $( ".folder" ).draggable("disable"); //or enable ```
19,241,409
I have a bunch of elements on a page which are draggable and determined by: ``` $( ".folder" ).draggable({ revert: true }); ``` I need to make one element, which has class `.folder`, not able to be dragged (it's the top folder in a tree). I tried removing the class ui-draggable from it but that didn't work so I'm g...
2013/10/08
[ "https://Stackoverflow.com/questions/19241409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/973552/" ]
Try this, ``` $(".folder:not(:first)").draggable({ revert: true }); ``` Read **[:not](http://api.jquery.com/not-selector/)** and **[:first](http://api.jquery.com/first-selector/)** **selectors**
Try also this: ``` $(".folder:not(YourElement)").draggable(); ```
81,972
The question I want to ask is thus: Is casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available? Now, the example of why I think it can be used for good. I recently implemented ...
2008/09/17
[ "https://Stackoverflow.com/questions/81972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15537/" ]
My recommendation would be to introduce more abstractions. I find it confusing that a BItem has a DecodeFile() which returns a BDictionary. This may be a reasonable thing to do in the torrent domain, I don't know. However, I would find an api like the following more reasonable: ``` BFile torrent = BFile.DecodeFile("m...
* If you have complete control of your codebase and your thought-process, by all means do. * If not, you'll regret this the day some new person injects a BItem derivation that you didn't see coming into *your* BList or BDictionary. If you have to do this, atleast wrap it (control access to the list) in a class which h...
81,972
The question I want to ask is thus: Is casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available? Now, the example of why I think it can be used for good. I recently implemented ...
2008/09/17
[ "https://Stackoverflow.com/questions/81972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15537/" ]
I think I would make the this[int] and this[string] accessors virtual and override them in BList/BDictionary. Classes where the accessors does not make sense should cast a NotSupportedException() (perhaps by having a default implementation in BItem). That makes your code work in the same way and gives you a more reada...
If file length is something you retrieve often, why not implement a property in the BDictionary (?) class... so that you code becomes: ``` BDictionary torrent = BItem.DecodeFile("my.torrent"); int filelength = torrent.FileLength; ``` That way the implementation details are hidden from the user.
81,972
The question I want to ask is thus: Is casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available? Now, the example of why I think it can be used for good. I recently implemented ...
2008/09/17
[ "https://Stackoverflow.com/questions/81972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15537/" ]
The way I see it, not all BItems are collections, thus not all BItems have indexers, so the indexer shouldn't be in BItem. I would derive another abstract class from BItem, let's name it BCollection, and put the indexers there, something like: ``` abstract class BCollection : BItem { public BItem this[int index...
Hmm. I would actually argue that the first line of coded is more readable than the second - it takes a little longer to figure out what's going on it, but its more apparant that you're treating objects as BList or BDictionary. Applying the methods to the abstract class hides that detail, which can make it harder to fig...
81,972
The question I want to ask is thus: Is casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available? Now, the example of why I think it can be used for good. I recently implemented ...
2008/09/17
[ "https://Stackoverflow.com/questions/81972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15537/" ]
I think I would make the this[int] and this[string] accessors virtual and override them in BList/BDictionary. Classes where the accessors does not make sense should cast a NotSupportedException() (perhaps by having a default implementation in BItem). That makes your code work in the same way and gives you a more reada...
Hmm. I would actually argue that the first line of coded is more readable than the second - it takes a little longer to figure out what's going on it, but its more apparant that you're treating objects as BList or BDictionary. Applying the methods to the abstract class hides that detail, which can make it harder to fig...
81,972
The question I want to ask is thus: Is casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available? Now, the example of why I think it can be used for good. I recently implemented ...
2008/09/17
[ "https://Stackoverflow.com/questions/81972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15537/" ]
You really should not access any derived classes from the base class as it pretty much breaks the idea of OOP. Readibility certainly goes a long way, but I wouldn't trade it for reusability. Consider the case when you'll need to add another subclass - you'll also need to update the base class accordingly.
If file length is something you retrieve often, why not implement a property in the BDictionary (?) class... so that you code becomes: ``` BDictionary torrent = BItem.DecodeFile("my.torrent"); int filelength = torrent.FileLength; ``` That way the implementation details are hidden from the user.
81,972
The question I want to ask is thus: Is casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available? Now, the example of why I think it can be used for good. I recently implemented ...
2008/09/17
[ "https://Stackoverflow.com/questions/81972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15537/" ]
If file length is something you retrieve often, why not implement a property in the BDictionary (?) class... so that you code becomes: ``` BDictionary torrent = BItem.DecodeFile("my.torrent"); int filelength = torrent.FileLength; ``` That way the implementation details are hidden from the user.
* If you have complete control of your codebase and your thought-process, by all means do. * If not, you'll regret this the day some new person injects a BItem derivation that you didn't see coming into *your* BList or BDictionary. If you have to do this, atleast wrap it (control access to the list) in a class which h...
81,972
The question I want to ask is thus: Is casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available? Now, the example of why I think it can be used for good. I recently implemented ...
2008/09/17
[ "https://Stackoverflow.com/questions/81972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15537/" ]
The way I see it, not all BItems are collections, thus not all BItems have indexers, so the indexer shouldn't be in BItem. I would derive another abstract class from BItem, let's name it BCollection, and put the indexers there, something like: ``` abstract class BCollection : BItem { public BItem this[int index...
If you introduce generics, you can avoid casting. ``` class DecodedTorrent : BDictionary<BDictionary<BList<BDictionary<BInteger>>>> { } ``` --- ``` DecodedTorrent torrent = BItem.DecodeFile("mytorrent"); int x = torrent["info"]["files"][0]["length"]; ``` Hmm, but that probably won't work, as the types may depend ...
81,972
The question I want to ask is thus: Is casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available? Now, the example of why I think it can be used for good. I recently implemented ...
2008/09/17
[ "https://Stackoverflow.com/questions/81972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15537/" ]
If file length is something you retrieve often, why not implement a property in the BDictionary (?) class... so that you code becomes: ``` BDictionary torrent = BItem.DecodeFile("my.torrent"); int filelength = torrent.FileLength; ``` That way the implementation details are hidden from the user.
If you introduce generics, you can avoid casting. ``` class DecodedTorrent : BDictionary<BDictionary<BList<BDictionary<BInteger>>>> { } ``` --- ``` DecodedTorrent torrent = BItem.DecodeFile("mytorrent"); int x = torrent["info"]["files"][0]["length"]; ``` Hmm, but that probably won't work, as the types may depend ...
81,972
The question I want to ask is thus: Is casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available? Now, the example of why I think it can be used for good. I recently implemented ...
2008/09/17
[ "https://Stackoverflow.com/questions/81972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15537/" ]
You really should not access any derived classes from the base class as it pretty much breaks the idea of OOP. Readibility certainly goes a long way, but I wouldn't trade it for reusability. Consider the case when you'll need to add another subclass - you'll also need to update the base class accordingly.
* If you have complete control of your codebase and your thought-process, by all means do. * If not, you'll regret this the day some new person injects a BItem derivation that you didn't see coming into *your* BList or BDictionary. If you have to do this, atleast wrap it (control access to the list) in a class which h...
81,972
The question I want to ask is thus: Is casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available? Now, the example of why I think it can be used for good. I recently implemented ...
2008/09/17
[ "https://Stackoverflow.com/questions/81972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15537/" ]
My recommendation would be to introduce more abstractions. I find it confusing that a BItem has a DecodeFile() which returns a BDictionary. This may be a reasonable thing to do in the torrent domain, I don't know. However, I would find an api like the following more reasonable: ``` BFile torrent = BFile.DecodeFile("m...
Did you concider parsing a simple "path" so you could write it this way: `BDictionary torrent = BItem.DecodeFile("my.torrent"); int filelength = (int)torrent.Fetch("info.files.0.length");` Perhaps not the best way, but the readability increases(a little)
252,382
I want to implement a Chart of a Sharepoint tracker list. I decided to use **angular-chart.js**, to use this code I also needed **Charter.js**. So I downloaded both and decided to make a try as one of the examples in their [page](http://jtblin.github.io/angular-chart.js/). They have a bar chart with a code like this...
2018/11/09
[ "https://sharepoint.stackexchange.com/questions/252382", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/70877/" ]
This **mainly** depends on the current `selected view` and the current `toolbar type` **In case,** * The `selected view` is `Summary view`, * The `toolbar type` is `summary toolbar` or any other type else `No toolbar` You will get the old `add new`, [![enter image description here](https://i.stack.imgur.com/qADZ...
The new item image with the green plus sign is a SharePoint 2010 or 2007 version. You need to remove the web part and add that again on the page to get new item image with the blue plus sign.
57,012,555
I am struggling to create a new variable that captures the stock price (prc) at the begin of a fiscal year (fyear) for a given firm. In the data the fiscal year is defined with a start and end date, complemented with the monthly stock price. The stock price is based on the price of the last trading day of the month, ...
2019/07/12
[ "https://Stackoverflow.com/questions/57012555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11005244/" ]
> > Is there a way to return for a fiscal year the last monthly stock price at previous fiscal year? > > > ``` out = unique(dt[, .(id, fyear, fyear_start, fyear_end)]) out[, prc_end := { dt[.(id = .SD$id, prc_month_end = .SD$fyear_start - 1L), on=.(id, prc_month_end), roll=TRUE, x.prc] }] id fyear fyear_...
This works for your example but you'll want to double-check the logic--feels a little hackish to me. I will revisit later and think through it more. Hopefully this gets you started! ``` dt[, test := (shift(fyear_start, -1) - prc_month_end) > 0, by = id] out <- dt[test == T | is.na(test)][, prc := shift(prc, 1), by = ...
21,115,358
I have a previously installed ColdFusion 10 Multi-server installation that is up and running well. When I create a new instance, via the ColdFusion Administrator, with "Create Windows Service" checked, all seems to go well; the new instance shows up in the Administrator and the new directory structure is created on the...
2014/01/14
[ "https://Stackoverflow.com/questions/21115358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1172456/" ]
It could be a port conflict issue. You can check the Event Viewer logs. Try the following:- 1. Stop ColdFusion service 2. Launch Command prompt as Administrator 3. Browse to cf\_root\cfusion\bin and run the following command coldfusion.exe -start -console 4. Try to access the CF admin, once the services are started. ...
This worked for me. First, if you are in a windows environment use > > netstat -ano > > > to get a list of ports in use. Then, open c:\ColdFusion11{instancename}\bin\jvm.config and find the port address in your JVM arguments, if the port isn't unique, change it to one that is. Then fire up CF from the command l...
21,115,358
I have a previously installed ColdFusion 10 Multi-server installation that is up and running well. When I create a new instance, via the ColdFusion Administrator, with "Create Windows Service" checked, all seems to go well; the new instance shows up in the Administrator and the new directory structure is created on the...
2014/01/14
[ "https://Stackoverflow.com/questions/21115358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1172456/" ]
It could be a port conflict issue. You can check the Event Viewer logs. Try the following:- 1. Stop ColdFusion service 2. Launch Command prompt as Administrator 3. Browse to cf\_root\cfusion\bin and run the following command coldfusion.exe -start -console 4. Try to access the CF admin, once the services are started. ...
This happened to my local Dev install after a system update. I just tried changing the default port from 8500 to 8501 and it worked.
21,115,358
I have a previously installed ColdFusion 10 Multi-server installation that is up and running well. When I create a new instance, via the ColdFusion Administrator, with "Create Windows Service" checked, all seems to go well; the new instance shows up in the Administrator and the new directory structure is created on the...
2014/01/14
[ "https://Stackoverflow.com/questions/21115358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1172456/" ]
It could be a port conflict issue. You can check the Event Viewer logs. Try the following:- 1. Stop ColdFusion service 2. Launch Command prompt as Administrator 3. Browse to cf\_root\cfusion\bin and run the following command coldfusion.exe -start -console 4. Try to access the CF admin, once the services are started. ...
Maybe I can save someone else from the frustration I faced with some update I didn't explicitly authorize.... this was the cause and fix for my scenario... JRE version On PC was updated and out of sync with CF settings JRE version... [JRE on PC and CF Settings out of sync...](https://i.stack.imgur.com/5qMll.png) Sol...
21,115,358
I have a previously installed ColdFusion 10 Multi-server installation that is up and running well. When I create a new instance, via the ColdFusion Administrator, with "Create Windows Service" checked, all seems to go well; the new instance shows up in the Administrator and the new directory structure is created on the...
2014/01/14
[ "https://Stackoverflow.com/questions/21115358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1172456/" ]
This error was actually caused by conflicting port numbers in the debugger. Reference ColdFusion Administrator interface ==> Debugging and Logging ==> Debugger Settings. The Debugger Port must be set to a unique value for each server instance. If two or more instances are set to the same value, a port conflict results.
This worked for me. First, if you are in a windows environment use > > netstat -ano > > > to get a list of ports in use. Then, open c:\ColdFusion11{instancename}\bin\jvm.config and find the port address in your JVM arguments, if the port isn't unique, change it to one that is. Then fire up CF from the command l...
21,115,358
I have a previously installed ColdFusion 10 Multi-server installation that is up and running well. When I create a new instance, via the ColdFusion Administrator, with "Create Windows Service" checked, all seems to go well; the new instance shows up in the Administrator and the new directory structure is created on the...
2014/01/14
[ "https://Stackoverflow.com/questions/21115358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1172456/" ]
This worked for me. First, if you are in a windows environment use > > netstat -ano > > > to get a list of ports in use. Then, open c:\ColdFusion11{instancename}\bin\jvm.config and find the port address in your JVM arguments, if the port isn't unique, change it to one that is. Then fire up CF from the command l...
This happened to my local Dev install after a system update. I just tried changing the default port from 8500 to 8501 and it worked.
21,115,358
I have a previously installed ColdFusion 10 Multi-server installation that is up and running well. When I create a new instance, via the ColdFusion Administrator, with "Create Windows Service" checked, all seems to go well; the new instance shows up in the Administrator and the new directory structure is created on the...
2014/01/14
[ "https://Stackoverflow.com/questions/21115358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1172456/" ]
This worked for me. First, if you are in a windows environment use > > netstat -ano > > > to get a list of ports in use. Then, open c:\ColdFusion11{instancename}\bin\jvm.config and find the port address in your JVM arguments, if the port isn't unique, change it to one that is. Then fire up CF from the command l...
Maybe I can save someone else from the frustration I faced with some update I didn't explicitly authorize.... this was the cause and fix for my scenario... JRE version On PC was updated and out of sync with CF settings JRE version... [JRE on PC and CF Settings out of sync...](https://i.stack.imgur.com/5qMll.png) Sol...
21,115,358
I have a previously installed ColdFusion 10 Multi-server installation that is up and running well. When I create a new instance, via the ColdFusion Administrator, with "Create Windows Service" checked, all seems to go well; the new instance shows up in the Administrator and the new directory structure is created on the...
2014/01/14
[ "https://Stackoverflow.com/questions/21115358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1172456/" ]
This error was actually caused by conflicting port numbers in the debugger. Reference ColdFusion Administrator interface ==> Debugging and Logging ==> Debugger Settings. The Debugger Port must be set to a unique value for each server instance. If two or more instances are set to the same value, a port conflict results.
This happened to my local Dev install after a system update. I just tried changing the default port from 8500 to 8501 and it worked.
21,115,358
I have a previously installed ColdFusion 10 Multi-server installation that is up and running well. When I create a new instance, via the ColdFusion Administrator, with "Create Windows Service" checked, all seems to go well; the new instance shows up in the Administrator and the new directory structure is created on the...
2014/01/14
[ "https://Stackoverflow.com/questions/21115358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1172456/" ]
This error was actually caused by conflicting port numbers in the debugger. Reference ColdFusion Administrator interface ==> Debugging and Logging ==> Debugger Settings. The Debugger Port must be set to a unique value for each server instance. If two or more instances are set to the same value, a port conflict results.
Maybe I can save someone else from the frustration I faced with some update I didn't explicitly authorize.... this was the cause and fix for my scenario... JRE version On PC was updated and out of sync with CF settings JRE version... [JRE on PC and CF Settings out of sync...](https://i.stack.imgur.com/5qMll.png) Sol...
8,327,054
In my application,I use many setTimeout function,so I am afraid if it will cause peformance problem: ``` setTimeout(function(){ // do something },0); ``` And I found people use this manner: ``` var t=setTimeout(function(){ // do something clearTimeout(t); }); ``` I wonder if it is necessary?
2011/11/30
[ "https://Stackoverflow.com/questions/8327054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/306719/" ]
It'll be perfectly safe with a smart constructor and stored dimensions. Of course there are no natural implementations for the operations `signum` and `fromIntegral` (or maybe a diagonal matrix would be fine for the latter). ```hs module Matrix (Matrix(),matrix,matrixTranspose) where import Data.List (transpose) dat...
You can implement \* as matrix multiplication by defining an instance of Num class for Matrix. But the code won't be type-safe: \* (and other arithmetic operations) on matrices as you define them is not total, because of size mismatch or in case of '/' non-existence of inverse matrices. As for 'the hierarchy is not de...