qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
31,305,945
I recently began using two-factor authentication on GitHub, and I am now unable to use git over https on private repos in the usual way: ``` peter@computer:~$ git clone https://github.com/[...]/MyPrivateRepo Cloning into 'MyPrivateRepo'... Username for 'https://github.com': [...] Password for 'https://[...]@github.com...
2015/07/09
[ "https://Stackoverflow.com/questions/31305945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2729534/" ]
To everyone struggling, what worked for me was creating personal access token and then using it as a **username AND password** (in the prompt that opened).
<https://dev.to/fpeluso/how-to-clone-a-gitlab-repository-after-enabling-2fa-6oc> ``` git clone https://oauth2:{PERSONAL ACCESS TOKEN}@github.com/[...]/MyPrivateRepo ```
31,305,945
I recently began using two-factor authentication on GitHub, and I am now unable to use git over https on private repos in the usual way: ``` peter@computer:~$ git clone https://github.com/[...]/MyPrivateRepo Cloning into 'MyPrivateRepo'... Username for 'https://github.com': [...] Password for 'https://[...]@github.com...
2015/07/09
[ "https://Stackoverflow.com/questions/31305945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2729534/" ]
Find out how to fix this here: <https://github.com/blog/1614-two-factor-authentication#how-does-it-work-for-command-line-git> > > How does it work for command-line Git? > -------------------------------------- > > > If you are using SSH for Git authentication, rest easy: you don't need to do anything. If you are u...
<https://dev.to/fpeluso/how-to-clone-a-gitlab-repository-after-enabling-2fa-6oc> ``` git clone https://oauth2:{PERSONAL ACCESS TOKEN}@github.com/[...]/MyPrivateRepo ```
31,305,945
I recently began using two-factor authentication on GitHub, and I am now unable to use git over https on private repos in the usual way: ``` peter@computer:~$ git clone https://github.com/[...]/MyPrivateRepo Cloning into 'MyPrivateRepo'... Username for 'https://github.com': [...] Password for 'https://[...]@github.com...
2015/07/09
[ "https://Stackoverflow.com/questions/31305945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2729534/" ]
To everyone struggling, what worked for me was creating personal access token and then using it as a **username AND password** (in the prompt that opened).
It generally comes to mind that you have set up two-factor authentication, after a few password trials and maybe a password reset. So, how can we git clone a private repository using two-factor authentication? It is simple, using access tokens. **How to Authenticate Git using Access Tokens** 1. Go to <https://github....
31,305,945
I recently began using two-factor authentication on GitHub, and I am now unable to use git over https on private repos in the usual way: ``` peter@computer:~$ git clone https://github.com/[...]/MyPrivateRepo Cloning into 'MyPrivateRepo'... Username for 'https://github.com': [...] Password for 'https://[...]@github.com...
2015/07/09
[ "https://Stackoverflow.com/questions/31305945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2729534/" ]
Find out how to fix this here: <https://github.com/blog/1614-two-factor-authentication#how-does-it-work-for-command-line-git> > > How does it work for command-line Git? > -------------------------------------- > > > If you are using SSH for Git authentication, rest easy: you don't need to do anything. If you are u...
1st: Get personal access token. <https://github.com/settings/tokens> 2nd: Put account & the token. Example is here: ```sh $ git push Username for 'https://github.com': # Put your GitHub account name Password for 'https://{USERNAME}@github.com': # Put your Personal access token ``` Link on how to create...
42,610,172
I "inherited" from a collegue a MySQL database with dozen of fields. Since I've worked very few times with databases, I'm looking for little advice here. There's a `binary(16)` field named "IP": I suppose it is used to store user IPs. A typical stored value is, for example, `00000000000000000000ffff3d024463`. Using P...
2017/03/05
[ "https://Stackoverflow.com/questions/42610172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
as pointed by ForceBru first sort your list then use groupby: ``` from itertools import groupby countall = [[5, 0], [4, 1], [4, 1], [3, 2], [4, 1], [3, 2], [3, 2], [2, 3], [4, 1], [3, 2], [3, 2], [2, 3], [3, 2], [2, 3], [2, 3], [1, 4], [4, 1], [3, 2], [3, 2], [2, 3], [3, 2], [2, 3], [2, 3], [1, 4], [3, 2], [2, 3], [2,...
Groupby seems to deal with sequences that come after each other. To use it you would need to sort the list first. Another option is to use the [Counter](https://docs.python.org/2/library/collections.html#collections.Counter) class: ``` from collections import Counter countall = [[5, 0], [4, 1], [4, 1], [3, 2], [4, 1],...
42,610,172
I "inherited" from a collegue a MySQL database with dozen of fields. Since I've worked very few times with databases, I'm looking for little advice here. There's a `binary(16)` field named "IP": I suppose it is used to store user IPs. A typical stored value is, for example, `00000000000000000000ffff3d024463`. Using P...
2017/03/05
[ "https://Stackoverflow.com/questions/42610172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
as pointed by ForceBru first sort your list then use groupby: ``` from itertools import groupby countall = [[5, 0], [4, 1], [4, 1], [3, 2], [4, 1], [3, 2], [3, 2], [2, 3], [4, 1], [3, 2], [3, 2], [2, 3], [3, 2], [2, 3], [2, 3], [1, 4], [4, 1], [3, 2], [3, 2], [2, 3], [3, 2], [2, 3], [2, 3], [1, 4], [3, 2], [2, 3], [2,...
As noted in comments you will need to sort if you are using groupby. **Code:** ``` import itertools as it freq = {tuple(key): len(list(group)) for key, group in it.groupby(sorted(countall))} ``` **Test Code:** ``` countall = [[5, 0], [4, 1], [4, 1], [3, 2], [4, 1], [3, 2], [3, 2], [2, 3], [4, 1], [3, 2]...
42,610,172
I "inherited" from a collegue a MySQL database with dozen of fields. Since I've worked very few times with databases, I'm looking for little advice here. There's a `binary(16)` field named "IP": I suppose it is used to store user IPs. A typical stored value is, for example, `00000000000000000000ffff3d024463`. Using P...
2017/03/05
[ "https://Stackoverflow.com/questions/42610172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Groupby seems to deal with sequences that come after each other. To use it you would need to sort the list first. Another option is to use the [Counter](https://docs.python.org/2/library/collections.html#collections.Counter) class: ``` from collections import Counter countall = [[5, 0], [4, 1], [4, 1], [3, 2], [4, 1],...
As noted in comments you will need to sort if you are using groupby. **Code:** ``` import itertools as it freq = {tuple(key): len(list(group)) for key, group in it.groupby(sorted(countall))} ``` **Test Code:** ``` countall = [[5, 0], [4, 1], [4, 1], [3, 2], [4, 1], [3, 2], [3, 2], [2, 3], [4, 1], [3, 2]...
210,064
I would like to hide this particular taxonomy box in the admin on the add new post page. [![enter image description here](https://i.stack.imgur.com/YUsbG.jpg)](https://i.stack.imgur.com/YUsbG.jpg)
2015/11/27
[ "https://wordpress.stackexchange.com/questions/210064", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17862/" ]
The following worked for me in functions.php ``` /** * [remove_meta_boxes remove the resource type standard meta box from the side sortables in the resource post edit screen * @return [type] [description] */ function remove_meta_boxes(){ remove_meta_box( 'resourcetypesdiv', 'resource','side' ); } add_action( 'admi...
Hi I assume its your meta box while adding new post: Please go to `http://www.example.com/wp-admin/post-new.php` and there are screen options at top of new post form like screenshot where you can hide things according to available options. [![enter image description here](https://i.stack.imgur.com/IjfSF.png)](https:...
78,913
I'm experiencing the following error in our Production instance: Error: Invalid Data. Review all error messages below to correct your data. Apex trigger AcctMlstnUpdt caused an unexpected exception, contact your administrator: AcctMlstnUpdt: execution of AfterUpdate caused by: System.EmailException: SendEmail failed....
2015/06/05
[ "https://salesforce.stackexchange.com/questions/78913", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/18323/" ]
The reason could be the hardcoded id's you are using for email templates. As the id change from environment to environment, it is always recommended not to hardcode any id in code. You should retrieve id of email templates (fire soql query on emailtemplate) to retrieve production environment id for the email templates ...
Updated Trigger (solved issue): trigger AcctMlstnUpdt on Account (after insert, after update) { ``` for (Account acct : Trigger.New) { String[] toAddresses = new String[] {acct.Lead_Email__c}; Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setTargetObjectId(acct.OwnerI...
66,944,750
I have a react app and a nodejs server. I set a httpOnly-cookie containing a JWT for authentication. This works. The problem is: I need some logic client-side to check if the user is logged in. When the user logs in, I could store this "state" in-memory (eg. useState), but when the browser reloads, this state is gone (...
2021/04/04
[ "https://Stackoverflow.com/questions/66944750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12496104/" ]
There can be multiple approaches for this scenario. What I think you can do. 1 - You can send a http request to check if the JWT is valid on initial app load and whenever app is reloaded (Same thing basically) and then preserve some authentication state inside the app (Context Api or Redux) and this way you control th...
Just to add to the selected answer. a loading component and an isLoading state will help prevent the split-second showing of authenticated / protected screens. ex, `isLoading ? <LoadingComponent /> : <ProtectedComponent />` You can just update the isLoading state when the request finishes, and should the request yiel...
32,032
Studying the book *Understanding Morphology* by Martin Haspelmath, I arrived at this fragment: > > The importance of the latter part of the definition is seen in paradigms like insula. Although there are only seven different sequences of sounds in (2.3), we can still say that the paradigm of insula has ten word-forms...
2019/07/29
[ "https://linguistics.stackexchange.com/questions/32032", "https://linguistics.stackexchange.com", "https://linguistics.stackexchange.com/users/25096/" ]
Not having read the book, I find the terminology misleading in the same way you did. **Nominative plural**, **genitive singular** are commonly called *grammatical features*. For a constituent to have a specific grammatical function, it must have the proper grammatical features, e.g. for *insulae* to be the subject of t...
The terminology is just a bit unclear here. The real distinction is between different levels of the grammar. On the phonological level and lower, the word *insula* has seven different forms (*insula*, *-ae*, *-ā*, *-am*, *-ās*, *-īs*, *-ārum*, in no particular order). These are the "underlying forms" that phonologists...
32,032
Studying the book *Understanding Morphology* by Martin Haspelmath, I arrived at this fragment: > > The importance of the latter part of the definition is seen in paradigms like insula. Although there are only seven different sequences of sounds in (2.3), we can still say that the paradigm of insula has ten word-forms...
2019/07/29
[ "https://linguistics.stackexchange.com/questions/32032", "https://linguistics.stackexchange.com", "https://linguistics.stackexchange.com/users/25096/" ]
The terminology is just a bit unclear here. The real distinction is between different levels of the grammar. On the phonological level and lower, the word *insula* has seven different forms (*insula*, *-ae*, *-ā*, *-am*, *-ās*, *-īs*, *-ārum*, in no particular order). These are the "underlying forms" that phonologists...
I read and used this book when I was a grad student. I’m not sure how you could have missed their definition of “grammatical function” or “grammatical meaning” they give on the same page. The authors of the book - Martin Haspelmath and Andrea Sims - use these terms **synonymously**. I don’t find their terminology mis...
32,032
Studying the book *Understanding Morphology* by Martin Haspelmath, I arrived at this fragment: > > The importance of the latter part of the definition is seen in paradigms like insula. Although there are only seven different sequences of sounds in (2.3), we can still say that the paradigm of insula has ten word-forms...
2019/07/29
[ "https://linguistics.stackexchange.com/questions/32032", "https://linguistics.stackexchange.com", "https://linguistics.stackexchange.com/users/25096/" ]
Not having read the book, I find the terminology misleading in the same way you did. **Nominative plural**, **genitive singular** are commonly called *grammatical features*. For a constituent to have a specific grammatical function, it must have the proper grammatical features, e.g. for *insulae* to be the subject of t...
I read and used this book when I was a grad student. I’m not sure how you could have missed their definition of “grammatical function” or “grammatical meaning” they give on the same page. The authors of the book - Martin Haspelmath and Andrea Sims - use these terms **synonymously**. I don’t find their terminology mis...
167,744
I had an idea to make a plugin for one of my email clients where my users will be able to upload & scan attachments using *VirusTotal* service, but then again I was worried about their privacy and security of uploading personal files which may have been exposed to someone. My question here is; how safe is it to uploa...
2017/08/18
[ "https://security.stackexchange.com/questions/167744", "https://security.stackexchange.com", "https://security.stackexchange.com/users/46520/" ]
Paid subscribes to virustotal can download files uploaded by others. If you consider this still safe for your users depends on what you consider safe. See also their [Privacy Policy](https://www.virustotal.com/en/about/privacy/) which clearly says: > > Information we share > > When you submit a file to VirusTot...
I wouldn't recommend uploading files containing any sensitive information. Passwords, personal notes or other forms of data that can identify you as a person or expose your privacy. As Steffen mentioned in his answer, the files can be downloaded by premium users, meaning that the files and its contents will be availabl...
167,744
I had an idea to make a plugin for one of my email clients where my users will be able to upload & scan attachments using *VirusTotal* service, but then again I was worried about their privacy and security of uploading personal files which may have been exposed to someone. My question here is; how safe is it to uploa...
2017/08/18
[ "https://security.stackexchange.com/questions/167744", "https://security.stackexchange.com", "https://security.stackexchange.com/users/46520/" ]
Paid subscribes to virustotal can download files uploaded by others. If you consider this still safe for your users depends on what you consider safe. See also their [Privacy Policy](https://www.virustotal.com/en/about/privacy/) which clearly says: > > Information we share > > When you submit a file to VirusTot...
Yes, the files do get exposed to people outside of VT administrators. Virustotal Premium allows downloading files and "hunting" - which involves writing YARA rules to match the files from everything that has been uploaded to VT (e.g. I can search for files that have a string "private", get alerted every time such fil...
167,744
I had an idea to make a plugin for one of my email clients where my users will be able to upload & scan attachments using *VirusTotal* service, but then again I was worried about their privacy and security of uploading personal files which may have been exposed to someone. My question here is; how safe is it to uploa...
2017/08/18
[ "https://security.stackexchange.com/questions/167744", "https://security.stackexchange.com", "https://security.stackexchange.com/users/46520/" ]
Paid subscribes to virustotal can download files uploaded by others. If you consider this still safe for your users depends on what you consider safe. See also their [Privacy Policy](https://www.virustotal.com/en/about/privacy/) which clearly says: > > Information we share > > When you submit a file to VirusTot...
First, read this article thoroughly: [Security Firm Accused of Exposing Terabytes of Customer Data](https://blog.barkly.com/carbon-black-accused-of-customer-data-leak), it tells you why you should not make the same mistake. The rule of thumb of using VirusTotal to protect own file privacy is to send a sha256 hash to t...
167,744
I had an idea to make a plugin for one of my email clients where my users will be able to upload & scan attachments using *VirusTotal* service, but then again I was worried about their privacy and security of uploading personal files which may have been exposed to someone. My question here is; how safe is it to uploa...
2017/08/18
[ "https://security.stackexchange.com/questions/167744", "https://security.stackexchange.com", "https://security.stackexchange.com/users/46520/" ]
Paid subscribes to virustotal can download files uploaded by others. If you consider this still safe for your users depends on what you consider safe. See also their [Privacy Policy](https://www.virustotal.com/en/about/privacy/) which clearly says: > > Information we share > > When you submit a file to VirusTot...
> > "how safe is it to upload personal files, could they got exposed to someone beside owner of VT?". > > > Everyone on the route can see it. If it's not encrypted they can read it. If it is encrypted they might be able to decrypt it. If VT has a rogue employee or they get hacked then your Data can be exposed. Ne...
167,744
I had an idea to make a plugin for one of my email clients where my users will be able to upload & scan attachments using *VirusTotal* service, but then again I was worried about their privacy and security of uploading personal files which may have been exposed to someone. My question here is; how safe is it to uploa...
2017/08/18
[ "https://security.stackexchange.com/questions/167744", "https://security.stackexchange.com", "https://security.stackexchange.com/users/46520/" ]
I wouldn't recommend uploading files containing any sensitive information. Passwords, personal notes or other forms of data that can identify you as a person or expose your privacy. As Steffen mentioned in his answer, the files can be downloaded by premium users, meaning that the files and its contents will be availabl...
First, read this article thoroughly: [Security Firm Accused of Exposing Terabytes of Customer Data](https://blog.barkly.com/carbon-black-accused-of-customer-data-leak), it tells you why you should not make the same mistake. The rule of thumb of using VirusTotal to protect own file privacy is to send a sha256 hash to t...
167,744
I had an idea to make a plugin for one of my email clients where my users will be able to upload & scan attachments using *VirusTotal* service, but then again I was worried about their privacy and security of uploading personal files which may have been exposed to someone. My question here is; how safe is it to uploa...
2017/08/18
[ "https://security.stackexchange.com/questions/167744", "https://security.stackexchange.com", "https://security.stackexchange.com/users/46520/" ]
I wouldn't recommend uploading files containing any sensitive information. Passwords, personal notes or other forms of data that can identify you as a person or expose your privacy. As Steffen mentioned in his answer, the files can be downloaded by premium users, meaning that the files and its contents will be availabl...
> > "how safe is it to upload personal files, could they got exposed to someone beside owner of VT?". > > > Everyone on the route can see it. If it's not encrypted they can read it. If it is encrypted they might be able to decrypt it. If VT has a rogue employee or they get hacked then your Data can be exposed. Ne...
167,744
I had an idea to make a plugin for one of my email clients where my users will be able to upload & scan attachments using *VirusTotal* service, but then again I was worried about their privacy and security of uploading personal files which may have been exposed to someone. My question here is; how safe is it to uploa...
2017/08/18
[ "https://security.stackexchange.com/questions/167744", "https://security.stackexchange.com", "https://security.stackexchange.com/users/46520/" ]
Yes, the files do get exposed to people outside of VT administrators. Virustotal Premium allows downloading files and "hunting" - which involves writing YARA rules to match the files from everything that has been uploaded to VT (e.g. I can search for files that have a string "private", get alerted every time such fil...
First, read this article thoroughly: [Security Firm Accused of Exposing Terabytes of Customer Data](https://blog.barkly.com/carbon-black-accused-of-customer-data-leak), it tells you why you should not make the same mistake. The rule of thumb of using VirusTotal to protect own file privacy is to send a sha256 hash to t...
167,744
I had an idea to make a plugin for one of my email clients where my users will be able to upload & scan attachments using *VirusTotal* service, but then again I was worried about their privacy and security of uploading personal files which may have been exposed to someone. My question here is; how safe is it to uploa...
2017/08/18
[ "https://security.stackexchange.com/questions/167744", "https://security.stackexchange.com", "https://security.stackexchange.com/users/46520/" ]
Yes, the files do get exposed to people outside of VT administrators. Virustotal Premium allows downloading files and "hunting" - which involves writing YARA rules to match the files from everything that has been uploaded to VT (e.g. I can search for files that have a string "private", get alerted every time such fil...
> > "how safe is it to upload personal files, could they got exposed to someone beside owner of VT?". > > > Everyone on the route can see it. If it's not encrypted they can read it. If it is encrypted they might be able to decrypt it. If VT has a rogue employee or they get hacked then your Data can be exposed. Ne...
167,744
I had an idea to make a plugin for one of my email clients where my users will be able to upload & scan attachments using *VirusTotal* service, but then again I was worried about their privacy and security of uploading personal files which may have been exposed to someone. My question here is; how safe is it to uploa...
2017/08/18
[ "https://security.stackexchange.com/questions/167744", "https://security.stackexchange.com", "https://security.stackexchange.com/users/46520/" ]
First, read this article thoroughly: [Security Firm Accused of Exposing Terabytes of Customer Data](https://blog.barkly.com/carbon-black-accused-of-customer-data-leak), it tells you why you should not make the same mistake. The rule of thumb of using VirusTotal to protect own file privacy is to send a sha256 hash to t...
> > "how safe is it to upload personal files, could they got exposed to someone beside owner of VT?". > > > Everyone on the route can see it. If it's not encrypted they can read it. If it is encrypted they might be able to decrypt it. If VT has a rogue employee or they get hacked then your Data can be exposed. Ne...
55,503
Asslam o alaikum to all of my brothers and sisters... Well i have heard many times that imagining people nude is zina of heart watching porn is zina of eyes and hearing sex voices is zina of ear(sorry for this language) but it was written that punishment of zina is 80 lashes. So i mean 80 lashes of punishment is only f...
2019/05/31
[ "https://islam.stackexchange.com/questions/55503", "https://islam.stackexchange.com", "https://islam.stackexchange.com/users/33911/" ]
No, there are some sins/crimes in Islam (mostly related to human rights) has worldly punishments but many other sins even bigger has no worldly punishments but you'll start getting punishment immediately after death. So, zina of eyes and zina of ears means it takes you to which is real zina (sexual intercourse). As pr...
“The fornicatress and the fornicator, flog each of them with a hundred stripes. Let not pity withhold you in their case, in a punishment prescribed by Allaah, if you believe in Allaah and the Last Day. And let a party of the believers witness their punishment” [al-Noor 24:2] It was narrated from Jaabir that a man fro...
1,066,697
When I login into my Mac OSX a bash shell is configured to automatially open and run a script. This script requires super user privs and asks for my password again. Is there a way to eliminate this. I would prefer to enter my password only once.
2016/04/18
[ "https://superuser.com/questions/1066697", "https://superuser.com", "https://superuser.com/users/584192/" ]
Just modify the sudoers file to allow the script to run without a password: ``` sudo visudo ``` Then add the line (with appropriate modifications) to the end of the file: ``` YourUserName ALL = (root) NOPASSWD: /path/to/your/script ``` Once you save and exit you'll be able to run `sudo /path/to/your/script` witho...
How is the script being launched? One way to have a script run on startup under superuser would be to create an app with automater, add the run shell script action, type in `sudo sh "path to your script"`, save it, and then add the app to login items under System Preferences -> Accounts -> Login items
42,605,338
I am trying to connect one of my remote database using odbc driver which is configured using DSN. But I did not find related parameters to create\_engine object. Can anyone help on this?
2017/03/05
[ "https://Stackoverflow.com/questions/42605338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4814745/" ]
For SQL Server: You need to first create a DSN object to use. Go to `Start»Settings»Control Panel»Administrative Tools»Data Sources` Open System DSN and add a new DSN. It will give you a list of databases for which you can create a DSN. Select one and and proceed with the steps. Give a name to the DSN (by which you w...
I have found the classic "//DSNSTRING" method didn't work with SQL Server. From my environment (Python + MSSQL); the below worked: ``` engine = create_engine("mssql+pyodbc://user:password@DSNSTRING") ``` Hope that helps
29,748,655
I am parsing one dynamically generated xml, I have some queries regarding the data extraction from the xml. My code is as follows, ``` try { File file = new File("test.xml"); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Do...
2015/04/20
[ "https://Stackoverflow.com/questions/29748655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4529026/" ]
You just have to check the element nodes you're getting. If you have `<value />`, then it won't have child nodes: ``` NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("value"); Element fstNmElmnt = (Element) fstNmElmntLst.item(0); if (fstNmElmnt.hasChildNodes()) { NodeList fstNm = fstNmElmnt.getChil...
is it ok? If i change it like below ; Instead of this ; ``` NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("value"); Element fstNmElmnt = (Element) fstNmElmntLst.item(0); NodeList fstNm = fstNmElmnt.getChildNodes(); System.out.println("Value: " + ((Node) fstNm.item(...
29,748,655
I am parsing one dynamically generated xml, I have some queries regarding the data extraction from the xml. My code is as follows, ``` try { File file = new File("test.xml"); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Do...
2015/04/20
[ "https://Stackoverflow.com/questions/29748655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4529026/" ]
You just have to check the element nodes you're getting. If you have `<value />`, then it won't have child nodes: ``` NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("value"); Element fstNmElmnt = (Element) fstNmElmntLst.item(0); if (fstNmElmnt.hasChildNodes()) { NodeList fstNm = fstNmElmnt.getChil...
Use XPath instead. Code will be *much* easier to read and maintain: ``` XPath xp = XPathFactory.newInstance().newXPath(); NodeList controls = (NodeList) xp.evaluate("//control", doc, XPathConstants.NODESET); for (int i = 0; i < controls.getLength(); ++i) { Node c = controls.item(i); ...
18,299,784
I know how to reflect single letters vertically using `transform: rotate();` but not how to reflect them horizontally. Do you know how I can reflect them horizontally? I want to use it with the selector `.logo:first-letter {}` for my logo. ``` <a href="#" class="logo">RR</a> ``` EDIT: <http://jsfiddle.net/n7YA7/1/...
2013/08/18
[ "https://Stackoverflow.com/questions/18299784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2572623/" ]
Set the `scaleX` property as a transform. ``` .logo:first-letter { transform: scaleX(-1); } ``` If it's always a specific letter, it might be a better idea to just use unicode for this. In your case, [`CYRILLIC CAPITAL LETTER YA`](http://www.fileformat.info/info/unicode/char/42f/index.htm) (Я) will work.
I would use scale: ``` transform:scale(-1, 1); -ms-transform:scale(-1, 1); /* IE 9 */ -webkit-transform:scale(-1, 1); /* Safari and Chrome */ ``` Check here if it is right for you: <http://jsfiddle.net/kytXf/>
20,434
In a simple combination lock, a sequence of several digits is used as a password, with one wheel per digit. Generally, it is not possible to unlock the lock without knowing the password, but due to the workings of this lock's mechanism, a "click" is heard whenever a wheel is rotated into the correct position. For exam...
2015/08/22
[ "https://puzzling.stackexchange.com/questions/20434", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/15544/" ]
Definitions =========== Consider a lock $L$ consisting of $m$ wheels, where the $i$th wheel has $k\_i$ digits (assume $k\_i\geq 2$). I will use the notation $L=\{k\_1,k\_2,\ldots,k\_m\}$. The number of combinations $L$ can be set to, which I call the **size** of $L$ which I write as $|L|$, is simply the product of th...
1. For each $k$-digit dial, the number of tries in the worst case is $k$, and the number of tries in the average case is $\frac{k+1}{2}$. > > We get $k = 3$, giving 63 tries in the worst case (beating $k=2$ and $k=4$, both on 68) and 42 tries in the average case (beating $k=2$ on 51 and $k=4$ on 42.5). This is proba...
4,095,337
Consider the following code: ``` #include <iostream> #include <cstdio> #include <cstring> using namespace std; template<class T> bool IsNaN(T t) { return t != t; } int main(int argc, char**argv) { double d1, d2; sscanf(argv[1], "%f", &d1); sscanf(argv[2], "%f", &d2); double dRes = d1/d2; c...
2010/11/04
[ "https://Stackoverflow.com/questions/4095337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/466694/" ]
1. When using `scanf()` `double` should be read using `%lf`, not `%f`. `%f` will convert the input into a 32-bit `float`, so the first 32 bits of your variables will be filled with some invalid data, and the last 32 bits will be left as garbage. 2. Yes. `#include <limits>`, [then `std::numeric_limits<double>::quiet_NaN...
Just do it like that: ``` if (dRes == +1.0/0.0 || dRes == -1.0/0.0) ... //+INF, -INF if (dRes == +0.0/0.0 ) ... //+NaN; i.e. pow(2.0 ,16384.0) ```
4,095,337
Consider the following code: ``` #include <iostream> #include <cstdio> #include <cstring> using namespace std; template<class T> bool IsNaN(T t) { return t != t; } int main(int argc, char**argv) { double d1, d2; sscanf(argv[1], "%f", &d1); sscanf(argv[2], "%f", &d2); double dRes = d1/d2; c...
2010/11/04
[ "https://Stackoverflow.com/questions/4095337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/466694/" ]
1. When using `scanf()` `double` should be read using `%lf`, not `%f`. `%f` will convert the input into a 32-bit `float`, so the first 32 bits of your variables will be filled with some invalid data, and the last 32 bits will be left as garbage. 2. Yes. `#include <limits>`, [then `std::numeric_limits<double>::quiet_NaN...
The function `fpclassify` will let you inspect a floating-point value for all the special cases. It's found in `<math.h>` as a macro since C99, and in `<cmath>` as a family of functions, for `float`, `double`, and `long double` under the overloaded name `std::fpclassify` since C++11. cppreference has [a nice example]...
4,095,337
Consider the following code: ``` #include <iostream> #include <cstdio> #include <cstring> using namespace std; template<class T> bool IsNaN(T t) { return t != t; } int main(int argc, char**argv) { double d1, d2; sscanf(argv[1], "%f", &d1); sscanf(argv[2], "%f", &d2); double dRes = d1/d2; c...
2010/11/04
[ "https://Stackoverflow.com/questions/4095337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/466694/" ]
The function `fpclassify` will let you inspect a floating-point value for all the special cases. It's found in `<math.h>` as a macro since C99, and in `<cmath>` as a family of functions, for `float`, `double`, and `long double` under the overloaded name `std::fpclassify` since C++11. cppreference has [a nice example]...
Just do it like that: ``` if (dRes == +1.0/0.0 || dRes == -1.0/0.0) ... //+INF, -INF if (dRes == +0.0/0.0 ) ... //+NaN; i.e. pow(2.0 ,16384.0) ```
71,951,889
I’m working on a Java application that interacts with a REST API. To communicate with this API, I must use TOKEN, all these TOKEN are sensitive data and I cannot write in my code. So I’m looking for a way like a configuration file to store the TOKEN and access it. Currently, I made an XML file with all my TOKEN and I...
2022/04/21
[ "https://Stackoverflow.com/questions/71951889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18059330/" ]
Based on what I have observed so far, I believe this XML file is acting as a config file or something like that which manages environment variables at runtime. However, you need to be aware that any sensitive values should not be stored as plain text inside your repository, database, containers, etc. A practical appro...
You can check Keycloak server: <https://www.keycloak.org/>
305,762
I have a 2016 MacBook Pro 13" with 4 Thunderbolt 3 ports. I am connecting a TB3 dock from the back left port of the MacBook Pro but would like to use the right back port instead. I read on the [eGPU forums](https://egpu.io/forums/) that there was some difference in the ports, but I can no longer find the post. Are all...
2017/11/14
[ "https://apple.stackexchange.com/questions/305762", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/18285/" ]
As it turns out, there is a [support document published by Apple](https://support.apple.com/en-us/HT207256) that directly **answers my question**: > > Late-2016 MacBook Pro models vary slightly in the data speeds they > provide to each Thunderbolt 3 port. > > > MacBook Pro (15-inch, Late 2016) delivers full Thunde...
Mactracker specifies: *4 - up to 40 Gbps* [Apple Support Document](https://support.apple.com/kb/SP748?locale=en_US) specifies even further: *Four Thunderbolt 3 (USB-C) ports with support for:* * Charging * DisplayPort * Thunderbolt (up to 40 Gbps) * USB 3.1 Gen 2 (up to 10 Gbps) The key phrase here is **up to**. 40...
41,957,964
I have a table like this. ``` user 01/12/15 02/12/15 someBool u1 100 300 true u2 200 -100 false u3 -50 200 true ``` I want to repartition the date columns into two columns `date` and `value` like this. ``` user date value someBool u1 01/12/1...
2017/01/31
[ "https://Stackoverflow.com/questions/41957964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5255206/" ]
You need [`melt`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.melt.html): ``` df = pd.melt(df, id_vars=['user','someBool'], var_name='date') print (df) user someBool date value 0 u1 True 01/12/15 100 1 u2 False 01/12/15 200 2 u3 True 01/12/15 -50 3 u1 True 0...
`numpy` reconstruct the whole thing =================================== ``` id_vars = ['user', 'someBool'] the_rest = df.columns.difference(id_vars).tolist() m, n = len(df), len(the_rest) var_slc = np.arange(m).repeat(n) pd.DataFrame( np.hstack([ df[id_vars].values[var_slc], np.tile(the_r...
3,404
I'm running ubuntu 9.10 x64, with the stock tightvncserver (1.3.9). When I start tightvncserver, I can connect with the windows tightvnc client and get the empty desktop with a single terminal. When I then try to start gnome-session it promptly crashes. The last lines on the tightvncserver log are: ``` 01/09/10 10:5...
2010/09/01
[ "https://askubuntu.com/questions/3404", "https://askubuntu.com", "https://askubuntu.com/users/1309/" ]
To answer how to diagnose your problem specifically, the first step would be to enable [apport crash reporting](https://wiki.ubuntu.com/Testing/EnableProposed#Enable%20Apport) on the system and then attempt to reproduce the crash. Once you've caused TightVNC to crash again, if it was the type of crash that apport shoul...
I've had a lot of problems when using tightvnc when desktop effects are enabled (eg. compiz). Try disabling compiz and see if that solves your problem. You can disable it via System --> Preferences --> Appearance, and then selecting the Visual Effects tab (Select "None"). If that doesn't help you out, you'll probably ...
19,097,193
I have the following function to load iFrames content when I click on the link. I'm trying to implement the .next method to load one iFrame at time and not all together. ``` $('.toggle-next-div').click(function () { var iframe = $(this).next('.myiFrame'); iframe.attr("src", iframe.data("src")); }); ``` HTML ``` <a...
2013/09/30
[ "https://Stackoverflow.com/questions/19097193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2635574/" ]
`.next` selects the immediate next sibling of the selected element, i.e the `.slidingDiv` element(*if it matches with the specified selector*), you can use `.find()` and `.next()` methods: ``` var iframe = $(this).next('.slidingDiv').find('.myiFrame'); ``` If you want to select all the `.myiFrame` descendant element...
It looks like this is what you were going for HTML: ``` <a href="#" class="toggle-next-div">Map</a> <div class="slidingDiv"> <div style="margin-top:0"> <span style="float:left;font-weight:bold">title</span> <iframe class="myiFrame" data-src="http://www.yahoo.com" src="about:blank"></iframe> ...
13,634,829
i am trying to read Window title from txt file i will use GetTitleWidnow to get window title using string i tried this but it didnt display menu in application ``` ostringstream GetTitleWidnow; GetTitleWidnow << "MainSvrt on port 51752"; LPCWSTR LMainSvrtTitle; std::string SMainSvrtTitle = GetTitleWidnow....
2012/11/29
[ "https://Stackoverflow.com/questions/13634829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1791071/" ]
You should either use Microsoft's CString which automatically converts between wide and narrow characters, or use the `MultiByteToWideChar` function.
If you can use ATL, please try CA2W, CW2A, it's so easy to use.
49,788,506
i was doing a code for an application that uses a `ImageButton` and I've been getting the message "`Unfortunately <appname> has stopped working`" when I run the app and press the `ImageButton`. I'm new on these kind of app, so I don't really know what's wrong with my code because I don't have any errors on the code. ...
2018/04/12
[ "https://Stackoverflow.com/questions/49788506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9634072/" ]
Assuming you want to parallelize the inner loop ``` for ( i = 1; i < n; ++i ) { x[i] = z[i] * ( y[i] - x[i - 1] ); } ``` I would suggest pre-computing the part that are not dependent on the previous loop. which is easier to parallelize. ``` double preComps [n]; #pragma omp parallel for for( i = 1; i < n ; ++i ...
The outer loop is just noise, it does the same all the time, as Luis stated in his answer. So we don't have to consider this (or can massivly parallize it, but doing it once would be enough).... The inner loop depends on the previous cycle(`x[i-1]`). A precomputation of `z * y` changing the inner loop to `x[i] = pr...
49,788,506
i was doing a code for an application that uses a `ImageButton` and I've been getting the message "`Unfortunately <appname> has stopped working`" when I run the app and press the `ImageButton`. I'm new on these kind of app, so I don't really know what's wrong with my code because I don't have any errors on the code. ...
2018/04/12
[ "https://Stackoverflow.com/questions/49788506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9634072/" ]
Assuming you want to parallelize the inner loop ``` for ( i = 1; i < n; ++i ) { x[i] = z[i] * ( y[i] - x[i - 1] ); } ``` I would suggest pre-computing the part that are not dependent on the previous loop. which is easier to parallelize. ``` double preComps [n]; #pragma omp parallel for for( i = 1; i < n ; ++i ...
OUTER LOOP (no aliasing assumed, see below for aliasing permitted) ================================================================== As you make *no references* to the outer loop control variable `l` and you don't even reference *the same terms of the assignment* and *no lateral effects are made in the inner loop*, r...
49,788,506
i was doing a code for an application that uses a `ImageButton` and I've been getting the message "`Unfortunately <appname> has stopped working`" when I run the app and press the `ImageButton`. I'm new on these kind of app, so I don't really know what's wrong with my code because I don't have any errors on the code. ...
2018/04/12
[ "https://Stackoverflow.com/questions/49788506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9634072/" ]
OUTER LOOP (no aliasing assumed, see below for aliasing permitted) ================================================================== As you make *no references* to the outer loop control variable `l` and you don't even reference *the same terms of the assignment* and *no lateral effects are made in the inner loop*, r...
The outer loop is just noise, it does the same all the time, as Luis stated in his answer. So we don't have to consider this (or can massivly parallize it, but doing it once would be enough).... The inner loop depends on the previous cycle(`x[i-1]`). A precomputation of `z * y` changing the inner loop to `x[i] = pr...
52,648,383
I am trying to perform a MultiOutput Regression using ElasticNet and Random Forests as follows: ```python from sklearn.ensemble import RandomForestRegressor from sklearn.multioutput import MultiOutputRegressor from sklearn.linear_model import ElasticNet X_train, X_test, y_train, y_test = train_test_split(X_features, ...
2018/10/04
[ "https://Stackoverflow.com/questions/52648383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10456915/" ]
MultiOutputRegressor itself doesn't have these attributes - you need to access the underlying estimators first using the `estimators_` attribute (which, although not mentioned in the [docs](http://scikit-learn.org/stable/modules/generated/sklearn.multioutput.MultiOutputRegressor.html), it exists indeed - see the docs f...
``` regr_multi_Enet.estimators_[0].coef_ ``` To get the coefficients of the first estimator etc.
27,686
How do you make 82 with the numbers > > $4, 5, 6, 7, 8, 9, 0$ > > > and 8 dots. Get creative! You can use any mathematical operation, and the dots can be used in any mathematical way. No ratios. You must use every number. Hint #1 > > The dots are to be used in an unexpected way. > > > Hint #2 > > Ho...
2016/02/19
[ "https://puzzling.stackexchange.com/questions/27686", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/17970/" ]
> > $.7^0\cdot98.4\cdot.5\colon.6$ > > > Explanation: > > $0.7$ to the zeroth power, multiplied by $98.4$ and $0.5$, is $49.2$. The ratio of this number to $0.6$ is $82$. > > >
That's easy, if we remember our SATs... > > 60 : 984 :: 5 : ? > > > > Thanks, analogies! > > >
27,686
How do you make 82 with the numbers > > $4, 5, 6, 7, 8, 9, 0$ > > > and 8 dots. Get creative! You can use any mathematical operation, and the dots can be used in any mathematical way. No ratios. You must use every number. Hint #1 > > The dots are to be used in an unexpected way. > > > Hint #2 > > Ho...
2016/02/19
[ "https://puzzling.stackexchange.com/questions/27686", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/17970/" ]
That's easy, if we remember our SATs... > > 60 : 984 :: 5 : ? > > > > Thanks, analogies! > > >
Ok, I'll write my desired answer. > > $80 + .\dot{9}\dot{7} + .\dot{5} + .\dot{4}\dot{6}$ > > > Which is basically... > > $80 + 0.97979797... + 0.55555555... + 0.46464646...$ > > > that adds up to... > > $80 + 198/99$ > > > Which finally equals to > > $82$ > > >
27,686
How do you make 82 with the numbers > > $4, 5, 6, 7, 8, 9, 0$ > > > and 8 dots. Get creative! You can use any mathematical operation, and the dots can be used in any mathematical way. No ratios. You must use every number. Hint #1 > > The dots are to be used in an unexpected way. > > > Hint #2 > > Ho...
2016/02/19
[ "https://puzzling.stackexchange.com/questions/27686", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/17970/" ]
> > $.7^0\cdot98.4\cdot.5\colon.6$ > > > Explanation: > > $0.7$ to the zeroth power, multiplied by $98.4$ and $0.5$, is $49.2$. The ratio of this number to $0.6$ is $82$. > > >
Ok, I'll write my desired answer. > > $80 + .\dot{9}\dot{7} + .\dot{5} + .\dot{4}\dot{6}$ > > > Which is basically... > > $80 + 0.97979797... + 0.55555555... + 0.46464646...$ > > > that adds up to... > > $80 + 198/99$ > > > Which finally equals to > > $82$ > > >
53,487,916
I am utilising spring cloud aws messaging (`2.0.1.RELEASE`) in java to consume from an SQS queue. If it's relevant we use default settings, java 10 and spring cloud `Finchley.SR2`, We recently had an issue where a message could not be processed due to an application bug, leading to an exception and no confirmation (de...
2018/11/26
[ "https://Stackoverflow.com/questions/53487916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4127155/" ]
Based on a [similar question on AWS forums](https://forums.aws.amazon.com/thread.jspa?messageID=820342&tstart=0), this is apparently a bug with regular SQS queues where only a single message is affected. In order to have a useful alarm for this issue, I would suggest setting up a [dead-letter-queue](https://docs.aws....
I think this might have to do with the `poison pill` handling by this metric. After 3+ tries, the message won't be included in the metric. From [the AWS docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-available-cloudwatch-metrics.html): > > After a message is received three times ...
42,006,098
I have an large existing ASP.NET WebForms application. This application has a masterpage who manager security, navigation, ... Pages developped are in a ContentPlaceHolder. I would like to develop new pages in JS with web components. To use a web component on a page, it must be imported (`<link rel="import" href="..."...
2017/02/02
[ "https://Stackoverflow.com/questions/42006098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/223601/" ]
Asp.Net lets you place ContentPlaceHolder in head tag. You can load the web components required by the page instead of loading them all in Master Page. Master Page ``` <html> <head runat="server"> <title></title> <asp:ContentPlaceHolder ID="cpHead" runat="server"> </asp:ContentPlaceHolder> </head> <body> ...
You would normally use `RegisterClientScriptInclude`. This will add the script file to the top of the page, but not in the `<head>`. ``` ClientScript.RegisterClientScriptInclude("myScript", "myJavaScriptFile.js"); ``` If you really want it in the `<head>` you need to use a `HtmlGenericControl` ``` HtmlGenericContr...
13,006,541
I was using ubuntu 12.04 until 12.10 was released. I used ubuntu for software development and after installing 12.10, i noticed that the perl version (5.14) shipped with 12.10 does not include the Switch.pm module needed while building WebKiT-GTK. Looking around on the internet i found few suggestions indicating that ...
2012/10/22
[ "https://Stackoverflow.com/questions/13006541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/872219/" ]
``` sudo apt-get install libswitch-perl ``` will install it for you. "ports" is a \*BSD packaging system of sorts, not what you should be looking for. You can find what package has a particular perl module by going to packages.ubuntu.com, entering Module/Name.pm (in this case, Switch.pm) in the "Search the contents...
Do make sure you've checked properly that there isn't the Switch module available via apt. If it is available, that's the one you want. No, then you've two options the longer, correct way and a shorter way that's not quite as clean. **1. Longer** Install cpanm and perlbrew with apt. The perlbrew tool lets you insta...
26,942,477
``` I tried this: public static void ReadRecord() { String line = null; try { FileReader fr = new FileReader("input.txt"); BufferedReader br = new BufferedReader(fr); line = br.readLine(); while(line != null) { System.out.println(lin...
2014/11/15
[ "https://Stackoverflow.com/questions/26942477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3501017/" ]
You have to read the lines in the file repeatedly in the loop using `br.readLine()`. `br.readLine()` reads only one line at time. do something like this: ``` while((line = br.readLine()) != null) { System.out.println(line); } ``` Check this link also if you have some problems. <http://www.mkyong.com/java/h...
try this ``` while((line = br.readLine()) != null) { System.out.println(line); } ```
26,942,477
``` I tried this: public static void ReadRecord() { String line = null; try { FileReader fr = new FileReader("input.txt"); BufferedReader br = new BufferedReader(fr); line = br.readLine(); while(line != null) { System.out.println(lin...
2014/11/15
[ "https://Stackoverflow.com/questions/26942477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3501017/" ]
You have to read the lines in the file repeatedly in the loop using `br.readLine()`. `br.readLine()` reads only one line at time. do something like this: ``` while((line = br.readLine()) != null) { System.out.println(line); } ``` Check this link also if you have some problems. <http://www.mkyong.com/java/h...
Try This : ``` BufferedReader br = new BufferedReader(new FileReader("input.txt")); while((line=br.readline())!=null) System.out.println(line); ```
26,942,477
``` I tried this: public static void ReadRecord() { String line = null; try { FileReader fr = new FileReader("input.txt"); BufferedReader br = new BufferedReader(fr); line = br.readLine(); while(line != null) { System.out.println(lin...
2014/11/15
[ "https://Stackoverflow.com/questions/26942477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3501017/" ]
You have to read the lines in the file repeatedly in the loop using `br.readLine()`. `br.readLine()` reads only one line at time. do something like this: ``` while((line = br.readLine()) != null) { System.out.println(line); } ``` Check this link also if you have some problems. <http://www.mkyong.com/java/h...
For a text file called access.txt locate for example on your X drive, this should work. ``` public static void readRecordFromTextFile throws FileNotFoundException { try { File file = new File("X:\\access.txt"); Scanner sc = new Scanner(file); sc.useDelimiter(",|\r\n"); System.out.p...
26,942,477
``` I tried this: public static void ReadRecord() { String line = null; try { FileReader fr = new FileReader("input.txt"); BufferedReader br = new BufferedReader(fr); line = br.readLine(); while(line != null) { System.out.println(lin...
2014/11/15
[ "https://Stackoverflow.com/questions/26942477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3501017/" ]
try this ``` while((line = br.readLine()) != null) { System.out.println(line); } ```
Try This : ``` BufferedReader br = new BufferedReader(new FileReader("input.txt")); while((line=br.readline())!=null) System.out.println(line); ```
26,942,477
``` I tried this: public static void ReadRecord() { String line = null; try { FileReader fr = new FileReader("input.txt"); BufferedReader br = new BufferedReader(fr); line = br.readLine(); while(line != null) { System.out.println(lin...
2014/11/15
[ "https://Stackoverflow.com/questions/26942477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3501017/" ]
try this ``` while((line = br.readLine()) != null) { System.out.println(line); } ```
For a text file called access.txt locate for example on your X drive, this should work. ``` public static void readRecordFromTextFile throws FileNotFoundException { try { File file = new File("X:\\access.txt"); Scanner sc = new Scanner(file); sc.useDelimiter(",|\r\n"); System.out.p...
65,428,643
I have a HTML page that has many div elements, each one with the following structure (the input id and name changes): ``` <div class="item"> <div class="box"> <div class="img-block"> <label for="check-11"> <input id="check-11" name="result11" type="checkbox"> <span class="fak...
2020/12/23
[ "https://Stackoverflow.com/questions/65428643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5537357/" ]
Use [page.$$](https://pptr.dev/#?product=Puppeteer&version=v5.5.0&show=api-pageselector-1) to return multiple elements (equivalent of document.querySelectorAll). Use [page.$](https://pptr.dev/#?product=Puppeteer&version=v5.5.0&show=api-pageselector) to return a single element (equivalent of document.querySelector). If...
``` var obj = document.querySelectorAll("span.fake-input"); for(var i=0;i<obj.length;i++){ obj[i].click(); } ``` Vanilla JavaScript would work much easier
60,810,669
I have labels named: `label1`, `label2`, ...`label16`. I want to assign a random number to all of them. Something like this could work but I don't know the syntax: ``` for i = 1 to 16 label(i).text = Math.Ceiling(Rnd() * 99) next ``` Your suggestions would be appreciated.
2020/03/23
[ "https://Stackoverflow.com/questions/60810669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13108568/" ]
You can use this using [`Controls.Find`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.control.controlcollection.find): ``` For i As Integer = 1 To 16 Dim arrCtrl() As Control = Me.Controls.Find("label" & i, True) If arrCtrl.Length = 1 AndAlso TypeOf arrCtrl(0) Is Label Then Direct...
> > **Getting a random Integer** > > > --- Use the [Random](https://learn.microsoft.com/en-us/dotnet/api/system.random?view=netframework-4.8) class instead of the [Rnd](https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/rnd-function) function to get a random `Integer` within a spe...
60,810,669
I have labels named: `label1`, `label2`, ...`label16`. I want to assign a random number to all of them. Something like this could work but I don't know the syntax: ``` for i = 1 to 16 label(i).text = Math.Ceiling(Rnd() * 99) next ``` Your suggestions would be appreciated.
2020/03/23
[ "https://Stackoverflow.com/questions/60810669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13108568/" ]
You can use this using [`Controls.Find`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.control.controlcollection.find): ``` For i As Integer = 1 To 16 Dim arrCtrl() As Control = Me.Controls.Find("label" & i, True) If arrCtrl.Length = 1 AndAlso TypeOf arrCtrl(0) Is Label Then Direct...
``` Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim labels As New List(Of Label) From {Label1, Label2, Label3, Label4} For Each l As Label In labels l.Text = rand.Next(99).ToString Next End Sub ``` To use your approach 1. Declare a variable for the Random cla...
41,793,022
I have an array of objects like so; ``` var orders = [ { status: "pending" }, { status: "received" }, { status: "sent" }, { status: "pending" } ] ``` I want to sort this array of objects based on the value of the `status` key, but so that the order of the objects matches the order of ...
2017/01/22
[ "https://Stackoverflow.com/questions/41793022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/951402/" ]
The best way is using input instead of div, but you can add input contain value of div when form submission. In this case value of created input sended. ``` <form id="myfrom"> <div id="claimamount">50</div> <button>Submit</button> </form> ``` ```js $("form").submit(function(e){ var val = $("#claimamount").text...
You can create a helper to add some element contents to your form ``` function sendElementContent(elementId, form) { var input = document.createElement('input'); input.name = elementId; input.value = document.getElementById(elementId).textContent; input.type = 'hidden'; form.appendChild(input); } ``` Usage...
42,151,567
I'm using [IO::Select](http://perldoc.perl.org/IO/Select.html). It is an OOP wrapper for the [normal `select` call](http://perldoc.perl.org/functions/select.html), but it exposes `can_read()` and `can_write()` methods. Is there no way to block waiting for a read or write socket? Does this not (almost) defeat the purpo...
2017/02/10
[ "https://Stackoverflow.com/questions/42151567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/68105/" ]
Use [`IO::Select->select`](http://perldoc.perl.org/IO/Select.html#select-%28-READ%2c-WRITE%2c-EXCEPTION-%5B%2c-TIMEOUT-%5D-%29): > > **select ( READ, WRITE, EXCEPTION [, TIMEOUT ] )** > > > `select` is a static method, that is you call it with the package name like `new`. `READ`, `WRITE` and `EXCEPTION` are either ...
> > If TIMEOUT is not given and any handles are registered then the call will block. > > > It looks like `can_read` and `can_write` *will* block if you don't pass a timeout. I'd suggest that this is rarely what is desired, though it might be under some circumstances. Personally, I'd suggest using one of the many ...
4,611,619
I have the following table setup: **`t1`** has two columns: **`id`**, and **`flag_a`**. `id` is a unique identifier, and `flag_a` is a boolean. **`t2`** has three columns, **`id`**, and **`parent_id`**, and **`flag_b`**. `id` is a unique identifier, `parent_id` is one of the `id`'s from `t1`, and `flag_b` is a bool...
2011/01/06
[ "https://Stackoverflow.com/questions/4611619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78877/" ]
``` SELECT t2.id FROM t2 INNER JOIN t1 ON t2.parent_id=t1.id WHERE flag_a=0 AND flab_b=0 ```
``` SELECT t2.id FROM t1 INNER JOIN t2 ON t1.id = t2.Parent_id WHERE t1.flag_a = 0 AND t2.flag_b = 0 ``` Hope this helps,
4,611,619
I have the following table setup: **`t1`** has two columns: **`id`**, and **`flag_a`**. `id` is a unique identifier, and `flag_a` is a boolean. **`t2`** has three columns, **`id`**, and **`parent_id`**, and **`flag_b`**. `id` is a unique identifier, `parent_id` is one of the `id`'s from `t1`, and `flag_b` is a bool...
2011/01/06
[ "https://Stackoverflow.com/questions/4611619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78877/" ]
``` SELECT t2.id FROM t2 INNER JOIN t1 ON t2.parent_id=t1.id WHERE flag_a=0 AND flab_b=0 ```
``` Select t2.id From t2 INNER JOIN t1 ON t2.parent_id = t1.ID and t2.Flag_B = 0 and t1.Flag_a = 0 ``` Or ``` Select t2.id From t2 INNER JOIN t1 ON t2.parent_id = t1.ID WHERE t2.Flag_B = 0 and t1.Flag_a = 0 ```
4,611,619
I have the following table setup: **`t1`** has two columns: **`id`**, and **`flag_a`**. `id` is a unique identifier, and `flag_a` is a boolean. **`t2`** has three columns, **`id`**, and **`parent_id`**, and **`flag_b`**. `id` is a unique identifier, `parent_id` is one of the `id`'s from `t1`, and `flag_b` is a bool...
2011/01/06
[ "https://Stackoverflow.com/questions/4611619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78877/" ]
``` SELECT t2.id FROM t2 INNER JOIN t1 ON t2.parent_id=t1.id WHERE flag_a=0 AND flab_b=0 ```
``` SELECT t2.id FROM t2 INNER JOIN t1 ON t2.parent_id = t1.id WHERE t2.flag_b = 0 AND t1.flag_a = 0 ```
4,611,619
I have the following table setup: **`t1`** has two columns: **`id`**, and **`flag_a`**. `id` is a unique identifier, and `flag_a` is a boolean. **`t2`** has three columns, **`id`**, and **`parent_id`**, and **`flag_b`**. `id` is a unique identifier, `parent_id` is one of the `id`'s from `t1`, and `flag_b` is a bool...
2011/01/06
[ "https://Stackoverflow.com/questions/4611619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78877/" ]
``` SELECT t2.id FROM t1 INNER JOIN t2 ON t1.id = t2.Parent_id WHERE t1.flag_a = 0 AND t2.flag_b = 0 ``` Hope this helps,
``` SELECT t2.id FROM t2 INNER JOIN t1 ON t2.parent_id = t1.id WHERE t2.flag_b = 0 AND t1.flag_a = 0 ```
4,611,619
I have the following table setup: **`t1`** has two columns: **`id`**, and **`flag_a`**. `id` is a unique identifier, and `flag_a` is a boolean. **`t2`** has three columns, **`id`**, and **`parent_id`**, and **`flag_b`**. `id` is a unique identifier, `parent_id` is one of the `id`'s from `t1`, and `flag_b` is a bool...
2011/01/06
[ "https://Stackoverflow.com/questions/4611619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78877/" ]
``` Select t2.id From t2 INNER JOIN t1 ON t2.parent_id = t1.ID and t2.Flag_B = 0 and t1.Flag_a = 0 ``` Or ``` Select t2.id From t2 INNER JOIN t1 ON t2.parent_id = t1.ID WHERE t2.Flag_B = 0 and t1.Flag_a = 0 ```
``` SELECT t2.id FROM t2 INNER JOIN t1 ON t2.parent_id = t1.id WHERE t2.flag_b = 0 AND t1.flag_a = 0 ```
12,426
I tend to use `Ctrl`+`Shift`+`Alt` for my customized system-wide keybindings. When I tried `Ctrl`+`Shift`+`Alt`+`U` it printed an **underscored u** and waited for **more** keyboard input!... Some keys were accepted and some were not... eg. Numbers were accepted and they too were underlined, but only a few keys ...
2010/11/10
[ "https://askubuntu.com/questions/12426", "https://askubuntu.com", "https://askubuntu.com/users/2670/" ]
`Ctrl`-`Shift`-`U` is the short-cut to start entering a full unicode character by hand. For example, here I've typed: `Ctrl`-`Shift`-`U` `0` `0` `b` `0` `enter` to get the degree symbol: ° which is unicode 00b0. Here is 2665, the heart: ♥ For a list of unicode symbols start here: <http://en.wikipedia.org/wiki/Unicode>
The glyph unicode u+240E ␎ is used when referring to u+000E aka SO (Shift Out) or ctrl-N, basically any control code is rendered as a symbol by adding 2400hex to the control code to get the equivalent unicode glyph. (aside: The wrong glyph appears in Ubuntu 12.04. It should be SO not SS. see below) To see the differen...
12,921,301
I want the image on the button to change once i click it. That means even if the button has been clicked once the new image should remain
2012/10/16
[ "https://Stackoverflow.com/questions/12921301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1750990/" ]
Do `yourButton.setOnClickListener(new View.OnClickListener() { yourButton.setBackgroundResource(R.drawable.yourBackgroundImage); });`
1.You need to define states for your button and define background corresponding every state: ``` <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/button_pressed" android:state_pressed="true" /> <item android...
11,410,870
How can i refresh or reload the div using jquery ajax on page load
2012/07/10
[ "https://Stackoverflow.com/questions/11410870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/468202/" ]
Check out this code. Actually it is done by using `$.load()` ``` <!DOCTYPE html> <html> <head> <style> body{ font-size: 12px; font-family: Arial; } </style> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <b>Footer navigation:</b> <ol id="new-nav"></ol> <script> $("#new-nav").l...
``` $(document).load(function() { $("#elementID").load('/path/to/remoteFile'); }); ```
1,282,347
I'm trying to check that a user of this code runs this program from command line using only one command line parameter (the name of the file). When I run this code like this (I'm on windows) ``` C:\>python program.py Usage: program.py <file.txt> C:\> ``` Right. But when I run this program using a file I want to mani...
2009/08/15
[ "https://Stackoverflow.com/questions/1282347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I guess you want: ``` #!/Python26/ # -*- coding: utf-8 -*- import sys def main(argv): if len(argv) < 2: sys.stderr.write("Usage: %s <file.txt>" % (argv[0],)) return 1 f = open(sys.argv[1]) lines = f.readlines() f.close() for line in lines: line = line.strip() etc...
Here's your problem: ``` def main(argv): if len(argv) < 2: sys.stderr.write("Usage: %s <file.txt>" % (argv[0],)) return 1 if __name__ == "__main__": sys.exit(main(sys.argv)) ``` Your main function returns 1 if `len(argv) < 2`, otherwise it returns `None`. Nothing after `if __name__ == "__main...
1,282,347
I'm trying to check that a user of this code runs this program from command line using only one command line parameter (the name of the file). When I run this code like this (I'm on windows) ``` C:\>python program.py Usage: program.py <file.txt> C:\> ``` Right. But when I run this program using a file I want to mani...
2009/08/15
[ "https://Stackoverflow.com/questions/1282347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I notice the peculiar fact that everybody's code is suggesting that your `main` should ignore its arguments (except for checking it has enough) and reach back right into sys.argv instead. That's truly weird and I can't imagine any case where it would be reasonable -- makes main hard to reuse and surprising if this modu...
``` import sys def main(argv): if len(argv) < 2: sys.stderr.write("Usage: %s <file.txt>" % (argv[0],)) return 1 f = open(sys.argv[1]) lines = f.readlines() f.close() for line in lines: line = line.strip() etc... return 0 if __name__ == "__main__": sys.exi...
1,282,347
I'm trying to check that a user of this code runs this program from command line using only one command line parameter (the name of the file). When I run this code like this (I'm on windows) ``` C:\>python program.py Usage: program.py <file.txt> C:\> ``` Right. But when I run this program using a file I want to mani...
2009/08/15
[ "https://Stackoverflow.com/questions/1282347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I guess you want: ``` #!/Python26/ # -*- coding: utf-8 -*- import sys def main(argv): if len(argv) < 2: sys.stderr.write("Usage: %s <file.txt>" % (argv[0],)) return 1 f = open(sys.argv[1]) lines = f.readlines() f.close() for line in lines: line = line.strip() etc...
``` import sys def main(argv): if len(argv) < 2: sys.stderr.write("Usage: %s <file.txt>" % (argv[0],)) return 1 f = open(sys.argv[1]) lines = f.readlines() f.close() for line in lines: line = line.strip() etc... return 0 if __name__ == "__main__": sys.exi...
1,282,347
I'm trying to check that a user of this code runs this program from command line using only one command line parameter (the name of the file). When I run this code like this (I'm on windows) ``` C:\>python program.py Usage: program.py <file.txt> C:\> ``` Right. But when I run this program using a file I want to mani...
2009/08/15
[ "https://Stackoverflow.com/questions/1282347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I notice the peculiar fact that everybody's code is suggesting that your `main` should ignore its arguments (except for checking it has enough) and reach back right into sys.argv instead. That's truly weird and I can't imagine any case where it would be reasonable -- makes main hard to reuse and surprising if this modu...
Here's your problem: ``` def main(argv): if len(argv) < 2: sys.stderr.write("Usage: %s <file.txt>" % (argv[0],)) return 1 if __name__ == "__main__": sys.exit(main(sys.argv)) ``` Your main function returns 1 if `len(argv) < 2`, otherwise it returns `None`. Nothing after `if __name__ == "__main...
1,282,347
I'm trying to check that a user of this code runs this program from command line using only one command line parameter (the name of the file). When I run this code like this (I'm on windows) ``` C:\>python program.py Usage: program.py <file.txt> C:\> ``` Right. But when I run this program using a file I want to mani...
2009/08/15
[ "https://Stackoverflow.com/questions/1282347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I guess you want: ``` #!/Python26/ # -*- coding: utf-8 -*- import sys def main(argv): if len(argv) < 2: sys.stderr.write("Usage: %s <file.txt>" % (argv[0],)) return 1 f = open(sys.argv[1]) lines = f.readlines() f.close() for line in lines: line = line.strip() etc...
You need to move the `f = open...` and beyond into the main function. As it stands, it never gets executed because execution ends at the sys.exit call. [EDIT] Structuring a module this way is a common Python idiom, BTW. In this way, a file may contain class and function definitions which can be imported by another mod...
1,282,347
I'm trying to check that a user of this code runs this program from command line using only one command line parameter (the name of the file). When I run this code like this (I'm on windows) ``` C:\>python program.py Usage: program.py <file.txt> C:\> ``` Right. But when I run this program using a file I want to mani...
2009/08/15
[ "https://Stackoverflow.com/questions/1282347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I guess you want: ``` #!/Python26/ # -*- coding: utf-8 -*- import sys def main(argv): if len(argv) < 2: sys.stderr.write("Usage: %s <file.txt>" % (argv[0],)) return 1 f = open(sys.argv[1]) lines = f.readlines() f.close() for line in lines: line = line.strip() etc...
I notice the peculiar fact that everybody's code is suggesting that your `main` should ignore its arguments (except for checking it has enough) and reach back right into sys.argv instead. That's truly weird and I can't imagine any case where it would be reasonable -- makes main hard to reuse and surprising if this modu...
1,282,347
I'm trying to check that a user of this code runs this program from command line using only one command line parameter (the name of the file). When I run this code like this (I'm on windows) ``` C:\>python program.py Usage: program.py <file.txt> C:\> ``` Right. But when I run this program using a file I want to mani...
2009/08/15
[ "https://Stackoverflow.com/questions/1282347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I guess you want: ``` #!/Python26/ # -*- coding: utf-8 -*- import sys def main(argv): if len(argv) < 2: sys.stderr.write("Usage: %s <file.txt>" % (argv[0],)) return 1 f = open(sys.argv[1]) lines = f.readlines() f.close() for line in lines: line = line.strip() etc...
Please be aware that depending on your Python installation (you said initially you were on Windows), the numbering of command line arguments can be off by one. As it is good practice to write portable code (no matter whether you plan to run it somewhere else, sooner or later this *always* pays off), I'd recommend to us...
1,282,347
I'm trying to check that a user of this code runs this program from command line using only one command line parameter (the name of the file). When I run this code like this (I'm on windows) ``` C:\>python program.py Usage: program.py <file.txt> C:\> ``` Right. But when I run this program using a file I want to mani...
2009/08/15
[ "https://Stackoverflow.com/questions/1282347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I notice the peculiar fact that everybody's code is suggesting that your `main` should ignore its arguments (except for checking it has enough) and reach back right into sys.argv instead. That's truly weird and I can't imagine any case where it would be reasonable -- makes main hard to reuse and surprising if this modu...
Please be aware that depending on your Python installation (you said initially you were on Windows), the numbering of command line arguments can be off by one. As it is good practice to write portable code (no matter whether you plan to run it somewhere else, sooner or later this *always* pays off), I'd recommend to us...
1,282,347
I'm trying to check that a user of this code runs this program from command line using only one command line parameter (the name of the file). When I run this code like this (I'm on windows) ``` C:\>python program.py Usage: program.py <file.txt> C:\> ``` Right. But when I run this program using a file I want to mani...
2009/08/15
[ "https://Stackoverflow.com/questions/1282347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` import sys def main(argv): if len(argv) < 2: sys.stderr.write("Usage: %s <file.txt>" % (argv[0],)) return 1 f = open(sys.argv[1]) lines = f.readlines() f.close() for line in lines: line = line.strip() etc... return 0 if __name__ == "__main__": sys.exi...
Please be aware that depending on your Python installation (you said initially you were on Windows), the numbering of command line arguments can be off by one. As it is good practice to write portable code (no matter whether you plan to run it somewhere else, sooner or later this *always* pays off), I'd recommend to us...
1,282,347
I'm trying to check that a user of this code runs this program from command line using only one command line parameter (the name of the file). When I run this code like this (I'm on windows) ``` C:\>python program.py Usage: program.py <file.txt> C:\> ``` Right. But when I run this program using a file I want to mani...
2009/08/15
[ "https://Stackoverflow.com/questions/1282347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You need to move the `f = open...` and beyond into the main function. As it stands, it never gets executed because execution ends at the sys.exit call. [EDIT] Structuring a module this way is a common Python idiom, BTW. In this way, a file may contain class and function definitions which can be imported by another mod...
Here's your problem: ``` def main(argv): if len(argv) < 2: sys.stderr.write("Usage: %s <file.txt>" % (argv[0],)) return 1 if __name__ == "__main__": sys.exit(main(sys.argv)) ``` Your main function returns 1 if `len(argv) < 2`, otherwise it returns `None`. Nothing after `if __name__ == "__main...
62,200,490
When I add NavigationLink in SwiftUI, it takes the content into the background. How can I solve this problem? My code: ``` NavigationLink(destination: DrinksList()){ VStack{ Image("icecekler") .resizable() .frame(width: 200, height: 200) .cornerRa...
2020/06/04
[ "https://Stackoverflow.com/questions/62200490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11986120/" ]
For one, do not use `SQLOLEDB`. That driver is part of MDAC, which is conveniently installed on all Windows machines since Windows XP SP2, but also dates back to Windows XP SP2, and is very outdated. It's deprecated, and doesn't implement many basic features, such as support for "modern" data types such as `DateTime2`....
sConnectionString = "Provider=MSOLEDBSQL;Data Source=xxxxxxxxxxxx;Initial Catalog=xxxxxxxxxxxxx;UID=xxxxxxxxxxx;PWD=xxxxxxxxxxxx;" Error trapped: 04-Jun-2020 22:18:57; 4.19; xxxx; Error; 4.19; Problem deleting MasterChecklist info, clsMasterChecklist, mbDelete, Error = -2147217873, Application Error -2147217873, The D...
58,149,899
I am having problems with an assignment. I'm fairly new to coding and I am having a hard time trying to figure out how to do this. My professor supplied code for adding and removing items from an array but he wants us to add a method that would add items to the array in the correct position. This is the supplied code: ...
2019/09/28
[ "https://Stackoverflow.com/questions/58149899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12136207/" ]
Sadly, and inexcusably, the code provided by your “professor” has a bug in the `add()` method, here: ``` public boolean add(int pos, Object newElement){ growBufferIfNecessary(); currentSize++; checkBounds(pos); // rest of method ``` Because `checkBounds()` is not called first, if `pos` is out of boun...
*not exactly like insertion sort, because there are free spaces with null-values* ``` public void insert( int n ) { growBufferIfNecessary(); for( int i = 0; i < buffer.length; i++ ) { if( buffer[i] == null ) { buffer[i] = n; currentSize++; break; } else if( buffer[i + 1] != null ) { i...
58,149,899
I am having problems with an assignment. I'm fairly new to coding and I am having a hard time trying to figure out how to do this. My professor supplied code for adding and removing items from an array but he wants us to add a method that would add items to the array in the correct position. This is the supplied code: ...
2019/09/28
[ "https://Stackoverflow.com/questions/58149899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12136207/" ]
Sadly, and inexcusably, the code provided by your “professor” has a bug in the `add()` method, here: ``` public boolean add(int pos, Object newElement){ growBufferIfNecessary(); currentSize++; checkBounds(pos); // rest of method ``` Because `checkBounds()` is not called first, if `pos` is out of boun...
Thank you everyone for your help and suggestions. I got it to work by using the code that Marco13 suggested: <https://codereview.stackexchange.com/questions/36221/binary-search-for-inserting-in-array#answer-36239> Hope everyone has a great day and happy programming. -TJ
17,289,138
Is there any way to monitor image access by user. My website is having few images. But I want to run particular script on access of image by user if user access image directly , e.g ``` http:www.website.com/images/image1.jpg ``` if user directly put above link in browser then script should run. Is there any way ?
2013/06/25
[ "https://Stackoverflow.com/questions/17289138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1853207/" ]
Rewrite all access to images/\* to a script and serve the file over the script using mod\_rewrite. In the script you can then -beofre sending the file - make a call to the db or something... [Url Rewriting Guide](http://httpd.apache.org/docs/2.0/misc/rewriteguide.html) [Serving files with PHP](https://stackoverflow.c...
I don't use php but in any web frameworks you should be able to do URL dispatching (such as using regex to route any \*.jpg access), log it and then redirect it to the real image by setting in header MIME type to be 'image/jpeg' and serving the actual image file.
3,326,688
I went through a section from the book Mathematical Methods in the Physical Sciences, 3rd ed. (Boas) that stated: suppose the roots of the auxiliary equation are $\alpha\pm\beta i$. Therefore the general of the solution of the differential equation is $$y=Ae^{\left(\alpha+\beta i\right)x}+Be^{\left(\alpha-\beta i\right...
2019/08/18
[ "https://math.stackexchange.com/questions/3326688", "https://math.stackexchange.com", "https://math.stackexchange.com/users/355405/" ]
You're studying a vector space of functions, and writing each such function as a linear combination of the elements of some basis of that vector space. When we work in terms of $e^{\alpha x}\sin\beta x$ and $e^{\alpha x}\cos\beta x$ instead of $e^{(\alpha\pm i\beta)x}$, we change our choice of basis, so the coefficient...
From $(2)$ to $(3)$, we have to use that $$ \forall (a,b) \in \mathbb{R}^2,\forall x \in \mathbb{R}^2,\exists (R,C)\in \mathbb{R}^2, \, a\cos(x) + b\sin(x) = R\cos(x+C) $$ A different constant was used because of this conversion. See [here](https://www.intmath.com/analytic-trigonometry/6-express-sin-sum-angles.php) for...
35,681,815
i'm currently working on a user profile system... I'm stuck at the stage where the user updates their information. I'm checking whether the users newly chosen email address already exists in the database. Currently I'm echoing out their current email address into an input value in a form. The validation error receive...
2016/02/28
[ "https://Stackoverflow.com/questions/35681815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5987437/" ]
one of YouTube parameters is autoplay if you set `autoplay = 1` The video will play automatically when the player loads and the default is `0` like this one ``` <iframe width="420" height="315" src="http://www.youtube.com/embed/XGSy3_Czz8k"> </iframe> ``` so my idea is to add this parameter `autoplay=1` to link but ...
You may add the embeding frame without any query parameters. ``` <iframe id="videoframe" width="560" height="315" src="https://www.youtube.com/embed/EuaYIttIowY" frameborder="0" allowfullscreen></iframe> ``` Then you can create a function in javascript to change the property 'src' of the iframe tag ``` function aut...
69,305
Similar to [this](https://photo.stackexchange.com/questions/7233/how-do-you-use-a-gray-card) question; however, I'd like to know more information about using a gray card in a dark room. I know that I am supposed to balance off of it; however, after I make a test strip, how do I use that to determine what my times shou...
2015/09/16
[ "https://photo.stackexchange.com/questions/69305", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/38156/" ]
A "graphics card" has nothing at all to do with colour calibration, that is simply the chipset that sends a signal to the monitor/panel. The term "Graphics card" is only really applicable to full size computers, where it is removable. On 99% of LAPTOPS the graphics processor (GPU) is hard soldered to the motherboard, ...
There is a diference on a graphics card and a chipset. In laptops you do not have a card but you can have a specialized chip for that. And almost all modern computers have a panel to do a basic adjustment from the manufacturer. Windows itself has a module to do that. Here is a link to do a basic calibration: <http://...
69,305
Similar to [this](https://photo.stackexchange.com/questions/7233/how-do-you-use-a-gray-card) question; however, I'd like to know more information about using a gray card in a dark room. I know that I am supposed to balance off of it; however, after I make a test strip, how do I use that to determine what my times shou...
2015/09/16
[ "https://photo.stackexchange.com/questions/69305", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/38156/" ]
Yes, most any notebook computer is capable of allowing you to use calibration products to adjust the output of the display. It's not GPU specific, though. Using a hardware/software solution such as Spyder or ColorMunki is dependent upon compatibility with the installed operating system. Just about any notebook compute...
A "graphics card" has nothing at all to do with colour calibration, that is simply the chipset that sends a signal to the monitor/panel. The term "Graphics card" is only really applicable to full size computers, where it is removable. On 99% of LAPTOPS the graphics processor (GPU) is hard soldered to the motherboard, ...
69,305
Similar to [this](https://photo.stackexchange.com/questions/7233/how-do-you-use-a-gray-card) question; however, I'd like to know more information about using a gray card in a dark room. I know that I am supposed to balance off of it; however, after I make a test strip, how do I use that to determine what my times shou...
2015/09/16
[ "https://photo.stackexchange.com/questions/69305", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/38156/" ]
Yes, most any notebook computer is capable of allowing you to use calibration products to adjust the output of the display. It's not GPU specific, though. Using a hardware/software solution such as Spyder or ColorMunki is dependent upon compatibility with the installed operating system. Just about any notebook compute...
There is a diference on a graphics card and a chipset. In laptops you do not have a card but you can have a specialized chip for that. And almost all modern computers have a panel to do a basic adjustment from the manufacturer. Windows itself has a module to do that. Here is a link to do a basic calibration: <http://...
2,721,802
Let $X$ be a discrete random variable. The probability function is given in the following table $$ \begin{array}{c|cccc} x&-10&1&5&10\\ \hline f(x)&0.1&0.3&0.4&0.2 \end{array} $$ I wish to compute probability function for discrete random variable $Y$ such that $Y=X^2$ If I want to know $f(100)$, then $$ \begin{alig...
2018/04/04
[ "https://math.stackexchange.com/questions/2721802", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
They are not independent, they are mutually exclusive. Events $A$ and $B$ are independent if $$ P(A \cap B) = P(A) P(B) $$ $A$ and $B$ are mutually exclusive if $$ P(A \cap B) = 0 $$ $\{X = 10\}$ and $\{X = -10\}$ are mutually exclusive since we can't simultaneously have $X = 10$ and $X = -10$.
No, they aren't independent because $$P(\{X=10\} \cap \{X=-10\}) \ne P(\{X=10\}) P(\{X=-10\}).$$ * $P(\{X=10\} \cap \{X=-10\}) = P(\varnothing) = 0$ * $P(\{X=10\}) P(\{X=-10\}) = 0.2 \times 0.1 > 0$
390
Can anyone recommend a good way to backup Android devices? Ideally I would like to do this wirelessly and, not only backup my data, but also my user settings. Is it possible to backup an image of an Android device - so that one doesn't even need to reinstall apps? It would be particularly useful to hear from user...
2010/09/15
[ "https://android.stackexchange.com/questions/390", "https://android.stackexchange.com", "https://android.stackexchange.com/users/105/" ]
If you want to do what is essentially a 1-to-1 backup of your device, you can use a custom recovery to create a "nandroid" backup. Doing so effectively creates disk images of your NAND partitions (hence "nandroid") that you can restore from at a later point. This is going to vary a bit by device and recovery system, bu...
If you ***don't have root***, you can use [MyBackup](https://play.google.com/store/apps/details?id=com.rerware.android.MyBackup). It can save applications & media (photos, music, videos), and it can save data (contacts, SMS, MMS, alarms, ...). Unfortunately it requires internet connection (for MyBackup / Rerware acco...
390
Can anyone recommend a good way to backup Android devices? Ideally I would like to do this wirelessly and, not only backup my data, but also my user settings. Is it possible to backup an image of an Android device - so that one doesn't even need to reinstall apps? It would be particularly useful to hear from user...
2010/09/15
[ "https://android.stackexchange.com/questions/390", "https://android.stackexchange.com", "https://android.stackexchange.com/users/105/" ]
If you want to do what is essentially a 1-to-1 backup of your device, you can use a custom recovery to create a "nandroid" backup. Doing so effectively creates disk images of your NAND partitions (hence "nandroid") that you can restore from at a later point. This is going to vary a bit by device and recovery system, bu...
There are a number of apps you can use but many will already have the ES File Manager Note: **Turn off as many apps as you can. Some apps will not backup while running.** * Launch ES File Manager (When you open it you are normally in the file manager mode) * Tap the second icon from the right to switch to Applica...
390
Can anyone recommend a good way to backup Android devices? Ideally I would like to do this wirelessly and, not only backup my data, but also my user settings. Is it possible to backup an image of an Android device - so that one doesn't even need to reinstall apps? It would be particularly useful to hear from user...
2010/09/15
[ "https://android.stackexchange.com/questions/390", "https://android.stackexchange.com", "https://android.stackexchange.com/users/105/" ]
A good way to back up app data if you're not rooted is to used [`adb`](http://developer.android.com/guide/developing/tools/adb.html) from the [Android SDK](http://developer.android.com/sdk/index.html). For example, to back up the data for Locale, you'd do something like the following: `adb pull /data/data/com.twoforty...
There are a number of apps you can use but many will already have the ES File Manager Note: **Turn off as many apps as you can. Some apps will not backup while running.** * Launch ES File Manager (When you open it you are normally in the file manager mode) * Tap the second icon from the right to switch to Applica...
390
Can anyone recommend a good way to backup Android devices? Ideally I would like to do this wirelessly and, not only backup my data, but also my user settings. Is it possible to backup an image of an Android device - so that one doesn't even need to reinstall apps? It would be particularly useful to hear from user...
2010/09/15
[ "https://android.stackexchange.com/questions/390", "https://android.stackexchange.com", "https://android.stackexchange.com/users/105/" ]
A good way to back up app data if you're not rooted is to used [`adb`](http://developer.android.com/guide/developing/tools/adb.html) from the [Android SDK](http://developer.android.com/sdk/index.html). For example, to back up the data for Locale, you'd do something like the following: `adb pull /data/data/com.twoforty...
Depending on your phone is the complexity of this task. HTC Evo (and supported phones) you can use unrEVOked root tool to get root access. Install Titanium Backup and back everything (system included) up onto the memory card (and can copy it to your computer for extra backup). Otherwise you need to either get somethi...
390
Can anyone recommend a good way to backup Android devices? Ideally I would like to do this wirelessly and, not only backup my data, but also my user settings. Is it possible to backup an image of an Android device - so that one doesn't even need to reinstall apps? It would be particularly useful to hear from user...
2010/09/15
[ "https://android.stackexchange.com/questions/390", "https://android.stackexchange.com", "https://android.stackexchange.com/users/105/" ]
The requirement being that you must be ROOTED, you could get [Titanium Backup](http://www.appbrain.com/app/com.keramidas.TitaniumBackup) and back up your phone using that. The reason for using [Titanium Backup](http://www.appbrain.com/app/com.keramidas.TitaniumBackup) is so that you can selectively restore parts of yo...
Depending on your phone is the complexity of this task. HTC Evo (and supported phones) you can use unrEVOked root tool to get root access. Install Titanium Backup and back everything (system included) up onto the memory card (and can copy it to your computer for extra backup). Otherwise you need to either get somethi...
390
Can anyone recommend a good way to backup Android devices? Ideally I would like to do this wirelessly and, not only backup my data, but also my user settings. Is it possible to backup an image of an Android device - so that one doesn't even need to reinstall apps? It would be particularly useful to hear from user...
2010/09/15
[ "https://android.stackexchange.com/questions/390", "https://android.stackexchange.com", "https://android.stackexchange.com/users/105/" ]
The requirement being that you must be ROOTED, you could get [Titanium Backup](http://www.appbrain.com/app/com.keramidas.TitaniumBackup) and back up your phone using that. The reason for using [Titanium Backup](http://www.appbrain.com/app/com.keramidas.TitaniumBackup) is so that you can selectively restore parts of yo...
If you want to do what is essentially a 1-to-1 backup of your device, you can use a custom recovery to create a "nandroid" backup. Doing so effectively creates disk images of your NAND partitions (hence "nandroid") that you can restore from at a later point. This is going to vary a bit by device and recovery system, bu...
390
Can anyone recommend a good way to backup Android devices? Ideally I would like to do this wirelessly and, not only backup my data, but also my user settings. Is it possible to backup an image of an Android device - so that one doesn't even need to reinstall apps? It would be particularly useful to hear from user...
2010/09/15
[ "https://android.stackexchange.com/questions/390", "https://android.stackexchange.com", "https://android.stackexchange.com/users/105/" ]
If you want to do what is essentially a 1-to-1 backup of your device, you can use a custom recovery to create a "nandroid" backup. Doing so effectively creates disk images of your NAND partitions (hence "nandroid") that you can restore from at a later point. This is going to vary a bit by device and recovery system, bu...
Depending on your phone is the complexity of this task. HTC Evo (and supported phones) you can use unrEVOked root tool to get root access. Install Titanium Backup and back everything (system included) up onto the memory card (and can copy it to your computer for extra backup). Otherwise you need to either get somethi...
390
Can anyone recommend a good way to backup Android devices? Ideally I would like to do this wirelessly and, not only backup my data, but also my user settings. Is it possible to backup an image of an Android device - so that one doesn't even need to reinstall apps? It would be particularly useful to hear from user...
2010/09/15
[ "https://android.stackexchange.com/questions/390", "https://android.stackexchange.com", "https://android.stackexchange.com/users/105/" ]
There are a number of apps you can use but many will already have the ES File Manager Note: **Turn off as many apps as you can. Some apps will not backup while running.** * Launch ES File Manager (When you open it you are normally in the file manager mode) * Tap the second icon from the right to switch to Applica...
Depending on your phone is the complexity of this task. HTC Evo (and supported phones) you can use unrEVOked root tool to get root access. Install Titanium Backup and back everything (system included) up onto the memory card (and can copy it to your computer for extra backup). Otherwise you need to either get somethi...
390
Can anyone recommend a good way to backup Android devices? Ideally I would like to do this wirelessly and, not only backup my data, but also my user settings. Is it possible to backup an image of an Android device - so that one doesn't even need to reinstall apps? It would be particularly useful to hear from user...
2010/09/15
[ "https://android.stackexchange.com/questions/390", "https://android.stackexchange.com", "https://android.stackexchange.com/users/105/" ]
A good way to back up app data if you're not rooted is to used [`adb`](http://developer.android.com/guide/developing/tools/adb.html) from the [Android SDK](http://developer.android.com/sdk/index.html). For example, to back up the data for Locale, you'd do something like the following: `adb pull /data/data/com.twoforty...
If you ***don't have root***, you can use [MyBackup](https://play.google.com/store/apps/details?id=com.rerware.android.MyBackup). It can save applications & media (photos, music, videos), and it can save data (contacts, SMS, MMS, alarms, ...). Unfortunately it requires internet connection (for MyBackup / Rerware acco...
390
Can anyone recommend a good way to backup Android devices? Ideally I would like to do this wirelessly and, not only backup my data, but also my user settings. Is it possible to backup an image of an Android device - so that one doesn't even need to reinstall apps? It would be particularly useful to hear from user...
2010/09/15
[ "https://android.stackexchange.com/questions/390", "https://android.stackexchange.com", "https://android.stackexchange.com/users/105/" ]
The requirement being that you must be ROOTED, you could get [Titanium Backup](http://www.appbrain.com/app/com.keramidas.TitaniumBackup) and back up your phone using that. The reason for using [Titanium Backup](http://www.appbrain.com/app/com.keramidas.TitaniumBackup) is so that you can selectively restore parts of yo...
A good way to back up app data if you're not rooted is to used [`adb`](http://developer.android.com/guide/developing/tools/adb.html) from the [Android SDK](http://developer.android.com/sdk/index.html). For example, to back up the data for Locale, you'd do something like the following: `adb pull /data/data/com.twoforty...
1,837
An entire cake is too much food (and temptation!) for me and my husband. Generally speaking, how do I halve a cake recipe? I have heard you can't just cut everything in half due to the way baking powder & soda react. A particular recipe I would like to cut in half is [Red Velvet Cake](http://www.justrightmenus.com/re...
2010/07/18
[ "https://cooking.stackexchange.com/questions/1837", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/364/" ]
I have halved cake recipes before without issue. The most complicated thing to worry about is halving an odd number of eggs, but [this question](https://cooking.stackexchange.com/questions/1610/how-do-you-halve-a-recipe-that-calls-for-1-egg) addresses that. The finished product was indistinguishable from the full recip...
I halve cake recipes quite often and just round up the number of eggs. So if the full recipe calls for 3 eggs, instead of trying to figure out 1 and 1/2 I put in 2. So far, so good.
65,851,068
Let's consider a dataset: | name | age | | --- | --- | | Max | 33 | | Adam | 32 | | Zim | 41 | | Muller | 62 | Now, if we run this query on dataset `x`: ``` x.as("a").join(x.as("b")).where( $"b.age" - $"a.age" <= 10 and $"a.age" > $"b.age").show() ``` | name | age | name | age | | --- | --- | -...
2021/01/22
[ "https://Stackoverflow.com/questions/65851068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5019169/" ]
Could you please try following, written and tested shown samples in GNU `awk`. ``` awk ' BEGIN{ FS="," } FNR==1{ if(count){ print count,prevFilename } count="" prevFilename=FILENAME } $NF>100{ ++count } END{ if(count){ print count,prevFilename } } ' file1 file2 ``` With shown samples output w...
Add a debugging line to your code: ``` BEGIN{FS=","} FNR==1 {filename=FILENAME; next} { if(NF == 3 && $3 > 100) { counter++ print "COUNTER:", counter, FILENAME, $0 # debugging } a[filename]=counter } END{ for(k in a){ print a[k], k } } ``` and examine the results: ```...
65,851,068
Let's consider a dataset: | name | age | | --- | --- | | Max | 33 | | Adam | 32 | | Zim | 41 | | Muller | 62 | Now, if we run this query on dataset `x`: ``` x.as("a").join(x.as("b")).where( $"b.age" - $"a.age" <= 10 and $"a.age" > $"b.age").show() ``` | name | age | name | age | | --- | --- | -...
2021/01/22
[ "https://Stackoverflow.com/questions/65851068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5019169/" ]
Could you please try following, written and tested shown samples in GNU `awk`. ``` awk ' BEGIN{ FS="," } FNR==1{ if(count){ print count,prevFilename } count="" prevFilename=FILENAME } $NF>100{ ++count } END{ if(count){ print count,prevFilename } } ' file1 file2 ``` With shown samples output w...
With GNU awk for ENDFILE: ``` $ awk -F, '(NF==3) && ($3>100){c++} ENDFILE{print c+0, FILENAME; c=0}' f1 f2 1 f1 3 f2 ```
65,851,068
Let's consider a dataset: | name | age | | --- | --- | | Max | 33 | | Adam | 32 | | Zim | 41 | | Muller | 62 | Now, if we run this query on dataset `x`: ``` x.as("a").join(x.as("b")).where( $"b.age" - $"a.age" <= 10 and $"a.age" > $"b.age").show() ``` | name | age | name | age | | --- | --- | -...
2021/01/22
[ "https://Stackoverflow.com/questions/65851068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5019169/" ]
Using `gnu-awk` it can be simplified to: ```sh awk -F, '$3 > 100 {++c} ENDFILE {print c, FILENAME; c=0}' f1 f2 1 f1 3 f2 ```
Add a debugging line to your code: ``` BEGIN{FS=","} FNR==1 {filename=FILENAME; next} { if(NF == 3 && $3 > 100) { counter++ print "COUNTER:", counter, FILENAME, $0 # debugging } a[filename]=counter } END{ for(k in a){ print a[k], k } } ``` and examine the results: ```...