qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
1,096,396
My use case is that I'm just making a website that I want people all over the world to be able to use, and I want to be able to say things like "This happened at 5:33pm on October 5" and also "This happened 5 minutes ago," etc. Should I use the datetime module? Or just strftime? Or something fancier that isn't part o...
2009/07/08
[ "https://Stackoverflow.com/questions/1096396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83898/" ]
Take a look at the dateutil module: <http://labix.org/python-dateutil> It's good at doing the types of things you're looking for - see some of the examples in the documentation.
I have always been very happy using the datetime package. You get a lot of stuff for free, and it's pretty easy to create datetime objects as well, calculate duration ect.
1,096,396
My use case is that I'm just making a website that I want people all over the world to be able to use, and I want to be able to say things like "This happened at 5:33pm on October 5" and also "This happened 5 minutes ago," etc. Should I use the datetime module? Or just strftime? Or something fancier that isn't part o...
2009/07/08
[ "https://Stackoverflow.com/questions/1096396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83898/" ]
Try [relativeDates Module](http://jehiah.cz/archive/printing-relative-dates-in-python) module. It exactly brings you the stuff you wanted.
I have always been very happy using the datetime package. You get a lot of stuff for free, and it's pretty easy to create datetime objects as well, calculate duration ect.
1,096,396
My use case is that I'm just making a website that I want people all over the world to be able to use, and I want to be able to say things like "This happened at 5:33pm on October 5" and also "This happened 5 minutes ago," etc. Should I use the datetime module? Or just strftime? Or something fancier that isn't part o...
2009/07/08
[ "https://Stackoverflow.com/questions/1096396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83898/" ]
You may have a look at Django's [humanize module](http://docs.djangoproject.com/en/dev/ref/contrib/humanize/#ref-contrib-humanize). It is part of Django, but I think it would be quite easy to adapt it to your needs.
The datetime module in Python will allow you to get/set/manipulate dates and times. A question about relative date formatting in Python has already been asked: [Stack Overflow Post](https://stackoverflow.com/questions/410221/natural-relative-days-in-python) but with very little responce.
1,096,396
My use case is that I'm just making a website that I want people all over the world to be able to use, and I want to be able to say things like "This happened at 5:33pm on October 5" and also "This happened 5 minutes ago," etc. Should I use the datetime module? Or just strftime? Or something fancier that isn't part o...
2009/07/08
[ "https://Stackoverflow.com/questions/1096396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83898/" ]
Try [relativeDates Module](http://jehiah.cz/archive/printing-relative-dates-in-python) module. It exactly brings you the stuff you wanted.
There is also the [Time module](http://docs.python.org/library/time.html).
51,643,987
I am using Keras TensorFlow 1.8 and having a memory leak in my gpu (1080 ti). After training the network, my memory is used even after closing python completely. In nvidia-smi it no longer shows the python but the memory usage is still there. I cannot restart the computer because other users are running processes (I ...
2018/08/02
[ "https://Stackoverflow.com/questions/51643987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6406073/" ]
Always ``` K.clear_session() ``` where K is defined as ``` from keras import backend as K ``` at the end of your processing. It prevents Tensorflow memory leakage. You could also try ``` import gc gc.collect() ``` or , from the beginning of your tf session, prevent tensorflow using the whole gpu power:...
After speding way too much trying to `keras.clear_session()` and `gc.collect()` my way through this, I gave up and created a reliable workaround. It's a decorator that allows to run a function in a separate script. It's called `scriptifier`, it installs via `pip install scriptifier` It automatically generates the scr...
646
Stoics believe that virtue (*ἀρετή*) is necessary and sufficient to achieve happiness (*εὐδαιμονία*). It was the "sufficient" portion that marked Stoics out from other ancient philosophy, but I suspect that modern philosophy finds problems even with the idea that virtue is necessary. In fact from my reading, [virtue et...
2011/06/27
[ "https://philosophy.stackexchange.com/questions/646", "https://philosophy.stackexchange.com", "https://philosophy.stackexchange.com/users/73/" ]
My answer is a bit long, so I'm going give you the short answer first. Virtue is a necessary condition of achieving eudaimonia. -------------------------------------------------------- However, this is different than the answer to the question as it was formulated at the end of your post, "Is there an argument that a...
Part of the answer to "why we lost the idea of virtue leading to a good life" came when Kant changed the moral question to what should the moral agent do, instead of what sort of person should the moral person be. Kant and Utilitarians like Sedgewick still had a virtue theory componenet to their moral philosophy, but t...
953,338
So my problem is simple I just need a solid answer so that I don't break the email service. I have two servers one for mail and other for the web service. The web server is responsible for the SSL certificates renewal (I'm using Let's Encrypt Certificate Authority). My DNS A record is mail.example.com and points to t...
2019/02/11
[ "https://serverfault.com/questions/953338", "https://serverfault.com", "https://serverfault.com/users/509507/" ]
You've created a [DNS round-robin](https://en.wikipedia.org/wiki/Round-robin_DNS). Do not create multiple A records with the same name unless you intend for them to point at the same service. There are other ways of solving what you are trying to do; for example by setting up a minimal web service on the mail server w...
Mickael is correct about the DNS round-robin. Another option is to validate the domain via DNS rather than an HTTP request. Check out [this link](https://docs.certifytheweb.com/docs/dns-validation.html) from Certify The Web that explains how to use their software to perform DNS validation. Then you can completely remov...
953,338
So my problem is simple I just need a solid answer so that I don't break the email service. I have two servers one for mail and other for the web service. The web server is responsible for the SSL certificates renewal (I'm using Let's Encrypt Certificate Authority). My DNS A record is mail.example.com and points to t...
2019/02/11
[ "https://serverfault.com/questions/953338", "https://serverfault.com", "https://serverfault.com/users/509507/" ]
This is the wrong approach for getting Let's Encrypt certificates for a mail server with no installed web server. Instead, you should use certbot's standalone plugin. With this, certbot starts its own built in temporary web server to perform the HTTP validation. You request a certificate for the name corresponding to...
Mickael is correct about the DNS round-robin. Another option is to validate the domain via DNS rather than an HTTP request. Check out [this link](https://docs.certifytheweb.com/docs/dns-validation.html) from Certify The Web that explains how to use their software to perform DNS validation. Then you can completely remov...
28,618,675
Based on my current understanding I do not think this code is thread safe but want to confirm. In other words I think that, although it would be extremely unlikely, multiple threads representing different HTTP requests could potentially mix up the value of the `_userName` property. ``` public class SomeClass { pri...
2015/02/19
[ "https://Stackoverflow.com/questions/28618675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/643842/" ]
Your second solution would work fine. The first one is **not thread safe at all**. Caching a value in a static variable exposes it to all threads, and if you have two or more simultaneous requests, it's highly likely they will read some other request's value. You think it's *extremely unlikely*, well... it's not, quite...
Your two examples are *very different*. You are right in that your first example is not thread safe, but the more important problem is that *it's not session-safe*. The first session that accesses `UserName` will set the username, and *all other sessions will use that same name*! `UserName` will not change until the Ap...
69,016,870
I am trying to analyse a dataframe where every row represents a timeseries. My df is structured as follows: ``` df <- data.frame(key = c("10A", "11xy", "445pe"), Obs1 = c(0, 22, 0), Obs2 = c(10, 0, 0), Obs3 = c(0, 3, 5), Obs4 = c(0, 10, 0) ) ``` I...
2021/09/01
[ "https://Stackoverflow.com/questions/69016870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13149216/" ]
There's actually nothing wrong with your code, other than a "typo" - but there's other stuff to consider. Fixing the typo ``` let filteredread = realm.objects(Book.self).filter({ $0.category == "read"}) ``` should be ``` let filteredread = realm.objects(Book.self).filter { $0.category == "read"} ``` note removin...
The way to filter Realm results according to a string property is : ``` let filteredResult = realm.objects(Model.self).filter("propertyName == %@", "value") ``` In your case it would be: ``` let filteredread = realm.objects(Book.self).filter("category == %@", "read") ```
309,600
**I suggest that new posts (questions and answers) should start at +3 votes by default** rather than at 0. This is meant to have no mechanical effect on the website. It is just a psychological display trick, with two effects: * Askers who have a question downvoted will not think *Wow, my question is so bad that it ha...
2018/04/29
[ "https://meta.stackexchange.com/questions/309600", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/243091/" ]
0 is a very neutral number. It means nothing, somewhat literally. It's a nice neutral starting point, even if many programming languages would rather start at 1. I shall avoid the obligatory monty python quote about 3. I think the problem with this proposal is a few things. Firstly, it does not help posters ask bette...
I would say it's a bad idea, also because it doesn't resolve the behind issues, and it would probably add more issues. There isn't any evidence that users stop down-voting when the score of a post is 3 or higher. Quite the opposite, in my experience, a blatantly wrong post that has a score of 3 has more chances to get...
16,261,174
I am parsing a JSON output asbelow...this is just a snippet..currently it is printing the u'' format...How do i just print "deleted" ``` error=change['Errors'] print error ``` Output: ``` [u'DELETED'] ``` Expected output: ``` DELETED ```
2013/04/28
[ "https://Stackoverflow.com/questions/16261174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2125827/" ]
I guess you're looking for something like: ``` def testsum(data): if not isinstance(data, list): data = [data] for i in map(int,data): print(i,i+20) ``` Note that it' usually not a good idea to design your functions like this. Better write two different functions, one for lists (iterables) a...
The pythonic way is always as close as possible to one line. ``` testsum = lambda data: data if isinstance(data,int) else sum([v*10**(len(data)-i) for i,v in enumerate(map(int,data),1)]) print(testsum(1)) print(testsum([2,3,4])) print(testsum("123")) print(testsum(['5','6'])) ``` Or un-one-lined: ``` def testsum(d...
23,692,943
for some reason when I run my app, instead of getting the name of the lecture, I get a bunch of random characters that show up. I'm not sure why though. Thanks in advance! ``` public Lecture(String lecturename) { this.lecturename = lecturename; listofwork = new ArrayList<Work>(); } public String toString(Lect...
2014/05/16
[ "https://Stackoverflow.com/questions/23692943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3155915/" ]
You are writing a `toString` that takes a `Lecture` as an argument, and calling `toString()` that takes no arguments. If you change your method definition to have no args, you will override the `Object.toString()` correctly. ``` public String toString() { return this.lecturename; } ``` If you do not want to chan...
When you do `test.toString()`, you're printing the \*test object itself \*, not a string representing the object. Because you didn't override `Object#toString()` (you overloaded it instead), your object inherits this implementation: ``` public String toString() { return getClass().getName() + "@" + Integer.toHexSt...
23,692,943
for some reason when I run my app, instead of getting the name of the lecture, I get a bunch of random characters that show up. I'm not sure why though. Thanks in advance! ``` public Lecture(String lecturename) { this.lecturename = lecturename; listofwork = new ArrayList<Work>(); } public String toString(Lect...
2014/05/16
[ "https://Stackoverflow.com/questions/23692943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3155915/" ]
You are writing a `toString` that takes a `Lecture` as an argument, and calling `toString()` that takes no arguments. If you change your method definition to have no args, you will override the `Object.toString()` correctly. ``` public String toString() { return this.lecturename; } ``` If you do not want to chan...
you may want to change your code like this ``` public Lecture(String lecturename) { this.lecturename = lecturename; listofwork = new ArrayList<Work>(); public String toString() { return this.lecturename; } } ```
23,692,943
for some reason when I run my app, instead of getting the name of the lecture, I get a bunch of random characters that show up. I'm not sure why though. Thanks in advance! ``` public Lecture(String lecturename) { this.lecturename = lecturename; listofwork = new ArrayList<Work>(); } public String toString(Lect...
2014/05/16
[ "https://Stackoverflow.com/questions/23692943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3155915/" ]
When you do `test.toString()`, you're printing the \*test object itself \*, not a string representing the object. Because you didn't override `Object#toString()` (you overloaded it instead), your object inherits this implementation: ``` public String toString() { return getClass().getName() + "@" + Integer.toHexSt...
you may want to change your code like this ``` public Lecture(String lecturename) { this.lecturename = lecturename; listofwork = new ArrayList<Work>(); public String toString() { return this.lecturename; } } ```
32,499,457
I wanted to insert values into database but it is not working eventhough my code perfectly working when its used as stored procedure. I am trieng to use button click to store the value. Please tell whats wrong with the code. Its not showing any error or exception but data is not getting updated in the table ``` protec...
2015/09/10
[ "https://Stackoverflow.com/questions/32499457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
> > my columns acnum and shares\_bought are "int" and scripname is > "varchar" > > > Then you will not need single quotes for your integer values. Use it as; ``` ...VALUES (12, 'abcd', 20)" ``` A few things more; * Use `using` statement to dispose your connection and command automatically instead of calling `...
Set breakpoint in code and see if code is executing. In case you don't know how to, see [here](https://msdn.microsoft.com/en-us/library/vstudio/k80ex6de(v=vs.100).aspx). As you are not getting any exception on insert statement and it's not reflecting in database, either you have different connection string or your code...
49,149,533
I am working on a Visual Studio MVC project. (Version = 2013 ) When I try to write any javascript code in .js file or .cshtml file Visual Studio crashing and restarting. When I open **Menu > Tools > Options > Text Editor > Javascript** menu and disable "Auto list members" and "Parameter information" the problem is so...
2018/03/07
[ "https://Stackoverflow.com/questions/49149533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8460889/" ]
Restart Visual Studio in Administrator mode. If the same issue still occurs, try to move your project to another directory.
I had same problem few months ago, I could not find the answer so I tried to install another version of VS. Installing Visual Studio 2017 solved it.
49,149,533
I am working on a Visual Studio MVC project. (Version = 2013 ) When I try to write any javascript code in .js file or .cshtml file Visual Studio crashing and restarting. When I open **Menu > Tools > Options > Text Editor > Javascript** menu and disable "Auto list members" and "Parameter information" the problem is so...
2018/03/07
[ "https://Stackoverflow.com/questions/49149533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8460889/" ]
I'm using Resharper and had the same problem, the solution whas to deactivate Intellisense in Resharper => Options => Environment => IntelliSense => General for .js files
I had same problem few months ago, I could not find the answer so I tried to install another version of VS. Installing Visual Studio 2017 solved it.
49,149,533
I am working on a Visual Studio MVC project. (Version = 2013 ) When I try to write any javascript code in .js file or .cshtml file Visual Studio crashing and restarting. When I open **Menu > Tools > Options > Text Editor > Javascript** menu and disable "Auto list members" and "Parameter information" the problem is so...
2018/03/07
[ "https://Stackoverflow.com/questions/49149533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8460889/" ]
I'm using Resharper and had the same problem, the solution whas to deactivate Intellisense in Resharper => Options => Environment => IntelliSense => General for .js files
Restart Visual Studio in Administrator mode. If the same issue still occurs, try to move your project to another directory.
20,310,782
EDIT: Look at the checkmarked answer comments to get your issue solved. Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following: ``` service mysqld start ``` Also When I type: mysql I get: ``` ERROR 2002 (HY000): Can't connect to...
2013/12/01
[ "https://Stackoverflow.com/questions/20310782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2803905/" ]
You may need free up some space from root (/) partition. Stop mysql process by: ``` /etc/init.d/mysql stop ``` Delete an unused database from mySql by command: ``` rm -rf [Database-Directory] ``` Execute it in `/var/lib/mysql`. Now if you run `df -h`, you may confused by still full space. For removing the unused ...
what helped me was to add the following lines to /etc/my.cnf ``` innodb_force_recovery=4 ``` and then `sudo service mysqld start` worked like charm
20,310,782
EDIT: Look at the checkmarked answer comments to get your issue solved. Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following: ``` service mysqld start ``` Also When I type: mysql I get: ``` ERROR 2002 (HY000): Can't connect to...
2013/12/01
[ "https://Stackoverflow.com/questions/20310782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2803905/" ]
You may need free up some space from root (/) partition. Stop mysql process by: ``` /etc/init.d/mysql stop ``` Delete an unused database from mySql by command: ``` rm -rf [Database-Directory] ``` Execute it in `/var/lib/mysql`. Now if you run `df -h`, you may confused by still full space. For removing the unused ...
Reference here [2.10.2.1 Troubleshooting Problems Starting the MySQL Server](https://dev.mysql.com/doc/refman/5.7/en/starting-server-troubleshooting.html). 1.Find the **data directory** ,it was configured in my.cnf. ``` [mysqld] datadir=/var/lib/mysql ``` 2. Check the err file,it log the error message about why my...
20,310,782
EDIT: Look at the checkmarked answer comments to get your issue solved. Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following: ``` service mysqld start ``` Also When I type: mysql I get: ``` ERROR 2002 (HY000): Can't connect to...
2013/12/01
[ "https://Stackoverflow.com/questions/20310782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2803905/" ]
Try restarting apache `sudo service httpd restart`. Worked for me.
Reference here [2.10.2.1 Troubleshooting Problems Starting the MySQL Server](https://dev.mysql.com/doc/refman/5.7/en/starting-server-troubleshooting.html). 1.Find the **data directory** ,it was configured in my.cnf. ``` [mysqld] datadir=/var/lib/mysql ``` 2. Check the err file,it log the error message about why my...
20,310,782
EDIT: Look at the checkmarked answer comments to get your issue solved. Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following: ``` service mysqld start ``` Also When I type: mysql I get: ``` ERROR 2002 (HY000): Can't connect to...
2013/12/01
[ "https://Stackoverflow.com/questions/20310782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2803905/" ]
You may need free up some space from root (/) partition. Stop mysql process by: ``` /etc/init.d/mysql stop ``` Delete an unused database from mySql by command: ``` rm -rf [Database-Directory] ``` Execute it in `/var/lib/mysql`. Now if you run `df -h`, you may confused by still full space. For removing the unused ...
It may be a permission issue, Please try the following command `/etc/init.d/mysqld start` as root user.
20,310,782
EDIT: Look at the checkmarked answer comments to get your issue solved. Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following: ``` service mysqld start ``` Also When I type: mysql I get: ``` ERROR 2002 (HY000): Can't connect to...
2013/12/01
[ "https://Stackoverflow.com/questions/20310782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2803905/" ]
Yet another tip that worked for me. Run the command: ``` $ mysql_install_db ```
what helped me was to add the following lines to /etc/my.cnf ``` innodb_force_recovery=4 ``` and then `sudo service mysqld start` worked like charm
20,310,782
EDIT: Look at the checkmarked answer comments to get your issue solved. Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following: ``` service mysqld start ``` Also When I type: mysql I get: ``` ERROR 2002 (HY000): Can't connect to...
2013/12/01
[ "https://Stackoverflow.com/questions/20310782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2803905/" ]
I had the same issue happening. When I checked the error.log I found that my disk was full. Use: ``` df -h ``` on the command line. it will tell you how much space you have left. mine was full. found my error.log file was 4.77GB. I downloaded it and then deleted it. Then I used service mysqld start and it worked...
RE: MySQL Daemon Failed to Start - centos 6 / RHEL 6 1. Yum Install MySQL 2. /etc/init.d/mysqld start MySQL Daemon failed to start. Starting mysqld: [FAILED] 3. Review The log: /var/log/mysqld.log 4. You might get this error: [ERROR] Can't open the mysql.plugin table. Please run mysql\_upgrade to create it. Solution ...
20,310,782
EDIT: Look at the checkmarked answer comments to get your issue solved. Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following: ``` service mysqld start ``` Also When I type: mysql I get: ``` ERROR 2002 (HY000): Can't connect to...
2013/12/01
[ "https://Stackoverflow.com/questions/20310782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2803905/" ]
The most likely cause for this error is that your mysql server is not running. When you type in `mysql` you are executing mysql client. Try: ``` # sudo service mysql start # mysql ``` **Update** (after OP included log in the question; taken from the comments below): > > Thanks, saw your log. The log is saying ...
You may need free up some space from root (/) partition. Stop mysql process by: ``` /etc/init.d/mysql stop ``` Delete an unused database from mySql by command: ``` rm -rf [Database-Directory] ``` Execute it in `/var/lib/mysql`. Now if you run `df -h`, you may confused by still full space. For removing the unused ...
20,310,782
EDIT: Look at the checkmarked answer comments to get your issue solved. Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following: ``` service mysqld start ``` Also When I type: mysql I get: ``` ERROR 2002 (HY000): Can't connect to...
2013/12/01
[ "https://Stackoverflow.com/questions/20310782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2803905/" ]
``` /etc/init.d/mysqld stop mysqld_safe --skip-grant-tables & mysql_upgrade /etc/init.d/mysqld stop /etc/init.d/mysqld start ```
It may be a permission issue, Please try the following command `/etc/init.d/mysqld start` as root user.
20,310,782
EDIT: Look at the checkmarked answer comments to get your issue solved. Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following: ``` service mysqld start ``` Also When I type: mysql I get: ``` ERROR 2002 (HY000): Can't connect to...
2013/12/01
[ "https://Stackoverflow.com/questions/20310782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2803905/" ]
The most likely cause for this error is that your mysql server is not running. When you type in `mysql` you are executing mysql client. Try: ``` # sudo service mysql start # mysql ``` **Update** (after OP included log in the question; taken from the comments below): > > Thanks, saw your log. The log is saying ...
run this : ``` chown -R mysql:mysql /var/lib/mysql ``` and try again!
20,310,782
EDIT: Look at the checkmarked answer comments to get your issue solved. Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following: ``` service mysqld start ``` Also When I type: mysql I get: ``` ERROR 2002 (HY000): Can't connect to...
2013/12/01
[ "https://Stackoverflow.com/questions/20310782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2803905/" ]
Try restarting apache `sudo service httpd restart`. Worked for me.
For those who will be here in the future, if all above methods are not working, check the my.cnf file by: ``` $ sudo gedit /etc/my.cnf ``` Find the line start with: ``` bind-address=[an-IP-address] ``` Check if the IP address after the equal sign is correct. If you don't even know what the IP is, just use localho...
3,581,523
I'm writing a function that gets passed a pointer to an array of length 4. This array will contain integers `0 <= x <= 52` and I would like to construct an array of length 48 with every integer from da kine that's not in the passed in array. In python this would be ``` # just included for specificity cards = [card for...
2010/08/27
[ "https://Stackoverflow.com/questions/3581523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376728/" ]
Sure, your example is fine for a hand size of only 4 - it's clear enough. In situations where the arrays were much larger, then more efficient algorithms based on various kinds of sorting could be used. For example, a radix sort eliminates the nested loops: ``` int i, j; int card_in_hand[52] = { 0 }; int cards[48]; ...
Could this be done this way? ``` cards_in_deck[48]={1}; for (int i=0;i<4;i++) cards_in_deck[hand[i]]=0; ``` The cards\_in\_deck is an array with value of 1 for those that are not in the deck. Is this what you are looking for ?
3,581,523
I'm writing a function that gets passed a pointer to an array of length 4. This array will contain integers `0 <= x <= 52` and I would like to construct an array of length 48 with every integer from da kine that's not in the passed in array. In python this would be ``` # just included for specificity cards = [card for...
2010/08/27
[ "https://Stackoverflow.com/questions/3581523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376728/" ]
Could this be done this way? ``` cards_in_deck[48]={1}; for (int i=0;i<4;i++) cards_in_deck[hand[i]]=0; ``` The cards\_in\_deck is an array with value of 1 for those that are not in the deck. Is this what you are looking for ?
Here's the little test program I put together to solve this one. It creates a set to show which cards are selected and scans through the set to build the array of the cards that are left. ``` #include <stdio.h> #include <string.h> int main(int argc, char **argv) { int cardsSelected[4] = {3,7,10,49} ; int car...
3,581,523
I'm writing a function that gets passed a pointer to an array of length 4. This array will contain integers `0 <= x <= 52` and I would like to construct an array of length 48 with every integer from da kine that's not in the passed in array. In python this would be ``` # just included for specificity cards = [card for...
2010/08/27
[ "https://Stackoverflow.com/questions/3581523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376728/" ]
Could this be done this way? ``` cards_in_deck[48]={1}; for (int i=0;i<4;i++) cards_in_deck[hand[i]]=0; ``` The cards\_in\_deck is an array with value of 1 for those that are not in the deck. Is this what you are looking for ?
In C, iterate over the sorted cards in hand: ``` int cards_in_deck[48]; const int ranges[6][2] = { {0, hand[0]}, {hand[0] + 1, hand[1]}, {hand[1] + 1, hand[2]}, {hand[2] + 1, hand[3]}, {hand[3] + 1, hand[4]}, {hand[4] + 1, 52} }; int j = 0; for (int i = 0; i < sizeof(ranges)/sizeof(r...
3,581,523
I'm writing a function that gets passed a pointer to an array of length 4. This array will contain integers `0 <= x <= 52` and I would like to construct an array of length 48 with every integer from da kine that's not in the passed in array. In python this would be ``` # just included for specificity cards = [card for...
2010/08/27
[ "https://Stackoverflow.com/questions/3581523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376728/" ]
Sure, your example is fine for a hand size of only 4 - it's clear enough. In situations where the arrays were much larger, then more efficient algorithms based on various kinds of sorting could be used. For example, a radix sort eliminates the nested loops: ``` int i, j; int card_in_hand[52] = { 0 }; int cards[48]; ...
Here's the little test program I put together to solve this one. It creates a set to show which cards are selected and scans through the set to build the array of the cards that are left. ``` #include <stdio.h> #include <string.h> int main(int argc, char **argv) { int cardsSelected[4] = {3,7,10,49} ; int car...
3,581,523
I'm writing a function that gets passed a pointer to an array of length 4. This array will contain integers `0 <= x <= 52` and I would like to construct an array of length 48 with every integer from da kine that's not in the passed in array. In python this would be ``` # just included for specificity cards = [card for...
2010/08/27
[ "https://Stackoverflow.com/questions/3581523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376728/" ]
Sure, your example is fine for a hand size of only 4 - it's clear enough. In situations where the arrays were much larger, then more efficient algorithms based on various kinds of sorting could be used. For example, a radix sort eliminates the nested loops: ``` int i, j; int card_in_hand[52] = { 0 }; int cards[48]; ...
In C, iterate over the sorted cards in hand: ``` int cards_in_deck[48]; const int ranges[6][2] = { {0, hand[0]}, {hand[0] + 1, hand[1]}, {hand[1] + 1, hand[2]}, {hand[2] + 1, hand[3]}, {hand[3] + 1, hand[4]}, {hand[4] + 1, 52} }; int j = 0; for (int i = 0; i < sizeof(ranges)/sizeof(r...
117,090
I am trying to *recreate* the following kind of **static** picture (*particles positioned in a circle, with some kind of "motion trail" behind them to indicate a velocity*) using Blender v2.79 and the Cycles render engine : [![enter image description here](https://i.stack.imgur.com/IP3Eg.png)](https://i.stack.imgur.co...
2018/08/28
[ "https://blender.stackexchange.com/questions/117090", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/61721/" ]
I took a look at the given answers, and here want to show you how I solved this question in the end. --- @risingfall 's answer worked but has the downside that the trail only extent in certain directions relative to the particle object. Also, if I would like to change the molecule to another one later on, I would hav...
In many cases, Blender artists use animations just so they can get a still frame that looks the way they want. So @Duarte Farrajota Ramos' suggestions would still be useful for you. Another way to go that is static in nature, but maybe less flexible/realistic, would be to actually add the "tail" to the particle object...
5,083,989
I have some dedicated servers running ASP.NET applications over internet. All servers are fully trusted (all belongs to the same company) and need to communicate to each other in a secure way. They are not part of a domain or work group and should not be. Each server acts as both client and server of some `WCF` servic...
2011/02/22
[ "https://Stackoverflow.com/questions/5083989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/313421/" ]
``` select quotename(s.name)+'.'+quotename(o.name) as object_name, o.type_desc from sys.sql_modules m inner join sys.objects o on m.object_id = o.object_id and o.type = 'P' /* stored procuedure */ inner join sys.schemas s on o.schema_id = s.schema_id whe...
I think this will work for you ``` SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_DEFINITION LIKE '%lq_Campaign%' AND ROUTINE_TYPE='PROCEDURE' ``` Here is the a [link](http://stevesmithblog.com/blog/search-stored-procedures/) I found on it.
5,083,989
I have some dedicated servers running ASP.NET applications over internet. All servers are fully trusted (all belongs to the same company) and need to communicate to each other in a secure way. They are not part of a domain or work group and should not be. Each server acts as both client and server of some `WCF` servic...
2011/02/22
[ "https://Stackoverflow.com/questions/5083989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/313421/" ]
Grab yourself a copy of the **free** [Red-Gate SQL Search](http://www.red-gate.com/products/sql-development/sql-search/) tool and start enjoying searching in SQL Server! :-) ![enter image description here](https://i.stack.imgur.com/qCjKb.png) It's a great and very useful tool, and **YES!** it's totally, absolutely FR...
``` select quotename(s.name)+'.'+quotename(o.name) as object_name, o.type_desc from sys.sql_modules m inner join sys.objects o on m.object_id = o.object_id and o.type = 'P' /* stored procuedure */ inner join sys.schemas s on o.schema_id = s.schema_id whe...
5,083,989
I have some dedicated servers running ASP.NET applications over internet. All servers are fully trusted (all belongs to the same company) and need to communicate to each other in a secure way. They are not part of a domain or work group and should not be. Each server acts as both client and server of some `WCF` servic...
2011/02/22
[ "https://Stackoverflow.com/questions/5083989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/313421/" ]
Grab yourself a copy of the **free** [Red-Gate SQL Search](http://www.red-gate.com/products/sql-development/sql-search/) tool and start enjoying searching in SQL Server! :-) ![enter image description here](https://i.stack.imgur.com/qCjKb.png) It's a great and very useful tool, and **YES!** it's totally, absolutely FR...
I think this will work for you ``` SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_DEFINITION LIKE '%lq_Campaign%' AND ROUTINE_TYPE='PROCEDURE' ``` Here is the a [link](http://stevesmithblog.com/blog/search-stored-procedures/) I found on it.
44,743,105
I have created a fileSearch program in pycharm and I would like to run it in my command line using arguments from the user. ``` import os from os.path import join lookfor = "*insert file name*" for root, dirs, files in os.walk("*choose directory*"): print("searching"), root if lookfor in files: print "Found %s" ...
2017/06/25
[ "https://Stackoverflow.com/questions/44743105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7835910/" ]
Firstly, [`props` are read-only](https://facebook.github.io/react/docs/components-and-props.html#props-are-read-only) and a component should never be update it's own `props`, so lines like ``` componentWillMount() { this.props.header = <header>Base Page</header> } ``` should not be used. [`defaultProps`](https:/...
This seems like a great use case for [`React.cloneElement`](https://facebook.github.io/react/docs/react-api.html#cloneelement). `React.cloneElement(this.props.header, { title: this.props.title });` It returns a clone of the component with the new props included.
11,379,150
``` -(IBAction)showCountryInfo:(id)sender { @try { CountryProperties *countryProperties=[self.storyboard instantiateViewControllerWithIdentifier:@"Culture"]; countryProperties.countryID=self.countryID; countryProperties.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self.navigationControl...
2012/07/07
[ "https://Stackoverflow.com/questions/11379150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/715999/" ]
What exactly inside the @try is throwing an exception? Exception handling in Objective-C is generally frowned upon for error handling. The [Objective-C Programming Language docs](http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/objectivec/Chapters/ocExceptionHandling.html) say: > > Exceptions ar...
Lots of drawing things have to happen on the main thread. You might find your answer if you move your alert view code to its own method, and in your @catch you call: ``` [self performSelectorOnMainThread:@selector(myAlertMethod) withObject:nil waitUntilDone:NO]; ``` ...where myAlertMethod is the method that you move...
4,286,801
I expected the following output: ``` Running TestSuite [DEBUG] beforeClass [DEBUG] beforeTest [DEBUG] test [DEBUG] afterTest [DEBUG] beforeTest [DEBUG] test [DEBUG] afterTest [DEBUG] afterClass ``` But instead, this actually happens. Notice 2 problems: BeforeClass runs *after* BeforeTest. Second, Before/AfterTest ru...
2010/11/26
[ "https://Stackoverflow.com/questions/4286801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383132/" ]
Stupid me. Confused After/BeforeTest with After/BeforeMethod. ``` [DEBUG] beforeClass [DEBUG] beforeMethod [DEBUG] test [DEBUG] afterMethod [DEBUG] beforeMethod [DEBUG] test [DEBUG] afterMethod [DEBUG] afterClass ``` Replacing After/BeforeTest produced the correct exec ordering. ``` @BeforeClass public stat...
Correct. @BeforeTest/@AfterTest wrap a tag, not a test method.
2,478,790
Is there a way to return a point for a string within a text box? I found a COM function [GetTextExtentPoint](http://msdn.microsoft.com/en-us/library/dd144937(VS.85).aspx) that will return the length of a string, but I want to know the point where the string starts.
2010/03/19
[ "https://Stackoverflow.com/questions/2478790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274697/" ]
You're looking for the [`GetPositionFromCharIndex`](http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.getpositionfromcharindex.aspx) method.
First, figure out the index of the first character of the string. ``` int index = textBox1.Text.IndexOf(someString); ``` Then use GetPositionFromCharIndex. ``` Point stringPos = textBox1.GetPositionFromCharIndex(index); ``` (Code not tested, but something like this should work. Of course you will have to deal wit...
2,478,790
Is there a way to return a point for a string within a text box? I found a COM function [GetTextExtentPoint](http://msdn.microsoft.com/en-us/library/dd144937(VS.85).aspx) that will return the length of a string, but I want to know the point where the string starts.
2010/03/19
[ "https://Stackoverflow.com/questions/2478790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274697/" ]
First, figure out the index of the first character of the string. ``` int index = textBox1.Text.IndexOf(someString); ``` Then use GetPositionFromCharIndex. ``` Point stringPos = textBox1.GetPositionFromCharIndex(index); ``` (Code not tested, but something like this should work. Of course you will have to deal wit...
what comes to mi mind is to take a snapshot of both the form and text then do some fancy image comparing to find the starting point.. but for this you need to write/download a library that has theese comparing methods... thus becoming very complicated... why do you need to do this?
2,478,790
Is there a way to return a point for a string within a text box? I found a COM function [GetTextExtentPoint](http://msdn.microsoft.com/en-us/library/dd144937(VS.85).aspx) that will return the length of a string, but I want to know the point where the string starts.
2010/03/19
[ "https://Stackoverflow.com/questions/2478790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274697/" ]
You're looking for the [`GetPositionFromCharIndex`](http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.getpositionfromcharindex.aspx) method.
what comes to mi mind is to take a snapshot of both the form and text then do some fancy image comparing to find the starting point.. but for this you need to write/download a library that has theese comparing methods... thus becoming very complicated... why do you need to do this?
63,586,847
below is a list with some file names. Each file contains the name of a 3D object and has a version number. I wrote some Python code to extract only the filenames with the highest version number of each object: ``` def list_all_objects(filenames_list): all_objects = [] for name in filenames_list: objec...
2020/08/25
[ "https://Stackoverflow.com/questions/63586847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4498096/" ]
You could take a sorting of the indices and build a new array based in the indices. ```js var data = [0, 1, 3, 2, 1, 5, 1, 4, 2, 3, 4, 2], indices = [], result = []; for (let i = 0; i < data.length; i += 2) indices.push(i); indices.sort((a, b) => data[a] - data[b]); for (let i of indices) result.push(data[i...
Just for fun though because I don't believe this is gonna be faster that your existing solution - you can use proxy and iterators to make Array-like object which returns every second member: ```js var input = [500,400,300,200,100]; var proxy = new Proxy(input, { get(target, name) { if (name === 'length') ...
507,516
I am not too familiar with particle physics, so maybe I missed something. Typical scattering targets seem to be nuclei, protons, electrons, i.e. stable targets, which of course makes some sense. Have there ever been scattering experiments involving two (moderately) unstable partners, e.g. muon - muon or muon-charged pi...
2019/10/10
[ "https://physics.stackexchange.com/questions/507516", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/239506/" ]
The problem with fixed-target experiments it that you have to *make* the target, then *install* the target, then *irradiate* the target with your beam. If your target is short-lived, the timescale for each of these steps becomes more challenging. For example, in [positron-emission tomography](https://en.wikipedia.org/...
There are other forms of baryonic matter besides the ones you've listed, e.g., white dwarfs and neutron stars. There are cases where particle physicists have gotten useful bounds on certain observables from this. For example, Giddings and Mangano rule out certain scenarios involving large extra dimensions because micro...
32,809,406
I'm new with Hadoop and playing around with the `WordCount` example. I ran into an issue that is confusing me. If I take word count from a text file and I want to, for example, filter it in a such way that only words longer than 5 letters are in the output, do I have to run 2 jobs to do this? The first job to do the ...
2015/09/27
[ "https://Stackoverflow.com/questions/32809406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4091751/" ]
**fields.selection** A field which allows the user to make a selection between various predefined values. Syntax: ``` fields.selection([('value','display'), ('value','display')], 'Title' [, Optional Parameters]), ``` Format of the selection parameter: list of tuples of strings of the form: ``` ...
Thanks for the help. I use this code now and, for the moment, it's work. ``` def _buscar_compresor(self, cr, uid, ids, power, arg, context=None): aux1={} for record in self.browse(cr, uid, ids): aux1= record.power records = self.browse(cr, uid, ids) obj = self.pool.get('compresores.datos') ...
18,373,318
<http://www.mywebsite/product-tag/animal/> How to I echo animal without the backslash and in big caps like this: ANIMAL
2013/08/22
[ "https://Stackoverflow.com/questions/18373318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1616846/" ]
There may be a few things to check to make sure that this is running. Are you sure that `app_production.sql` contains a correct dump? Or is the file created without any content? Also try using `command` instead of `system`. I think `command` is a whenever command where `system` is ruby. ``` every 59.minutes do comma...
I already get this problem. the solution is : ``` set :output, "/output_path/app_production.sql" set :environment, 'production' every 59.minute do command "mysqldump -u root -ppassword app_production" # runner "MyModel.some_method" # rake "some:great:rake:task" end ``` after running the command, take a look...
163,014
How to downgrade Magento 2.1 to magento 1.9? How to do that automatically instead of obvious export/import path? Looking for an expert opinion, please no 'why do you need that?' questions.
2017/03/06
[ "https://magento.stackexchange.com/questions/163014", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/39924/" ]
You can find the default product list page in the below directory: **Magento\vendor\magento\module-catalog\view\frontend\templates** If you want to override the product list page according to your custom design, follow the below steps as per the [referenced](http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/t...
Please follow the below directory to get default product list page in Magento 2, ``` magento2\vendor\magento\module-catalog\view\frontend\templates\product ``` f you want the change to be effective in product list page then you have to make a custom theme to override default product list page, please create the belo...
74,017,542
I have been trying to create a button that shows the text "copy to clipboard" initially, after clicking the text is copied to the clipboard and the button changes the innerHTMl text to "Copied!" and the button background changes to green. now, the button should reset to the text "copy to clipboard" and color also. ```...
2022/10/10
[ "https://Stackoverflow.com/questions/74017542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18011988/" ]
Wrap it with Media Query so it doesn't work on Mobile and tablet. ``` header .nav-container nav ul li:hover ul { display: block; } ```
This is only one of many possible solutions, but I think it gives you an idea off how to solve the problem. First you have to wrap following selector with a media query to disable the hover when your mobile button shows up. In your case it would look like this: ``` @media only screen and (min-width: 601px) { head...
3,641,154
I'm a jQuery noob and I'm trying to figure out how to trap the tab selected event. Using jQuery 1.2.3 and corresponding jQuery UI tabs (not my choice and I have no control over it). It's a nested tab with the first level div name - tabs. This is how I initialized the tabs ``` $(function() { $('#tabs ul').tabs()...
2010/09/04
[ "https://Stackoverflow.com/questions/3641154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/439473/" ]
From what I can tell, per the documentation here: <http://jqueryui.com/demos/tabs/#event-select>, it seems as though you're not quite initializing it right. The demos state that you need a main wrapped `<div>` element, with a `<ul>` or possibly `<ol>` element representing the tabs, and then an element for each tab page...
Simply use the on click event for tab shown. ``` $(document).on('shown.bs.tab', 'a[href="#tab"]', function (){ }); ```
3,641,154
I'm a jQuery noob and I'm trying to figure out how to trap the tab selected event. Using jQuery 1.2.3 and corresponding jQuery UI tabs (not my choice and I have no control over it). It's a nested tab with the first level div name - tabs. This is how I initialized the tabs ``` $(function() { $('#tabs ul').tabs()...
2010/09/04
[ "https://Stackoverflow.com/questions/3641154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/439473/" ]
This post shows a complete working HTML file as an example of triggering code to run when a tab is clicked. The .on() method is now the way that jQuery suggests that you handle events. [jQuery development history](http://learn.jquery.com/events/history-of-events/) To make something happen when the user clicks a tab c...
From what I can tell, per the documentation here: <http://jqueryui.com/demos/tabs/#event-select>, it seems as though you're not quite initializing it right. The demos state that you need a main wrapped `<div>` element, with a `<ul>` or possibly `<ol>` element representing the tabs, and then an element for each tab page...
3,641,154
I'm a jQuery noob and I'm trying to figure out how to trap the tab selected event. Using jQuery 1.2.3 and corresponding jQuery UI tabs (not my choice and I have no control over it). It's a nested tab with the first level div name - tabs. This is how I initialized the tabs ``` $(function() { $('#tabs ul').tabs()...
2010/09/04
[ "https://Stackoverflow.com/questions/3641154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/439473/" ]
This post shows a complete working HTML file as an example of triggering code to run when a tab is clicked. The .on() method is now the way that jQuery suggests that you handle events. [jQuery development history](http://learn.jquery.com/events/history-of-events/) To make something happen when the user clicks a tab c...
Simply: ``` $("#tabs_div").tabs(); $("#tabs_div").on("click", "a.tab_a", function(){ console.log("selected tab id: " + $(this).attr("href")); console.log("selected tab name: " + $(this).find("span").text()); }); ``` But you have to add class name to your anchors named "tab\_a": ``` <div id="tabs"> <UL> ...
3,641,154
I'm a jQuery noob and I'm trying to figure out how to trap the tab selected event. Using jQuery 1.2.3 and corresponding jQuery UI tabs (not my choice and I have no control over it). It's a nested tab with the first level div name - tabs. This is how I initialized the tabs ``` $(function() { $('#tabs ul').tabs()...
2010/09/04
[ "https://Stackoverflow.com/questions/3641154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/439473/" ]
In later versions of JQuery they have changed the function from select to activate. <http://api.jqueryui.com/tabs/#event-activate>
Simply use the on click event for tab shown. ``` $(document).on('shown.bs.tab', 'a[href="#tab"]', function (){ }); ```
3,641,154
I'm a jQuery noob and I'm trying to figure out how to trap the tab selected event. Using jQuery 1.2.3 and corresponding jQuery UI tabs (not my choice and I have no control over it). It's a nested tab with the first level div name - tabs. This is how I initialized the tabs ``` $(function() { $('#tabs ul').tabs()...
2010/09/04
[ "https://Stackoverflow.com/questions/3641154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/439473/" ]
The correct method for capturing tab selection event is to set a function as the value for the `select` option when initializing the tabs (you can also set them dynamically afterwards), like so: ``` $('#tabs, #fragment-1').tabs({ select: function(event, ui){ // Do stuff here } }); ``` You can see the actual...
From what I can tell, per the documentation here: <http://jqueryui.com/demos/tabs/#event-select>, it seems as though you're not quite initializing it right. The demos state that you need a main wrapped `<div>` element, with a `<ul>` or possibly `<ol>` element representing the tabs, and then an element for each tab page...
3,641,154
I'm a jQuery noob and I'm trying to figure out how to trap the tab selected event. Using jQuery 1.2.3 and corresponding jQuery UI tabs (not my choice and I have no control over it). It's a nested tab with the first level div name - tabs. This is how I initialized the tabs ``` $(function() { $('#tabs ul').tabs()...
2010/09/04
[ "https://Stackoverflow.com/questions/3641154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/439473/" ]
it seems the old's version's of jquery ui don't support select event anymore. This code will work with new versions: ``` $('.selector').tabs({ activate: function(event ,ui){ //console.log(event); console.log(ui.newTab.index()); } ...
Simply: ``` $("#tabs_div").tabs(); $("#tabs_div").on("click", "a.tab_a", function(){ console.log("selected tab id: " + $(this).attr("href")); console.log("selected tab name: " + $(this).find("span").text()); }); ``` But you have to add class name to your anchors named "tab\_a": ``` <div id="tabs"> <UL> ...
3,641,154
I'm a jQuery noob and I'm trying to figure out how to trap the tab selected event. Using jQuery 1.2.3 and corresponding jQuery UI tabs (not my choice and I have no control over it). It's a nested tab with the first level div name - tabs. This is how I initialized the tabs ``` $(function() { $('#tabs ul').tabs()...
2010/09/04
[ "https://Stackoverflow.com/questions/3641154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/439473/" ]
it seems the old's version's of jquery ui don't support select event anymore. This code will work with new versions: ``` $('.selector').tabs({ activate: function(event ,ui){ //console.log(event); console.log(ui.newTab.index()); } ...
From what I can tell, per the documentation here: <http://jqueryui.com/demos/tabs/#event-select>, it seems as though you're not quite initializing it right. The demos state that you need a main wrapped `<div>` element, with a `<ul>` or possibly `<ol>` element representing the tabs, and then an element for each tab page...
3,641,154
I'm a jQuery noob and I'm trying to figure out how to trap the tab selected event. Using jQuery 1.2.3 and corresponding jQuery UI tabs (not my choice and I have no control over it). It's a nested tab with the first level div name - tabs. This is how I initialized the tabs ``` $(function() { $('#tabs ul').tabs()...
2010/09/04
[ "https://Stackoverflow.com/questions/3641154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/439473/" ]
The correct method for capturing tab selection event is to set a function as the value for the `select` option when initializing the tabs (you can also set them dynamically afterwards), like so: ``` $('#tabs, #fragment-1').tabs({ select: function(event, ui){ // Do stuff here } }); ``` You can see the actual...
This post shows a complete working HTML file as an example of triggering code to run when a tab is clicked. The .on() method is now the way that jQuery suggests that you handle events. [jQuery development history](http://learn.jquery.com/events/history-of-events/) To make something happen when the user clicks a tab c...
3,641,154
I'm a jQuery noob and I'm trying to figure out how to trap the tab selected event. Using jQuery 1.2.3 and corresponding jQuery UI tabs (not my choice and I have no control over it). It's a nested tab with the first level div name - tabs. This is how I initialized the tabs ``` $(function() { $('#tabs ul').tabs()...
2010/09/04
[ "https://Stackoverflow.com/questions/3641154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/439473/" ]
Simply: ``` $("#tabs_div").tabs(); $("#tabs_div").on("click", "a.tab_a", function(){ console.log("selected tab id: " + $(this).attr("href")); console.log("selected tab name: " + $(this).find("span").text()); }); ``` But you have to add class name to your anchors named "tab\_a": ``` <div id="tabs"> <UL> ...
Simply use the on click event for tab shown. ``` $(document).on('shown.bs.tab', 'a[href="#tab"]', function (){ }); ```
3,641,154
I'm a jQuery noob and I'm trying to figure out how to trap the tab selected event. Using jQuery 1.2.3 and corresponding jQuery UI tabs (not my choice and I have no control over it). It's a nested tab with the first level div name - tabs. This is how I initialized the tabs ``` $(function() { $('#tabs ul').tabs()...
2010/09/04
[ "https://Stackoverflow.com/questions/3641154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/439473/" ]
it seems the old's version's of jquery ui don't support select event anymore. This code will work with new versions: ``` $('.selector').tabs({ activate: function(event ,ui){ //console.log(event); console.log(ui.newTab.index()); } ...
Simply use the on click event for tab shown. ``` $(document).on('shown.bs.tab', 'a[href="#tab"]', function (){ }); ```
49,463,096
I'm trying to validate user login token when the app start, the app should redirect user to login screen if token as expired and redirect to home screen is token still valid. But the code below will redirect me to login screen even the token is valid. ``` import React, { Component } from 'react'; import PropTypes fro...
2018/03/24
[ "https://Stackoverflow.com/questions/49463096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/127986/" ]
EUREKA! ``` db.database.ref('/User/').orderByChild('uID').equalTo(this.uID).once('value', (snapshot) => { console.log(snapshot.val().email) }) ``` This code will do that.
You can checkout this [tutorial](https://www.djamware.com/post/5a629d9880aca7059c142976/build-ionic-3-angular-5-and-firebase-simple-chat-app). It create a chat app but it may help you on what you want to to. ``` firebase.database().ref('/Post/').on('value', resp => { console.log(resp) }); ```
5,425,775
I'm writing an iPhone app using Appcelerator Titanium Mobile. I am hiding and showing the tab group based on what window has focus. ``` dashWin.addEventListener("focus",function(e) { if (dashWin.tabGroupVisible == true) { dashWin.tabGroupVisible=false; tabGroup.animate({bottom:-50,duration:500}); ...
2011/03/24
[ "https://Stackoverflow.com/questions/5425775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/436641/" ]
Usually a tab group acts as the root of your app's navigation. When a user taps a tab, that tab's window is focused. Next, when a user triggers an action that requires a new window appear, it usually appears either modally or on top (in the navigation stack sense) of the current window. In the latter case, tell the cu...
I had `segues` that were leading back to my main navigation controller which was causing this. I fixed the problem by setting the main navigation controller back to the top of the stack. Here is the code: ``` - (void) viewDidAppear:(BOOL)animated { [self.navigationController popToRootViewControllerAnimated:NO]; } ...
5,425,775
I'm writing an iPhone app using Appcelerator Titanium Mobile. I am hiding and showing the tab group based on what window has focus. ``` dashWin.addEventListener("focus",function(e) { if (dashWin.tabGroupVisible == true) { dashWin.tabGroupVisible=false; tabGroup.animate({bottom:-50,duration:500}); ...
2011/03/24
[ "https://Stackoverflow.com/questions/5425775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/436641/" ]
Usually a tab group acts as the root of your app's navigation. When a user taps a tab, that tab's window is focused. Next, when a user triggers an action that requires a new window appear, it usually appears either modally or on top (in the navigation stack sense) of the current window. In the latter case, tell the cu...
I got this error when I linked `Action Segue` or `Selection Segue` from one view to another view through storyboard and performed the same segue programmatically again, which makes the navigation controller perform the same segue twice. 2 solutions for this case: 1. Removing the code that pushes the view. Just let st...
5,425,775
I'm writing an iPhone app using Appcelerator Titanium Mobile. I am hiding and showing the tab group based on what window has focus. ``` dashWin.addEventListener("focus",function(e) { if (dashWin.tabGroupVisible == true) { dashWin.tabGroupVisible=false; tabGroup.animate({bottom:-50,duration:500}); ...
2011/03/24
[ "https://Stackoverflow.com/questions/5425775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/436641/" ]
Usually a tab group acts as the root of your app's navigation. When a user taps a tab, that tab's window is focused. Next, when a user triggers an action that requires a new window appear, it usually appears either modally or on top (in the navigation stack sense) of the current window. In the latter case, tell the cu...
Recently, I've faced the same problem. The reason was: -I was trying to pop view controller twice by mistake. you can check this crash by setting breakpoints on push and pop View controllers
5,425,775
I'm writing an iPhone app using Appcelerator Titanium Mobile. I am hiding and showing the tab group based on what window has focus. ``` dashWin.addEventListener("focus",function(e) { if (dashWin.tabGroupVisible == true) { dashWin.tabGroupVisible=false; tabGroup.animate({bottom:-50,duration:500}); ...
2011/03/24
[ "https://Stackoverflow.com/questions/5425775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/436641/" ]
I got this error when I linked `Action Segue` or `Selection Segue` from one view to another view through storyboard and performed the same segue programmatically again, which makes the navigation controller perform the same segue twice. 2 solutions for this case: 1. Removing the code that pushes the view. Just let st...
I had `segues` that were leading back to my main navigation controller which was causing this. I fixed the problem by setting the main navigation controller back to the top of the stack. Here is the code: ``` - (void) viewDidAppear:(BOOL)animated { [self.navigationController popToRootViewControllerAnimated:NO]; } ...
5,425,775
I'm writing an iPhone app using Appcelerator Titanium Mobile. I am hiding and showing the tab group based on what window has focus. ``` dashWin.addEventListener("focus",function(e) { if (dashWin.tabGroupVisible == true) { dashWin.tabGroupVisible=false; tabGroup.animate({bottom:-50,duration:500}); ...
2011/03/24
[ "https://Stackoverflow.com/questions/5425775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/436641/" ]
I got this error when I linked `Action Segue` or `Selection Segue` from one view to another view through storyboard and performed the same segue programmatically again, which makes the navigation controller perform the same segue twice. 2 solutions for this case: 1. Removing the code that pushes the view. Just let st...
Recently, I've faced the same problem. The reason was: -I was trying to pop view controller twice by mistake. you can check this crash by setting breakpoints on push and pop View controllers
43,839,155
Sample html: ``` <tbody> <tr> <th style="width: 65%;">FD Name</th> <th style="width:35%;">PDF</th> </tr> <tr> <td>NT BT Small Cap FD</td> <td> <div> <a target="_self" onclick="window.open('URL/2509-pqr-statement.pdf'); return false;">ST</a> (55 kb...
2017/05/08
[ "https://Stackoverflow.com/questions/43839155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3669116/" ]
Remove bottom border for this class `.nav-tabs` and add border top for this class `.tab-content` ``` .tab-content { border: 1px solid rgb(204,205,90); border-radius: 15px; padding: 10px; } .nav-tabs { border-bottom: 0; } ``` Check this **[Fiddle](https://jsfiddle.net/vo1npqdx/700/)**
Worked out why. Somewhere there is a css: ``` active { border-bottom: 1px solid #CBCD44; } ``` Once I remove it, the bottom bar is gone. Then, I add following css to get rid of the top bar: ``` .nav-tabs { border:none; } ```
14,430,574
I am trying to add a new item to a table however the below code is throwing an InvalidCastException. This is from the add item page to add a new item into my table. The WineDate is coming from a DatePicker, WineStars from a ListPicker, and Category is coming from a listpicker linked to a table ``` WineItem newWineIte...
2013/01/20
[ "https://Stackoverflow.com/questions/14430574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1306758/" ]
You are only performing two casts: You're casting `StarList.SelectedItem` to a `string` and you're casting `winecategoriesListPicker.SelectedItem` to a `WineCategory`. You should attach the debugger and view what these values *actually* are to determine what you're doing wrong. (This assumes that none of the property ...
``` Category = (WineCategory)winecategoriesListPicker.SelectedItem ``` If `winecategoriesListPicker.SelectedItem` is a class that inherits WineCategory, you can do this, otherwise you have to declare such a class or create a constructor that accept the type of `winecategoriesListPicker.SelectedItem`: ``` Category = ...
21,469,647
I am examining a way to connect two microcontrollers. On the level of serialization I am thinking of using Nano protobuffers (<http://code.google.com/p/nanopb/>). This way I can encode/decode messages and send them between two processors. Basically, one small processor would be the RPC server, capable of doing several...
2014/01/30
[ "https://Stackoverflow.com/questions/21469647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2782165/" ]
It depends on your total requirements and how expensive are pins. I2C only needs two pins, but it's slow and to handle it with or without interrupts is a pain, even with the build in peripheral modules. It's a master/slave system, it's good for controlling many slow devices like temp sensors. Only two lines for all...
I would use UART or CAN or ETH or any protocol that is asynchronous. If you use a synchronous protocol, the master must always "ask" the slave if it has data and generate unwanted traffic.
21,469,647
I am examining a way to connect two microcontrollers. On the level of serialization I am thinking of using Nano protobuffers (<http://code.google.com/p/nanopb/>). This way I can encode/decode messages and send them between two processors. Basically, one small processor would be the RPC server, capable of doing several...
2014/01/30
[ "https://Stackoverflow.com/questions/21469647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2782165/" ]
It depends on your total requirements and how expensive are pins. I2C only needs two pins, but it's slow and to handle it with or without interrupts is a pain, even with the build in peripheral modules. It's a master/slave system, it's good for controlling many slow devices like temp sensors. Only two lines for all...
All of these interfaces have pros/cons. UART connection in it's basic functionality requires 2 pins: RX and TX. The SW implementation of how to message over that UART is quite a bit more complicated...you'll have to develop your own messenging protocol between the devices and decide what is a good message and what is ...
21,469,647
I am examining a way to connect two microcontrollers. On the level of serialization I am thinking of using Nano protobuffers (<http://code.google.com/p/nanopb/>). This way I can encode/decode messages and send them between two processors. Basically, one small processor would be the RPC server, capable of doing several...
2014/01/30
[ "https://Stackoverflow.com/questions/21469647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2782165/" ]
All of these interfaces have pros/cons. UART connection in it's basic functionality requires 2 pins: RX and TX. The SW implementation of how to message over that UART is quite a bit more complicated...you'll have to develop your own messenging protocol between the devices and decide what is a good message and what is ...
I would use UART or CAN or ETH or any protocol that is asynchronous. If you use a synchronous protocol, the master must always "ask" the slave if it has data and generate unwanted traffic.
2,763,300
How would you "remove the discontinuity" of $f$ ? In other words, how would you define $f(4)$ in order to make $f$ continuous at $x=4$? $$f(x) = \dfrac{x^2-x-12}{x-4}$$
2018/05/02
[ "https://math.stackexchange.com/questions/2763300", "https://math.stackexchange.com", "https://math.stackexchange.com/users/558016/" ]
You have $f(x)= \dfrac{x^2-x-12}{x-4}$. Notice that $x=4$ is not in the domain of the function since then you would be dividing by $0$. However, if $x \neq 4$, then we have $$ \require{cancel} f(x)= \dfrac{x^2-x-12}{x-4}= \dfrac{(x-4)(x+3)}{x-4}=\dfrac{\cancel{(x-4)}(x+3)}{\cancel{x-4}}= x+ 3 $$ Notice that $x+3$ gets ...
Using the fact that $x^2-x-12=(x-4)(x+3)$.
2,763,300
How would you "remove the discontinuity" of $f$ ? In other words, how would you define $f(4)$ in order to make $f$ continuous at $x=4$? $$f(x) = \dfrac{x^2-x-12}{x-4}$$
2018/05/02
[ "https://math.stackexchange.com/questions/2763300", "https://math.stackexchange.com", "https://math.stackexchange.com/users/558016/" ]
You have $f(x)= \dfrac{x^2-x-12}{x-4}$. Notice that $x=4$ is not in the domain of the function since then you would be dividing by $0$. However, if $x \neq 4$, then we have $$ \require{cancel} f(x)= \dfrac{x^2-x-12}{x-4}= \dfrac{(x-4)(x+3)}{x-4}=\dfrac{\cancel{(x-4)}(x+3)}{\cancel{x-4}}= x+ 3 $$ Notice that $x+3$ gets ...
Note that $x^2-x-12=(x-4)(x+3)$. Now, $$\lim\limits\_{x\to 4} f(x)=\lim\_{x\to 4} x+3=7$$. So, define $f(4)=7$.
2,763,300
How would you "remove the discontinuity" of $f$ ? In other words, how would you define $f(4)$ in order to make $f$ continuous at $x=4$? $$f(x) = \dfrac{x^2-x-12}{x-4}$$
2018/05/02
[ "https://math.stackexchange.com/questions/2763300", "https://math.stackexchange.com", "https://math.stackexchange.com/users/558016/" ]
You have $f(x)= \dfrac{x^2-x-12}{x-4}$. Notice that $x=4$ is not in the domain of the function since then you would be dividing by $0$. However, if $x \neq 4$, then we have $$ \require{cancel} f(x)= \dfrac{x^2-x-12}{x-4}= \dfrac{(x-4)(x+3)}{x-4}=\dfrac{\cancel{(x-4)}(x+3)}{\cancel{x-4}}= x+ 3 $$ Notice that $x+3$ gets ...
$f(x) = \frac{x^2-x-12}{x-4}$ $f(x) = \frac{(x-4)(x+3)}{(x-4)}$ $\lim\_{x\to4}f(x) = \frac{x^2-x-12}{x-4} = \lim\_{x\to4}\frac{(x-4)(x+3)}{(x-4)} = 7$ So redefine $f(x)$ as ; $f(x) = \begin{cases}\frac{x^2-x-12}{x-4}&x\ne4\\7&x= 4\end{cases}$
2,763,300
How would you "remove the discontinuity" of $f$ ? In other words, how would you define $f(4)$ in order to make $f$ continuous at $x=4$? $$f(x) = \dfrac{x^2-x-12}{x-4}$$
2018/05/02
[ "https://math.stackexchange.com/questions/2763300", "https://math.stackexchange.com", "https://math.stackexchange.com/users/558016/" ]
You have $f(x)= \dfrac{x^2-x-12}{x-4}$. Notice that $x=4$ is not in the domain of the function since then you would be dividing by $0$. However, if $x \neq 4$, then we have $$ \require{cancel} f(x)= \dfrac{x^2-x-12}{x-4}= \dfrac{(x-4)(x+3)}{x-4}=\dfrac{\cancel{(x-4)}(x+3)}{\cancel{x-4}}= x+ 3 $$ Notice that $x+3$ gets ...
if $ x \neq 4 $ $f(x)= \dfrac{x^2-x-12}{x-4}= \dfrac{(x-4)(x+3)}{x-4}=\dfrac{1(x+3)}{1}= x+ 3$ so we have f(x)=x+3 (for $ x \neq 4$) $\lim\_{x\to4}f(x) = \lim\_{x\to4}(x+3) $= 7 we want to make f continuous for this reason the ammount of function at 4 should be equall to $$\lim\_{x\to4}f(x)=7$$ so we define a fun...
8,508,356
Good afternoon in my timezone. I am developing a web application using struts framework. In a simple way, when the user call the application the first Action to be call is the SecurityAction, then this action redirects to one of the two actions, this is how i make the redirect : ``` if (user == "type_profile") ...
2011/12/14
[ "https://Stackoverflow.com/questions/8508356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/371730/" ]
If you need to enable/disable validation based on where the form is coming from the easiest solution would be to put a flag in the form. The flag can be processed by a custom request processor to provide application-wide behavior. Less elegantly, an action base class could manually call validation or not based on its ...
I have had to do that with one of my projects. This is how I solved my problem. I hope it works out for you. I called this action `SelectCopyFromProjectAction.do` from my jsp using JavaScript. This action called another class, which did more work. **From jsp** ``` function selectThisCopyProject(){ document[0].a...
37,390,333
Recently I've switched to windows 10 by performing a clean install, which means that I've wiped the whole HDD. Sadly I forgot to backup a project built up in Android Studio but I have it installed and running on my phone. Is it possible to somehow recover my project from what is installed on my smart device? If yes...
2016/05/23
[ "https://Stackoverflow.com/questions/37390333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5175253/" ]
**Step 1. Generate an apk from the installed app on your "smart" phone.** Use [App Backup & Restore](https://play.google.com/store/apps/details?id=mobi.infolife.appbackup) to do this. There are several other apps that allow you to create apk installers from installed apps. Just search on play store for "backup apps"....
try this step: step1 : open this <http://www.javadecompilers.com/> step2: upload apk on this site step3: decompile it step4: get your project in zip folder.
61,550,851
I have spent unbelievable hours trying to hunt down a way to use itertools to transform a sentence into a list of two-word phrases. I want to take this: "the quick brown fox" And turn it into this: "the quick", "quick brown", "brown fox" Everything I've tried brings be back everything from single-word to 4-word list...
2020/05/01
[ "https://Stackoverflow.com/questions/61550851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2495258/" ]
Try: ``` s = "the quick brown fox" words = s.split() result = [' '.join(pair) for pair in zip(words, words[1:])] print(result) ``` **Output** ``` ['the quick', 'quick brown', 'brown fox'] ``` **Explanation** Creating iterator for word pairs using [zip](https://www.w3schools.com/python/ref_func_zip.asp) ``` zip(...
@DarrylG answer seems the way to go, but you can also use: ``` s = "the quick brown fox" p = s.split() ns = [f"{w} {p[n+1]}" for n, w in enumerate(p) if n<len(p)-1 ] # ['the quick', 'quick brown', 'brown fox'] ``` --- [Demo](https://trinket.io/python3/125cec9b1b)
61,550,851
I have spent unbelievable hours trying to hunt down a way to use itertools to transform a sentence into a list of two-word phrases. I want to take this: "the quick brown fox" And turn it into this: "the quick", "quick brown", "brown fox" Everything I've tried brings be back everything from single-word to 4-word list...
2020/05/01
[ "https://Stackoverflow.com/questions/61550851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2495258/" ]
Try: ``` s = "the quick brown fox" words = s.split() result = [' '.join(pair) for pair in zip(words, words[1:])] print(result) ``` **Output** ``` ['the quick', 'quick brown', 'brown fox'] ``` **Explanation** Creating iterator for word pairs using [zip](https://www.w3schools.com/python/ref_func_zip.asp) ``` zip(...
If you want a pure iterator solution for large strings with constant memory usage: ``` input = "the quick brown fox" input_iter1 = map(lambda m: m.group(0), re.finditer(r"[^\s]+", input)) input_it...
3,144
2019 is here! And with the new year, as usual, comes a new iteration of **Community Promotion Ads**! Let’s refresh these for the coming year :) ### What are Community Promotion Ads? Community Promotion Ads are community-vetted advertisements that will show up on the main site, in the right sidebar. The purpose of thi...
2019/01/23
[ "https://security.meta.stackexchange.com/questions/3144", "https://security.meta.stackexchange.com", "https://security.meta.stackexchange.com/users/71390/" ]
[![EFF - The leading nonprofit defending digital privacy, free speech, and innovation](https://i.stack.imgur.com/Nj1zC.png)](https://www.eff.org/)
[![@StackSecurity](https://i.stack.imgur.com/8eORq.png)](https://twitter.com/stacksecurity)
3,144
2019 is here! And with the new year, as usual, comes a new iteration of **Community Promotion Ads**! Let’s refresh these for the coming year :) ### What are Community Promotion Ads? Community Promotion Ads are community-vetted advertisements that will show up on the main site, in the right sidebar. The purpose of thi...
2019/01/23
[ "https://security.meta.stackexchange.com/questions/3144", "https://security.meta.stackexchange.com", "https://security.meta.stackexchange.com/users/71390/" ]
[![@StackSecurity](https://i.stack.imgur.com/8eORq.png)](https://twitter.com/stacksecurity)
[![Security Without Borders](https://i.stack.imgur.com/SvsuE.png)](https://www.securitywithoutborders.org/)
3,144
2019 is here! And with the new year, as usual, comes a new iteration of **Community Promotion Ads**! Let’s refresh these for the coming year :) ### What are Community Promotion Ads? Community Promotion Ads are community-vetted advertisements that will show up on the main site, in the right sidebar. The purpose of thi...
2019/01/23
[ "https://security.meta.stackexchange.com/questions/3144", "https://security.meta.stackexchange.com", "https://security.meta.stackexchange.com/users/71390/" ]
[![EFF - The leading nonprofit defending digital privacy, free speech, and innovation](https://i.stack.imgur.com/Nj1zC.png)](https://www.eff.org/)
[![Security Without Borders](https://i.stack.imgur.com/SvsuE.png)](https://www.securitywithoutborders.org/)
11,852,223
I'm using Hibernate for database access. I'm using the following query in my code to fetch the data I need: ``` SELECT proasset FROM com.company.claims.participant.AbstractBeneficiary bene JOIN bene.approvals approval JOIN bene.proassetkey proasset join proasset.relatedparties proassetparties WHERE approval.user_dt > ...
2012/08/07
[ "https://Stackoverflow.com/questions/11852223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1464222/" ]
It looks like you are trying to mix ORM with a native (plain old SQL) query. createSQLQuery requires native SQL. You are using classes instead of table names. Try a read of this: <http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/querysql.html> In short you need to write a query like: ``` select fu from ba...
Correct the syntax by removing the inappropriate clauses. It may be possible to duplicate the removed clause with another SQL statement. For example, to order the rows of a view, do so when querying the view and not when creating it. This error can also occur in SQL\*Forms applications if a continuation line is indente...
11,852,223
I'm using Hibernate for database access. I'm using the following query in my code to fetch the data I need: ``` SELECT proasset FROM com.company.claims.participant.AbstractBeneficiary bene JOIN bene.approvals approval JOIN bene.proassetkey proasset join proasset.relatedparties proassetparties WHERE approval.user_dt > ...
2012/08/07
[ "https://Stackoverflow.com/questions/11852223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1464222/" ]
It looks like you are trying to mix ORM with a native (plain old SQL) query. createSQLQuery requires native SQL. You are using classes instead of table names. Try a read of this: <http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/querysql.html> In short you need to write a query like: ``` select fu from ba...
Alright, so I used createSQLQuery() instead of createQuery() and I was using the column names instead of the variable names. Here's what my code looks like now: ``` StringBuilder query = new StringBuilder(); query.append("SELECT proasset\n" + "FROM com.avivausa.claims.participant.AbstractBeneficiary bene...
5,855,878
If I use a logger in the case of known exceptions, what's wrong with `e.printStackTrace()` for an unknown exception ? I'm always told not to do this - but not given a reason example below ``` try { dostuff(); } catch (AException ae) { logger.error("ae happened"); } catch (BExc...
2011/05/02
[ "https://Stackoverflow.com/questions/5855878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327426/" ]
Because it doesn't use the logger system, it goes **directly** to the `stderr` which has to be avoided. **edit: why writing directly to stderr has to be avoided ?** In answer to your question, @shinynewbike, I have slightly modifed my answer. What it has to be avoided is to write **directly** to `stderr` without usin...
This is bad because `e.printStackTrace()` will not necessarily write to the same log file as `logger.error()` so for consistency you should use `logger.error()` for everything. Nor does `e.printStackTrace()` do anything to *describe* what was happening that caused the error. You should always include a log message tha...
5,855,878
If I use a logger in the case of known exceptions, what's wrong with `e.printStackTrace()` for an unknown exception ? I'm always told not to do this - but not given a reason example below ``` try { dostuff(); } catch (AException ae) { logger.error("ae happened"); } catch (BExc...
2011/05/02
[ "https://Stackoverflow.com/questions/5855878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327426/" ]
`catch (Exception e)` catches all exceptions even the unchecked ones which derrive from `RuntimeException` like `NullPointerException` or `IndexOutOfBoundsException` and the program then continues to run even though it is highly likely that you dont want that because those are often fatal and can exit the control flow ...
First of all, printing stack trace doesn't solve the problem, and the problem will probably not report to the parent thread for further handling. My suggestion is that you handle the exception in the catch clause, by identify the type of exception in the program using e.getClass().getName().
5,855,878
If I use a logger in the case of known exceptions, what's wrong with `e.printStackTrace()` for an unknown exception ? I'm always told not to do this - but not given a reason example below ``` try { dostuff(); } catch (AException ae) { logger.error("ae happened"); } catch (BExc...
2011/05/02
[ "https://Stackoverflow.com/questions/5855878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327426/" ]
Because it doesn't use the logger system, it goes **directly** to the `stderr` which has to be avoided. **edit: why writing directly to stderr has to be avoided ?** In answer to your question, @shinynewbike, I have slightly modifed my answer. What it has to be avoided is to write **directly** to `stderr` without usin...
`catch (Exception e)` catches all exceptions even the unchecked ones which derrive from `RuntimeException` like `NullPointerException` or `IndexOutOfBoundsException` and the program then continues to run even though it is highly likely that you dont want that because those are often fatal and can exit the control flow ...
5,855,878
If I use a logger in the case of known exceptions, what's wrong with `e.printStackTrace()` for an unknown exception ? I'm always told not to do this - but not given a reason example below ``` try { dostuff(); } catch (AException ae) { logger.error("ae happened"); } catch (BExc...
2011/05/02
[ "https://Stackoverflow.com/questions/5855878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327426/" ]
This is bad because `e.printStackTrace()` will not necessarily write to the same log file as `logger.error()` so for consistency you should use `logger.error()` for everything. Nor does `e.printStackTrace()` do anything to *describe* what was happening that caused the error. You should always include a log message tha...
`catch (Exception e)` catches all exceptions even the unchecked ones which derrive from `RuntimeException` like `NullPointerException` or `IndexOutOfBoundsException` and the program then continues to run even though it is highly likely that you dont want that because those are often fatal and can exit the control flow ...
5,855,878
If I use a logger in the case of known exceptions, what's wrong with `e.printStackTrace()` for an unknown exception ? I'm always told not to do this - but not given a reason example below ``` try { dostuff(); } catch (AException ae) { logger.error("ae happened"); } catch (BExc...
2011/05/02
[ "https://Stackoverflow.com/questions/5855878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327426/" ]
Because it doesn't use the logger system, it goes **directly** to the `stderr` which has to be avoided. **edit: why writing directly to stderr has to be avoided ?** In answer to your question, @shinynewbike, I have slightly modifed my answer. What it has to be avoided is to write **directly** to `stderr` without usin...
First of all, printing stack trace doesn't solve the problem, and the problem will probably not report to the parent thread for further handling. My suggestion is that you handle the exception in the catch clause, by identify the type of exception in the program using e.getClass().getName().
5,855,878
If I use a logger in the case of known exceptions, what's wrong with `e.printStackTrace()` for an unknown exception ? I'm always told not to do this - but not given a reason example below ``` try { dostuff(); } catch (AException ae) { logger.error("ae happened"); } catch (BExc...
2011/05/02
[ "https://Stackoverflow.com/questions/5855878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327426/" ]
Because it doesn't use the logger system, it goes **directly** to the `stderr` which has to be avoided. **edit: why writing directly to stderr has to be avoided ?** In answer to your question, @shinynewbike, I have slightly modifed my answer. What it has to be avoided is to write **directly** to `stderr` without usin...
IMHO, You should * consistently log to a logger OR standard error, but not a mix (perhaps this is the reason for the complaint) * always log exception with the stack trace unless you are sure you will never need it.
5,855,878
If I use a logger in the case of known exceptions, what's wrong with `e.printStackTrace()` for an unknown exception ? I'm always told not to do this - but not given a reason example below ``` try { dostuff(); } catch (AException ae) { logger.error("ae happened"); } catch (BExc...
2011/05/02
[ "https://Stackoverflow.com/questions/5855878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327426/" ]
Because it doesn't use the logger system, it goes **directly** to the `stderr` which has to be avoided. **edit: why writing directly to stderr has to be avoided ?** In answer to your question, @shinynewbike, I have slightly modifed my answer. What it has to be avoided is to write **directly** to `stderr` without usin...
One of the things that the logging framework is giving you is a powerful abstraction over where your log messages are finally output. You may think you can achieve the same with standard out and standard error, but this is not always the case. In many environments, the developer does not have any control over what happ...
5,855,878
If I use a logger in the case of known exceptions, what's wrong with `e.printStackTrace()` for an unknown exception ? I'm always told not to do this - but not given a reason example below ``` try { dostuff(); } catch (AException ae) { logger.error("ae happened"); } catch (BExc...
2011/05/02
[ "https://Stackoverflow.com/questions/5855878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327426/" ]
One of the things that the logging framework is giving you is a powerful abstraction over where your log messages are finally output. You may think you can achieve the same with standard out and standard error, but this is not always the case. In many environments, the developer does not have any control over what happ...
`catch (Exception e)` catches all exceptions even the unchecked ones which derrive from `RuntimeException` like `NullPointerException` or `IndexOutOfBoundsException` and the program then continues to run even though it is highly likely that you dont want that because those are often fatal and can exit the control flow ...
5,855,878
If I use a logger in the case of known exceptions, what's wrong with `e.printStackTrace()` for an unknown exception ? I'm always told not to do this - but not given a reason example below ``` try { dostuff(); } catch (AException ae) { logger.error("ae happened"); } catch (BExc...
2011/05/02
[ "https://Stackoverflow.com/questions/5855878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327426/" ]
IMHO, You should * consistently log to a logger OR standard error, but not a mix (perhaps this is the reason for the complaint) * always log exception with the stack trace unless you are sure you will never need it.
This is bad because `e.printStackTrace()` will not necessarily write to the same log file as `logger.error()` so for consistency you should use `logger.error()` for everything. Nor does `e.printStackTrace()` do anything to *describe* what was happening that caused the error. You should always include a log message tha...
5,855,878
If I use a logger in the case of known exceptions, what's wrong with `e.printStackTrace()` for an unknown exception ? I'm always told not to do this - but not given a reason example below ``` try { dostuff(); } catch (AException ae) { logger.error("ae happened"); } catch (BExc...
2011/05/02
[ "https://Stackoverflow.com/questions/5855878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327426/" ]
IMHO, You should * consistently log to a logger OR standard error, but not a mix (perhaps this is the reason for the complaint) * always log exception with the stack trace unless you are sure you will never need it.
`catch (Exception e)` catches all exceptions even the unchecked ones which derrive from `RuntimeException` like `NullPointerException` or `IndexOutOfBoundsException` and the program then continues to run even though it is highly likely that you dont want that because those are often fatal and can exit the control flow ...
67,955,020
I have an R dataset filled with character strings that look like this: `date <- "2019-03-12T14:32:24.000-01:00"` Is there a way to convert this date and time to a date class where both the date 2019-03-12 and the time T14:32:24.000-01:00 are displayed? I need a way to manipulate these dates later on, so I can find th...
2021/06/13
[ "https://Stackoverflow.com/questions/67955020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16211698/" ]
You can use `lubridate`'s `ymd_hms`. ``` date <- "2019-03-12T14:32:24.000-01:00" date1 <- lubridate::ymd_hms(date) date1 #[1] "2019-03-12 15:32:24 UTC" ``` Note that timezone has changed to UTC now and hence you see a different time. If you only want the date you can use `as.Date` and extract the time part with `fo...
We could use [`anytime`](https://www.rdocumentation.org/packages/anytime/versions/0.3.9) ``` library(anytime) anytime(date) #[1] "2019-03-12 14:32:24 EDT" ``` If we want only the `Date`, use `anydate` ``` anydate(date) #[1] "2019-03-12" ``` --- In `base R`, we can do ``` as.POSIXct(date, format = '%FT%T') #[1] ...
31,714,045
**My wish** I build a funny code which must run as far on linux: --- ``` $ ./lib Main: Creating threads Main: Waiting for threads to finish Hello #0 from Thread 1 Hello #0 from Thread 2 Hello #1 from Thread 1 Hello #1 from Thread 2 Hello #2 from Thread 1 Hello #2 from Thread 2 Hello #3 from Thread 1 Hello...
2015/07/30
[ "https://Stackoverflow.com/questions/31714045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5171542/" ]
Looks like a typo. You use thread1 in both calls to pthread\_create. ``` iret1 = pthread_create( &thread1, 0, print_message_function1, (void*) message1); iret2 = pthread_create( &thread1, 0, print_message_function2, (void*) message2); ``` So `pthread_join(thread2, 0);` is pretty much doomed.
This is really just **relevant information**, not an answer as such, but unfortunately SO does not support code in comments. The problem that you *noticed* with your code was a simple typo, but I didn't see that until I read the now [accepted answer](https://stackoverflow.com/a/31714197/464581). For, I sat down and re...
51,794,085
I have a table to save a process. Every process is composed by items and every item has its values that are collected during the process. A process is executed by a client. Here is the sample database scheme with dummy data: <http://sqlfiddle.com/#!15/36af4> There is some info that I need to extract from these tab...
2018/08/10
[ "https://Stackoverflow.com/questions/51794085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4744158/" ]
It looks like a common problem `top-n-per-group` with a slight twist. Here is one way to do it, where I use the `ROW_NUMBER` method. Another method is to use lateral join. Which method is faster depends on the data distribution. You can read through very detailed answers on dba.se [Retrieving n rows per group](https:...
I think you're confusing the idea of `Group By`, however try this: ``` SELECT PV.ID_ITEM AS ID_ITEM, pv.id_process as PROCESS_ID, p.id_client as CLIENT_ID, PV.ITEM_LIFE AS LIFE, COUNT(PV.ID_ITEM) ...
51,794,085
I have a table to save a process. Every process is composed by items and every item has its values that are collected during the process. A process is executed by a client. Here is the sample database scheme with dummy data: <http://sqlfiddle.com/#!15/36af4> There is some info that I need to extract from these tab...
2018/08/10
[ "https://Stackoverflow.com/questions/51794085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4744158/" ]
It looks like a common problem `top-n-per-group` with a slight twist. Here is one way to do it, where I use the `ROW_NUMBER` method. Another method is to use lateral join. Which method is faster depends on the data distribution. You can read through very detailed answers on dba.se [Retrieving n rows per group](https:...
My answer uses window functions to calculate the values without group by. I think the output you gave has mistakes. But modify this query however you like to get the values you need. e.g if you need the lowest process\_id across all the records, remove the partition by clause for that column ``` select * from (with p...
20,504,628
I'm using SQL Server 2008 and I'm trying to load a new (target) table from a staging (source) table. The target table is empty. I think since my target table is empty, the MERGE statement skips the WHEN MATCHED part i.e. result of INNER JOIN is NULL and so nothing is UPDATED, and it just proceed to the WHEN NOT MATCHE...
2013/12/10
[ "https://Stackoverflow.com/questions/20504628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274175/" ]
Since the target table is empty, using `MERGE` seems to me like hiring a plumber to pour you a glass of water. And `MERGE` operates only one branch, independently, for every row of a table - it can't see that the key is repeated and so perform an insert and then an update - this betrays that you think SQL always operat...
> > I think since my target table is empty, the MERGE statement skips the WHEN MATCHED part > > > Well, that's correct, but it's by design - `MERGE` is not a "progressive" merge. It does not go row-by-row to see if records inserted as part of the `MERGE` should now be updated. It processes the source in "batches" ...
42,627
If I am living in England around 1000 and some Scandinavian raiders show up at my village to pillage our farms, which phrase would I be most likely to be saying: * "Oh no, here come the Vikings!" * "Oh no, here come the Northmen!" * "Oh no, here come the Norsemen!" * "Oh no, here come the Danes!" * "Oh no, here come t...
2017/12/28
[ "https://history.stackexchange.com/questions/42627", "https://history.stackexchange.com", "https://history.stackexchange.com/users/4748/" ]
Usually "Danes", or the "pagans"[note], or possibly the "Northmen" - though the last was more of a Continental usage. > > In Francia these Scandinavians were called 'Northmen' or 'Danes' (in translation), and in England they were called 'Danes' or 'pagans' in contemporary chronicles. > > > **Brink, Stefan. "Who we...
As used in The Wake by Paul Kingsnorth or in Beowulf, your Englishman might use "ingenga" to mean invader or visitor.