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
18,451,681
is there a way to find queries in mongodb that are not using Indexes or are SLOW? In MySQL that is possible with the following settings inside configuration file: ``` log-queries-not-using-indexes = 1 log_slow_queries = /tmp/slowmysql.log ```
2013/08/26
[ "https://Stackoverflow.com/questions/18451681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233751/" ]
The equivalent approach in MongoDB would be to use the [query profiler](https://docs.mongodb.com/manual/tutorial/manage-the-database-profiler/) to track and diagnose slow queries. With profiling enabled for a database, slow operations are written to the `system.profile` capped collection (which by default is 1Mb in si...
You can use the command line tool [mongotail](https://github.com/mrsarm/mongotail) to read the log from the profiler within a console and with a more readable format. First activate the profiler and set the threshold in milliseconds for the profile to consider an operation to be slow. In the following example the thre...
18,451,681
is there a way to find queries in mongodb that are not using Indexes or are SLOW? In MySQL that is possible with the following settings inside configuration file: ``` log-queries-not-using-indexes = 1 log_slow_queries = /tmp/slowmysql.log ```
2013/08/26
[ "https://Stackoverflow.com/questions/18451681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233751/" ]
First, you must set up your profiling, specifying what the log level that you want. The 3 options are: * 0 - logger off * 1 - log slow queries * 2 - log all queries You do this by running your `mongod` deamon with the `--profile` options: `mongod --profile 2 --slowms 20` With this, the logs will be written to the `...
You can use the command line tool [mongotail](https://github.com/mrsarm/mongotail) to read the log from the profiler within a console and with a more readable format. First activate the profiler and set the threshold in milliseconds for the profile to consider an operation to be slow. In the following example the thre...
18,451,681
is there a way to find queries in mongodb that are not using Indexes or are SLOW? In MySQL that is possible with the following settings inside configuration file: ``` log-queries-not-using-indexes = 1 log_slow_queries = /tmp/slowmysql.log ```
2013/08/26
[ "https://Stackoverflow.com/questions/18451681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233751/" ]
You can use the following two mongod options. The first option fails queries not using index (V 2.4 only), the second records queries slower than some ms threshold (default is 100ms) ``` --notablescan Forbids operations that require a table scan. --slowms <value> Defines the value of “slow,” for the --profile optio...
In case somebody ends up here from Google on this old question, I found that `explain` really helped me fix specific queries that I could see were causing `COLLSCAN`s from the logs. Example: `db.collection.find().explain()` This will let you know if the query is using a `COLLSCAN` (Basic Cursor) or an `index` (BTree...
18,451,681
is there a way to find queries in mongodb that are not using Indexes or are SLOW? In MySQL that is possible with the following settings inside configuration file: ``` log-queries-not-using-indexes = 1 log_slow_queries = /tmp/slowmysql.log ```
2013/08/26
[ "https://Stackoverflow.com/questions/18451681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233751/" ]
First, you must set up your profiling, specifying what the log level that you want. The 3 options are: * 0 - logger off * 1 - log slow queries * 2 - log all queries You do this by running your `mongod` deamon with the `--profile` options: `mongod --profile 2 --slowms 20` With this, the logs will be written to the `...
You can use the following two mongod options. The first option fails queries not using index (V 2.4 only), the second records queries slower than some ms threshold (default is 100ms) ``` --notablescan Forbids operations that require a table scan. --slowms <value> Defines the value of “slow,” for the --profile optio...
18,451,681
is there a way to find queries in mongodb that are not using Indexes or are SLOW? In MySQL that is possible with the following settings inside configuration file: ``` log-queries-not-using-indexes = 1 log_slow_queries = /tmp/slowmysql.log ```
2013/08/26
[ "https://Stackoverflow.com/questions/18451681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233751/" ]
In case somebody ends up here from Google on this old question, I found that `explain` really helped me fix specific queries that I could see were causing `COLLSCAN`s from the logs. Example: `db.collection.find().explain()` This will let you know if the query is using a `COLLSCAN` (Basic Cursor) or an `index` (BTree...
While you can obviously use Profiler a very neat feature of Mongo DB due to which I actually fall in love with it is Mongo DB MMS. Takes less than 60 seconds and can manage from anywhere. I am sure you will Love it. <https://mms.mongodb.com/>
18,451,681
is there a way to find queries in mongodb that are not using Indexes or are SLOW? In MySQL that is possible with the following settings inside configuration file: ``` log-queries-not-using-indexes = 1 log_slow_queries = /tmp/slowmysql.log ```
2013/08/26
[ "https://Stackoverflow.com/questions/18451681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233751/" ]
The equivalent approach in MongoDB would be to use the [query profiler](https://docs.mongodb.com/manual/tutorial/manage-the-database-profiler/) to track and diagnose slow queries. With profiling enabled for a database, slow operations are written to the `system.profile` capped collection (which by default is 1Mb in si...
While you can obviously use Profiler a very neat feature of Mongo DB due to which I actually fall in love with it is Mongo DB MMS. Takes less than 60 seconds and can manage from anywhere. I am sure you will Love it. <https://mms.mongodb.com/>
18,451,681
is there a way to find queries in mongodb that are not using Indexes or are SLOW? In MySQL that is possible with the following settings inside configuration file: ``` log-queries-not-using-indexes = 1 log_slow_queries = /tmp/slowmysql.log ```
2013/08/26
[ "https://Stackoverflow.com/questions/18451681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233751/" ]
You can use the command line tool [mongotail](https://github.com/mrsarm/mongotail) to read the log from the profiler within a console and with a more readable format. First activate the profiler and set the threshold in milliseconds for the profile to consider an operation to be slow. In the following example the thre...
While you can obviously use Profiler a very neat feature of Mongo DB due to which I actually fall in love with it is Mongo DB MMS. Takes less than 60 seconds and can manage from anywhere. I am sure you will Love it. <https://mms.mongodb.com/>
18,451,681
is there a way to find queries in mongodb that are not using Indexes or are SLOW? In MySQL that is possible with the following settings inside configuration file: ``` log-queries-not-using-indexes = 1 log_slow_queries = /tmp/slowmysql.log ```
2013/08/26
[ "https://Stackoverflow.com/questions/18451681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233751/" ]
First, you must set up your profiling, specifying what the log level that you want. The 3 options are: * 0 - logger off * 1 - log slow queries * 2 - log all queries You do this by running your `mongod` deamon with the `--profile` options: `mongod --profile 2 --slowms 20` With this, the logs will be written to the `...
While you can obviously use Profiler a very neat feature of Mongo DB due to which I actually fall in love with it is Mongo DB MMS. Takes less than 60 seconds and can manage from anywhere. I am sure you will Love it. <https://mms.mongodb.com/>
725,581
I created some screencasts with ffmpeg. The PC I use has capable hardware (Intel Core i7-4930K Six Core 3.40GHz 12MB Cache, 32 GB RAM), but unfortunately it runs Windows 7. Because I want to do my screencast on Linux I installed Kubuntu in VMware. I assigned 4 CPU cores and 4 GB RAM to the VM. I record my screencast w...
2014/03/06
[ "https://superuser.com/questions/725581", "https://superuser.com", "https://superuser.com/users/90658/" ]
This works for me in 2019. I tried with different encoders but when using ones that aren't `native` to ffmpeg, the audio and video get out of sync. Specifically the video lags behind. `mpeg4` and `aac` are `native`. ``` ffmpeg -f alsa -ac 1 -i pulse -f x11grab -r 30 -s 1920x1080 -i :0.0 -acodec aac -vcodec mpeg4 -pre...
I get a "[swscaler @ 0xa314080] Warning: data is not aligned! This can lead to a speedloss" that seems to be the issue. However, I don't have a resolution yet.
102,070
Is there a tutotial or help file, suitable for a beginner c# programmer to use.
2008/09/19
[ "https://Stackoverflow.com/questions/102070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4692/" ]
The primary documentation for the Farseer Physics engine is on the homepage. <http://www.codeplex.com/FarseerPhysics/Wiki/View.aspx?title=Documentation&referringTitle=Home> You can also check out the source code, they have a demos folder in there, though it's only got one example, but it can show you how to implement...
Andy Beaulieu has beein doing a lot of work to make Farseer easier to use in Silverlight, you can read about it here: <http://www.andybeaulieu.com/Home/tabid/67/EntryID/115/Default.aspx>
102,070
Is there a tutotial or help file, suitable for a beginner c# programmer to use.
2008/09/19
[ "https://Stackoverflow.com/questions/102070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4692/" ]
I realize this is an old question, but for future searchers I will post a few links: **Farseer Physics Helper** Physics helper for Blend makes it very easy to create realistic looking games or demos using practically no code :) <http://physicshelper.codeplex.com/> **Farseer Physics Engine Simple Samples** Very sim...
Andy Beaulieu has beein doing a lot of work to make Farseer easier to use in Silverlight, you can read about it here: <http://www.andybeaulieu.com/Home/tabid/67/EntryID/115/Default.aspx>
102,070
Is there a tutotial or help file, suitable for a beginner c# programmer to use.
2008/09/19
[ "https://Stackoverflow.com/questions/102070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4692/" ]
Andy Beaulieu has beein doing a lot of work to make Farseer easier to use in Silverlight, you can read about it here: <http://www.andybeaulieu.com/Home/tabid/67/EntryID/115/Default.aspx>
Great webcast with a Farseer tutorial - <http://msdn.microsoft.com/en-us/hh781459.aspx>
102,070
Is there a tutotial or help file, suitable for a beginner c# programmer to use.
2008/09/19
[ "https://Stackoverflow.com/questions/102070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4692/" ]
The primary documentation for the Farseer Physics engine is on the homepage. <http://www.codeplex.com/FarseerPhysics/Wiki/View.aspx?title=Documentation&referringTitle=Home> You can also check out the source code, they have a demos folder in there, though it's only got one example, but it can show you how to implement...
I realize this is an old question, but for future searchers I will post a few links: **Farseer Physics Helper** Physics helper for Blend makes it very easy to create realistic looking games or demos using practically no code :) <http://physicshelper.codeplex.com/> **Farseer Physics Engine Simple Samples** Very sim...
102,070
Is there a tutotial or help file, suitable for a beginner c# programmer to use.
2008/09/19
[ "https://Stackoverflow.com/questions/102070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4692/" ]
The primary documentation for the Farseer Physics engine is on the homepage. <http://www.codeplex.com/FarseerPhysics/Wiki/View.aspx?title=Documentation&referringTitle=Home> You can also check out the source code, they have a demos folder in there, though it's only got one example, but it can show you how to implement...
Great webcast with a Farseer tutorial - <http://msdn.microsoft.com/en-us/hh781459.aspx>
102,070
Is there a tutotial or help file, suitable for a beginner c# programmer to use.
2008/09/19
[ "https://Stackoverflow.com/questions/102070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4692/" ]
I realize this is an old question, but for future searchers I will post a few links: **Farseer Physics Helper** Physics helper for Blend makes it very easy to create realistic looking games or demos using practically no code :) <http://physicshelper.codeplex.com/> **Farseer Physics Engine Simple Samples** Very sim...
Great webcast with a Farseer tutorial - <http://msdn.microsoft.com/en-us/hh781459.aspx>
62,529,746
I am trying to make something like a timeline and I have multiple `divs` with text in it. I want it to be responsive, so on desktop they are low and wide, but on mobile they are thin and long. But not every `div` will have the same amount of text in it so they are not all going to be the same height. How do I get the...
2020/06/23
[ "https://Stackoverflow.com/questions/62529746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13792442/" ]
you can try this way ``` wiz = self.env['customer.wizard'].create({'name': self.name}) @api.multi def open_wizard(self): return { 'view_type': 'form', 'view_mode': 'form', 'res_model': 'customer.wizard', 'res_id': wiz.id, 'target': 'new', 'type': 'ir.actions.act_window', } ``` or you can pass the value in the conte...
Just update the context on method `open_wizard` like the following: ``` 'context': {'default_name': self.name} ``` That will (virtually) create the wizard with the value of `self.name`.
57,068,891
Where is the best place to put code for audio playback in a SwiftUI based app, i.e. not having UIViewController classes? The sound I want to play is initiated by a view, so I'm thinking of putting it into the corresponding view model class. But as a model class is about data, I think there should be a better option. Wh...
2019/07/17
[ "https://Stackoverflow.com/questions/57068891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10826194/" ]
Correct, the View shouldn't take care of data. And SwiftUI enforces this logic. You could create a Player class which takes care of playing the audio. And add it as an `EnvironmentObject`, so you can control it with your button in the `View`. You can then do sweet things like binding your play button to show different...
Altough the solution from Davide worked, I ended up using the singleton pattern to have global access to my sound player object and actually moved back the triggering of the sounds from the view to the model class. It looks like this: ``` class Player { static let shared = AudioPlayer() func pauseOrPlay() { ...
24,738,040
I'm running tests on local machine on Mac OS Python 2.7.5 Selenium hub: > > java -jar ~/Downloads/selenium-server-standalone-2.42.2.jar -role hub > > > Selenium node: ``` java -jar ~/Downloads/selenium-server-standalone-2.42.2.jar -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -role node http://127.0.0.1...
2014/07/14
[ "https://Stackoverflow.com/questions/24738040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3032571/" ]
You have an array of arrays, therefore you'll need two loops. ``` foreach ($shop as $item) { foreach ($item as $key => $value) { echo $key; echo $value; } } ```
You could access by $shop[0]['Title'] 0 means the first item in array and this item is also an array, which contains string keys so 'title' as second level. To iterate it use: ``` //Syntax array as key => value (value is in this case also an array) foreach($shop as $iterator_level1 => $shop_set){ //so you can ac...
24,738,040
I'm running tests on local machine on Mac OS Python 2.7.5 Selenium hub: > > java -jar ~/Downloads/selenium-server-standalone-2.42.2.jar -role hub > > > Selenium node: ``` java -jar ~/Downloads/selenium-server-standalone-2.42.2.jar -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -role node http://127.0.0.1...
2014/07/14
[ "https://Stackoverflow.com/questions/24738040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3032571/" ]
Try this - ``` $newarray = array(); foreach($shop as $key=>$value) { $newarray[$key]['Title'] = $value['Title']; $newarray[$key]['Number'] = $value['Number']; } echo "<pre>";print_r($newarray); ``` Here, `$newarray` will give you output like this. ``` Array ( [0] => Array ( [Title] ...
You could access by $shop[0]['Title'] 0 means the first item in array and this item is also an array, which contains string keys so 'title' as second level. To iterate it use: ``` //Syntax array as key => value (value is in this case also an array) foreach($shop as $iterator_level1 => $shop_set){ //so you can ac...
3,292
I stumbled on this: ``` ?"NDSolve`FEM`*" ``` > > > ``` > <list of many functions with names like ...Mesh...,Tetrahedon..., Triangle..., ProcessBCs, ...> > > ``` > > I'm tempted to conclude that *Mathematica* has built-in finite element modelling capability, but the documentation seemingly does not cover it. Wh...
2012/03/21
[ "https://mathematica.stackexchange.com/questions/3292", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/63/" ]
Version 8 does not have a built-in finite element method. If you want to use the finite element method, you may want to look at the following packages: 1. [ACEFem](http://www.wolfram.com/products/applications/acefem/) 2. [IMTEK Mathematica Supplement (IMS)](http://portal.uni-freiburg.de/imteksimulation/downloads/ims) ...
In answer to David's question in the comments to the answer, I examine the contents of ``` Names["*`*"] ``` with every release. You can find all sorts of goodies this way. In addition to the `FEM` stuff, you'll also find some `Mesh` functionality. Stephen Wolfram dropped a hint that PDEs were under development here...
3,292
I stumbled on this: ``` ?"NDSolve`FEM`*" ``` > > > ``` > <list of many functions with names like ...Mesh...,Tetrahedon..., Triangle..., ProcessBCs, ...> > > ``` > > I'm tempted to conclude that *Mathematica* has built-in finite element modelling capability, but the documentation seemingly does not cover it. Wh...
2012/03/21
[ "https://mathematica.stackexchange.com/questions/3292", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/63/" ]
Version 8 does not have a built-in finite element method. If you want to use the finite element method, you may want to look at the following packages: 1. [ACEFem](http://www.wolfram.com/products/applications/acefem/) 2. [IMTEK Mathematica Supplement (IMS)](http://portal.uni-freiburg.de/imteksimulation/downloads/ims) ...
Mathematica 10 now supports the Finite Element Method for certain classes of PDEs. Documentation: * [Reference](http://reference.wolfram.com/language/FEMDocumentation/guide/FiniteElementMethodGuide.html) * [Detailed user guide](http://reference.wolfram.com/language/FEMDocumentation/tutorial/FiniteElementOverview.html...
3,292
I stumbled on this: ``` ?"NDSolve`FEM`*" ``` > > > ``` > <list of many functions with names like ...Mesh...,Tetrahedon..., Triangle..., ProcessBCs, ...> > > ``` > > I'm tempted to conclude that *Mathematica* has built-in finite element modelling capability, but the documentation seemingly does not cover it. Wh...
2012/03/21
[ "https://mathematica.stackexchange.com/questions/3292", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/63/" ]
In answer to David's question in the comments to the answer, I examine the contents of ``` Names["*`*"] ``` with every release. You can find all sorts of goodies this way. In addition to the `FEM` stuff, you'll also find some `Mesh` functionality. Stephen Wolfram dropped a hint that PDEs were under development here...
Mathematica 10 now supports the Finite Element Method for certain classes of PDEs. Documentation: * [Reference](http://reference.wolfram.com/language/FEMDocumentation/guide/FiniteElementMethodGuide.html) * [Detailed user guide](http://reference.wolfram.com/language/FEMDocumentation/tutorial/FiniteElementOverview.html...
36,036,356
I'm faced a problem that my computed observable stops triggering after some sequence of dependency changes. Finally I found out the point: if dependency was inside of false branch statement during latest evaluation, computed will not be triggered next time **even if condition became true before evaluation finished**. H...
2016/03/16
[ "https://Stackoverflow.com/questions/36036356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3602201/" ]
After reading the update to your question and looking through the updated example code, I've come up with a real solution. This uses a `pureComputed` to do the update, taking advantage of the fact that a pure computed can be activated and deactivated by subscribing to it and disposing the subscription. Here is the impo...
According to the Knockout [JS documentation](http://knockoutjs.com/documentation/computed-dependency-tracking.html): > > So, Knockout doesn’t just detect dependencies the first time the > evaluator runs - it redetects them every time. > > > When `if(test !== 0){` is false, Knockout does not subscribe to `self.tr...
36,036,356
I'm faced a problem that my computed observable stops triggering after some sequence of dependency changes. Finally I found out the point: if dependency was inside of false branch statement during latest evaluation, computed will not be triggered next time **even if condition became true before evaluation finished**. H...
2016/03/16
[ "https://Stackoverflow.com/questions/36036356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3602201/" ]
After reading the update to your question and looking through the updated example code, I've come up with a real solution. This uses a `pureComputed` to do the update, taking advantage of the fact that a pure computed can be activated and deactivated by subscribing to it and disposing the subscription. Here is the impo...
The idea, in general, is that all dependencies of a computed observable should also be observables. In your case, `test` isn't an observable; if you make it observable, your code should work as expected: ``` self.content = function(){ var test = ko.obseravble(3); return ko.computed(function(){ alert("triggered...
47,488
Are there any versions of Cluedo that do not have exactly 6 suspects, 6 murder weapons, and 9 rooms?
2019/06/07
[ "https://boardgames.stackexchange.com/questions/47488", "https://boardgames.stackexchange.com", "https://boardgames.stackexchange.com/users/26991/" ]
**Yes.** One example (and there may well be others) is [Super Cluedo](https://boardgamegeek.com/boardgame/1561/clue-master-detective), also known as Clue Master Detective. Here is an excerpt of the publisher's description (according to that BGG link, anyway; I can't find the original source): > > The late Mr. Boddy's...
Ludology just did a segment on this: <http://ludology.libsyn.com/biography-of-a-board-game-2005-cluedo> There are a lot of different versions out there and not all have the 6-6-9 ratio.
47,488
Are there any versions of Cluedo that do not have exactly 6 suspects, 6 murder weapons, and 9 rooms?
2019/06/07
[ "https://boardgames.stackexchange.com/questions/47488", "https://boardgames.stackexchange.com", "https://boardgames.stackexchange.com/users/26991/" ]
While all printed (*the [original patent](https://worldwide.espacenet.com/publicationDetails/biblio?FT=D&date=19470401&locale=en_EP&CC=GB&NR=586817A) had 10 characters*) editions of the classic Cluedo have the standard 6-6-9 ratio, there have been a number of variants that include additional or changed options. The fi...
Ludology just did a segment on this: <http://ludology.libsyn.com/biography-of-a-board-game-2005-cluedo> There are a lot of different versions out there and not all have the 6-6-9 ratio.
47,488
Are there any versions of Cluedo that do not have exactly 6 suspects, 6 murder weapons, and 9 rooms?
2019/06/07
[ "https://boardgames.stackexchange.com/questions/47488", "https://boardgames.stackexchange.com", "https://boardgames.stackexchange.com/users/26991/" ]
While all printed (*the [original patent](https://worldwide.espacenet.com/publicationDetails/biblio?FT=D&date=19470401&locale=en_EP&CC=GB&NR=586817A) had 10 characters*) editions of the classic Cluedo have the standard 6-6-9 ratio, there have been a number of variants that include additional or changed options. The fi...
**Yes.** One example (and there may well be others) is [Super Cluedo](https://boardgamegeek.com/boardgame/1561/clue-master-detective), also known as Clue Master Detective. Here is an excerpt of the publisher's description (according to that BGG link, anyway; I can't find the original source): > > The late Mr. Boddy's...
33,875,529
The code runs just fine but instead of using "for loop" to iterate upto 200000 , I think there can be a better alternative and I am having trouble finding it. I need help to optimise this solution.The time taken by this solution currently is 56ms. ``` #include <stdio.h> #include <math.h> #include <stdbool.h> int isPr...
2015/11/23
[ "https://Stackoverflow.com/questions/33875529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4439369/" ]
Don't put an arbitrary stop condition. You know that the list of primes is infinite and that the loop will eventually stop. Write it like this: ``` int returnNPrime (int N) { int counter = 0; int i; if (N == 1) return 2; for (i = 3; ; i += 2) { if (isPrime(i)) { counter+...
Read this paper <http://cr.yp.to/bib/1996/deleglise.pdf> which describes how to count the number of primes <= N in O (n^(2/3)) or so and implement the algorithm. It's substantially faster than the Eratosthenes sieve, because it doesn't actually *find* any primes but just counts how many there are. Make an educated gu...
33,875,529
The code runs just fine but instead of using "for loop" to iterate upto 200000 , I think there can be a better alternative and I am having trouble finding it. I need help to optimise this solution.The time taken by this solution currently is 56ms. ``` #include <stdio.h> #include <math.h> #include <stdbool.h> int isPr...
2015/11/23
[ "https://Stackoverflow.com/questions/33875529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4439369/" ]
Don't put an arbitrary stop condition. You know that the list of primes is infinite and that the loop will eventually stop. Write it like this: ``` int returnNPrime (int N) { int counter = 0; int i; if (N == 1) return 2; for (i = 3; ; i += 2) { if (isPrime(i)) { counter+...
OP's method consumes a lot of time with as it does not take advantage that there is no need to determine the remainder if `i` is not a prime. ``` for (i=2; i*i<=number; i++) { if (number % i == 0) return 0; ``` The [Sieve\_of\_Eratosthenes](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes) is likely faster yet ...
48,654,521
``` >>> sample = "asdf" >>> sample[-1:0] ``` I thought it would start with the last character up to the first position (but not including). However, it returns `''` when I expected `f`. Why is this happening?
2018/02/07
[ "https://Stackoverflow.com/questions/48654521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9324970/" ]
To go backwards *towards* the first element, you need a third argument to your slice, the *stride*: ``` sample[-1:0:-1] ``` This defaults to `1`, which moves forward one step at a time; setting it to `-1` moves backwards instead.
Remember the way to go about it is start, stop and step in the square brackets, you got the order wrong!
20,113,121
I have search high and low for an answer to my question and I cannot find it. Basically what I want to do is get the path after a php script. ex. "<http://www.example.com/index.php/arg1/arg2/arg3/etc/>" and get arg1, arg2, arg3, etc in an array. How can I do this in php and once I do this will "<http://www.example.com/...
2013/11/21
[ "https://Stackoverflow.com/questions/20113121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2985951/" ]
Here is how to get the answer, and a few others you will have in the future. Make a script, e.g. "test.php", and just put this one line in it: ``` <?php phpinfo(); ``` Then browse to it with <http://www.example.com/test.php/one/two/three/etc> Look through the `$_SERVER` values for the one that matches what you are ...
Can you try using `parse_url` and `parse_str` ``` $url =$_SERVER['REQUEST_URI']; $ParseUrl = parse_url($url); print_r($ParseUrl); $arr = parse_str($ParseUrl['query']); print_r($arr); ```
20,113,121
I have search high and low for an answer to my question and I cannot find it. Basically what I want to do is get the path after a php script. ex. "<http://www.example.com/index.php/arg1/arg2/arg3/etc/>" and get arg1, arg2, arg3, etc in an array. How can I do this in php and once I do this will "<http://www.example.com/...
2013/11/21
[ "https://Stackoverflow.com/questions/20113121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2985951/" ]
Here is how to get the answer, and a few others you will have in the future. Make a script, e.g. "test.php", and just put this one line in it: ``` <?php phpinfo(); ``` Then browse to it with <http://www.example.com/test.php/one/two/three/etc> Look through the `$_SERVER` values for the one that matches what you are ...
Try like this : ``` $url ="http://www.example.com/index.php/arg1/arg2/arg3/etc/"; $array = explode("/",parse_url($url, PHP_URL_PATH)); if (in_array('index.php', $array)) { unset($array[array_search('index.php',$array)]); } print_r(array_values(array_filter($array))); ```
20,113,121
I have search high and low for an answer to my question and I cannot find it. Basically what I want to do is get the path after a php script. ex. "<http://www.example.com/index.php/arg1/arg2/arg3/etc/>" and get arg1, arg2, arg3, etc in an array. How can I do this in php and once I do this will "<http://www.example.com/...
2013/11/21
[ "https://Stackoverflow.com/questions/20113121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2985951/" ]
Try like this : ``` $url ="http://www.example.com/index.php/arg1/arg2/arg3/etc/"; $array = explode("/",parse_url($url, PHP_URL_PATH)); if (in_array('index.php', $array)) { unset($array[array_search('index.php',$array)]); } print_r(array_values(array_filter($array))); ```
Can you try using `parse_url` and `parse_str` ``` $url =$_SERVER['REQUEST_URI']; $ParseUrl = parse_url($url); print_r($ParseUrl); $arr = parse_str($ParseUrl['query']); print_r($arr); ```
17,014,353
I am trying to build a simple Gtkada UI from examples found on elsewhere on the Internet. For instance [this one](http://lists.adacore.com/pipermail/gtkada/2012-September/004201.html). The examples use: ``` Gtk.Widget.Show_All (Get_Widget (Builder, "main_window")); ``` which seems reasonable enough, but I cannot fi...
2013/06/09
[ "https://Stackoverflow.com/questions/17014353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2469106/" ]
GtkAda 2013 is using Gtk3 instead of Gtk2, leading to following changes : 1. Get\_Widget is replaced by Get\_Object : Show\_All (Gtk\_Widget (Gtkada.Builder.Get\_Object (Builder, "fenetre"))); 2. Add\_From\_File profile is changed to a function : Retval := Add\_From\_File (Builder, GladeFileName, Error'Access);
An implementation of `Get_Widget` typically returns the `Gtk.Widget.Gtk_Widget_Record` (or an `access` value of type `Gtk.Widget.Gtk_Widget`) for a particular `Gtk.Widget`. The [example cited](http://lists.adacore.com/pipermail/gtkada/2012-September/004201.html) is a response to a [question](http://lists.adacore.com/p...
16,337,574
The codes for Google Analytics use a global `_gaq` object for the analytics commands. They advise to check if such an object already exists, like this: ``` var _gaq = _gaq || []; // Command _gaq.push(['_trackPageview']); ``` In CoffeeScript, this would look like this: ``` _gaq = _gaq or [] ``` Which compiles to t...
2013/05/02
[ "https://Stackoverflow.com/questions/16337574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/471436/" ]
To make the `_gaq` variable available in the **global scope** you could write this in coffeescript: ``` _gaq = window._gaq ?= [] ``` The javascript output: ``` var _gaq, _ref; _gaq = (_ref = window._gaq) != null ? _ref : window._gaq = []; ``` This way you can latter call `_gaq.push(['_trackPageview']);` There is...
You could do: ``` _gaq?.push ['_code'] ``` Which will compile to: ``` // Generated by CoffeeScript 1.6.2 (function() { if (typeof _gaq !== "undefined" && _gaq !== null) { _gaq.push(['_code']); } }).call(this); ```
16,337,574
The codes for Google Analytics use a global `_gaq` object for the analytics commands. They advise to check if such an object already exists, like this: ``` var _gaq = _gaq || []; // Command _gaq.push(['_trackPageview']); ``` In CoffeeScript, this would look like this: ``` _gaq = _gaq or [] ``` Which compiles to t...
2013/05/02
[ "https://Stackoverflow.com/questions/16337574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/471436/" ]
To make the `_gaq` variable available in the **global scope** you could write this in coffeescript: ``` _gaq = window._gaq ?= [] ``` The javascript output: ``` var _gaq, _ref; _gaq = (_ref = window._gaq) != null ? _ref : window._gaq = []; ``` This way you can latter call `_gaq.push(['_trackPageview']);` There is...
You can conditionally assign a value to a variable iff it doesn't exist elegantly like this: ``` window._gaq ?= [] ``` There are two tricky things going on here: 1. Note that I'm referencing `window._gaq`. The Google Analytics JavaScript attaches the `_gaq` object directly on the `window` object. For more info, see...
16,337,574
The codes for Google Analytics use a global `_gaq` object for the analytics commands. They advise to check if such an object already exists, like this: ``` var _gaq = _gaq || []; // Command _gaq.push(['_trackPageview']); ``` In CoffeeScript, this would look like this: ``` _gaq = _gaq or [] ``` Which compiles to t...
2013/05/02
[ "https://Stackoverflow.com/questions/16337574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/471436/" ]
You can conditionally assign a value to a variable iff it doesn't exist elegantly like this: ``` window._gaq ?= [] ``` There are two tricky things going on here: 1. Note that I'm referencing `window._gaq`. The Google Analytics JavaScript attaches the `_gaq` object directly on the `window` object. For more info, see...
You could do: ``` _gaq?.push ['_code'] ``` Which will compile to: ``` // Generated by CoffeeScript 1.6.2 (function() { if (typeof _gaq !== "undefined" && _gaq !== null) { _gaq.push(['_code']); } }).call(this); ```
515,571
I am now reading through a book to understand Fano's inequality, but I remember my professor explaining it in a certain way that made it seem so logical. I will go office hours as soon as possible, but for now can someone please try to explain to me Fano's inequality but not through math just in a "logical" way that m...
2013/10/05
[ "https://math.stackexchange.com/questions/515571", "https://math.stackexchange.com", "https://math.stackexchange.com/users/88697/" ]
I encourage you to think in terms of how many bits you need to transmit in order to know $X$ (a random variable) from $\hat{X}$ (an estimate). $H(X|\hat{X})$ is the average number of bits we need to transmit so the receiver can know $X$ with the knowledge of $\hat{X}$. We want to upper bound this. Imagine we use up s...
Suppose that we wish to estimate a random variable $X$, by an estimator $\hat{X}$ . Further more assume that $\mathbb{P}(\hat{X} \neq X) = \epsilon$. The question is what can we say about the conditional entropy $H(X\mid\hat{X})$. Intuitively, if $\epsilon$ is very small, then $H(X\mid\hat{X})$ should also be very smal...
515,571
I am now reading through a book to understand Fano's inequality, but I remember my professor explaining it in a certain way that made it seem so logical. I will go office hours as soon as possible, but for now can someone please try to explain to me Fano's inequality but not through math just in a "logical" way that m...
2013/10/05
[ "https://math.stackexchange.com/questions/515571", "https://math.stackexchange.com", "https://math.stackexchange.com/users/88697/" ]
Suppose that we wish to estimate a random variable $X$, by an estimator $\hat{X}$ . Further more assume that $\mathbb{P}(\hat{X} \neq X) = \epsilon$. The question is what can we say about the conditional entropy $H(X\mid\hat{X})$. Intuitively, if $\epsilon$ is very small, then $H(X\mid\hat{X})$ should also be very smal...
How many bits could measure $ X $ from $\hat{X}$? Of course, the more, the better. However, we want to upper bound the bits. First we want to use $ H(P\_{e}) $ bits to show whether $\hat{X}$ is right or not.If it is right, no more bits are needed.Or we must use $\log \left| \chi -1 \right|$ bits to distinguish ...
515,571
I am now reading through a book to understand Fano's inequality, but I remember my professor explaining it in a certain way that made it seem so logical. I will go office hours as soon as possible, but for now can someone please try to explain to me Fano's inequality but not through math just in a "logical" way that m...
2013/10/05
[ "https://math.stackexchange.com/questions/515571", "https://math.stackexchange.com", "https://math.stackexchange.com/users/88697/" ]
I encourage you to think in terms of how many bits you need to transmit in order to know $X$ (a random variable) from $\hat{X}$ (an estimate). $H(X|\hat{X})$ is the average number of bits we need to transmit so the receiver can know $X$ with the knowledge of $\hat{X}$. We want to upper bound this. Imagine we use up s...
How many bits could measure $ X $ from $\hat{X}$? Of course, the more, the better. However, we want to upper bound the bits. First we want to use $ H(P\_{e}) $ bits to show whether $\hat{X}$ is right or not.If it is right, no more bits are needed.Or we must use $\log \left| \chi -1 \right|$ bits to distinguish ...
745,624
I would like to differentiate the following with respect to $x$: $$f(x) = 1-xe^{1-x} \tag 1$$ How would I do this please? I can see that the 1 would disappear, then I am left with $$-\frac{d}{dx}xe^{1-x}\tag2$$ If the initial $x$ wasn't there, I would just replace $1-x$ with $u$ and work it out that way, but the mu...
2014/04/08
[ "https://math.stackexchange.com/questions/745624", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Here $f'(x)=- e^{1-x}+xe^{1-x}$ it is just an application of the product rule PRODUCT RULE: if $f (x)=g(x)h(x)$,then $ f'(x)=g'(x)h(x)+g(x)h'(x)$ now in our context $g(x)=x,\,h(x)=e^{1-x}$.
$f(x)=g(x)+m(x)\cdot h(t(x))$, where: $g(x)=1,$ $m(x) = x,$ $h(x)=e^x,$ $t(x)=1-x$ You have to apply the sum rule, product rule and chain rule.
23,203,542
Well, from a book i got the below lines: **Java defines several exception classes inside the standard package java.lang. The most general of these exceptions are subclasses of the standard type RuntimeException. Since java.lang is implicitly imported into all Java programs, most exceptions derived from RuntimeExceptio...
2014/04/21
[ "https://Stackoverflow.com/questions/23203542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1980729/" ]
The key to solving the problem was changing `android:windowBackground` in the theme to the following: ``` <item name="android:windowBackground">@drawable/default_background</item> ``` Notice that I am no longer using `@color`, but simply a `@drawable`, the xml for which is below: ``` <?xml version="1.0" encoding="u...
I found that the latest version of Android Studio expect that the parent for the style needs to be Theme.AppCompat. Also, it is good style to create a colors.xml file in the values directory (with named color elements between the resource tags). Put your RGB values as values to the named color elements. Reference them ...
6,707
I would like to develop a machine learning algorithm, given two photos, that can decide which image is more "artistic". I am thinking about somehow combining two images, giving it to a CNN, and get an output 0 (the first image is better) or 1 (the second image is better). Do you think this is a valid approach? Or coul...
2018/06/11
[ "https://ai.stackexchange.com/questions/6707", "https://ai.stackexchange.com", "https://ai.stackexchange.com/users/16201/" ]
You need to define a scoring function, which returns a value of whatever criterion you are interested in, be it 'artisticity' or 'heat'. This could be something you use a machine learning algorithm for, provided you have a set of training data with labelled images. You then need to extract features from the images. In...
I think the real problem is, what defines a more artistic image? It's really subjective, I think complexity of the work might be one aspect to consider but still a subjective one, you might want to make the purpose of your ML algorithm more objective or defined. But then again, It's just my opinion
6,707
I would like to develop a machine learning algorithm, given two photos, that can decide which image is more "artistic". I am thinking about somehow combining two images, giving it to a CNN, and get an output 0 (the first image is better) or 1 (the second image is better). Do you think this is a valid approach? Or coul...
2018/06/11
[ "https://ai.stackexchange.com/questions/6707", "https://ai.stackexchange.com", "https://ai.stackexchange.com/users/16201/" ]
I think the real problem is, what defines a more artistic image? It's really subjective, I think complexity of the work might be one aspect to consider but still a subjective one, you might want to make the purpose of your ML algorithm more objective or defined. But then again, It's just my opinion
My feeling is that, because you are dealing with a subject that his highly subjective, you need to integrate whatever learning algorithm you use with human feedback. This is to say, crowdsource human opinions on a data set of pictures, train the algorithm to try to intuit what qualities images with similar human ranki...
6,707
I would like to develop a machine learning algorithm, given two photos, that can decide which image is more "artistic". I am thinking about somehow combining two images, giving it to a CNN, and get an output 0 (the first image is better) or 1 (the second image is better). Do you think this is a valid approach? Or coul...
2018/06/11
[ "https://ai.stackexchange.com/questions/6707", "https://ai.stackexchange.com", "https://ai.stackexchange.com/users/16201/" ]
You need to define a scoring function, which returns a value of whatever criterion you are interested in, be it 'artisticity' or 'heat'. This could be something you use a machine learning algorithm for, provided you have a set of training data with labelled images. You then need to extract features from the images. In...
My feeling is that, because you are dealing with a subject that his highly subjective, you need to integrate whatever learning algorithm you use with human feedback. This is to say, crowdsource human opinions on a data set of pictures, train the algorithm to try to intuit what qualities images with similar human ranki...
8,236,262
I am trying really hard to grasp htaccess, but I am having a hard time figuring this one out. Let's say I have <http://www.example.com>. I am planning on moving the entire site into a folder like so <http://www.example.com/folder/> I created a folder and moved everything in it. How do I make sure that if someone fi...
2011/11/23
[ "https://Stackoverflow.com/questions/8236262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/455676/" ]
If you want to redirect every request from **example.com** to **example.com/folder** including css, js, html, php etc files then use the following ``` RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/folder.*$ [NC] RewriteRule ^(.*)$ /folder/$1 [L,R=301] ```
If you are using apache, try: ``` RewriteEngine on # make sure the requested URI doesn't go to an existing file/directory (e.g. starts with /folder RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # make sure the requested URI goes to an existing file/directory inside /folder RewriteCond %{DOCU...
51,082,285
I'm trying to create a filter to stop duplication in submitting forms, I have used findone and checked if it's null returns true and vise versa, but it always returns undefined ``` function checkParticipant(fname, mname, lname, foname){ Participant.findOne({ fname: fname, mname: mname, lname: lname, ...
2018/06/28
[ "https://Stackoverflow.com/questions/51082285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7374621/" ]
For calling a registered external RFC server program please read * [SAP Note 1877907 - Support of extern-to-extern RFC communication with JCo 3.0](https://launchpad.support.sap.com/#/notes/1877907) for the required destination configuration parameters. Instead of *jco.client.ashost* and *jco.client.sysnr* you need t...
DestinationDataProvider.JCO\_ASHOST and DestinationDataProvider.JCO\_SYSNR are the correct properties for specifying the target system. But only setting properties is not enough. You also have to get the new `JCoDestination` object with having these properties from `JCoDestinationManager.getDestination("MYDESTNAME")` a...
73,885
Without disclosing too much detail, a project that myself (the only junior on the project) and the team that I work in had to finish a 7 month project in 3 months. This meant the whole team had to work some crazy hours to get it done on time. So my question is, is it commonplace to not get paid for doing such hours? ...
2016/08/08
[ "https://workplace.stackexchange.com/questions/73885", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/53342/" ]
Yes, which is one reason why so many of us are contractors/consultants. If you're with a good company, they will compensate you with either comp time, or an IDGAF attitude towards what you are doing during slow times. If they are a bad company and don't compensate you, update your resume and prepare to move on. A fam...
tldr; Polish up your CV and get it out there. --- In the UK, employers do not have to pay overtime, but the average pay for the hours worked must not fall below minimum wage. You only HAVE to work overtime if compulsory overtime is stated in your contract. In any case, you are not allowed to work more than 48hours p...
73,885
Without disclosing too much detail, a project that myself (the only junior on the project) and the team that I work in had to finish a 7 month project in 3 months. This meant the whole team had to work some crazy hours to get it done on time. So my question is, is it commonplace to not get paid for doing such hours? ...
2016/08/08
[ "https://workplace.stackexchange.com/questions/73885", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/53342/" ]
Yes, which is one reason why so many of us are contractors/consultants. If you're with a good company, they will compensate you with either comp time, or an IDGAF attitude towards what you are doing during slow times. If they are a bad company and don't compensate you, update your resume and prepare to move on. A fam...
Historically, this was common practice. In the decade or so of the Agile movement, we've seen improvements. The basis of current good practice is that a team should maintain a [sustainable pace](http://c2.com/cgi/wiki?KentOnWardOnSustainablePace). Usually this means about 40 hours per week, and anything above that shou...
73,885
Without disclosing too much detail, a project that myself (the only junior on the project) and the team that I work in had to finish a 7 month project in 3 months. This meant the whole team had to work some crazy hours to get it done on time. So my question is, is it commonplace to not get paid for doing such hours? ...
2016/08/08
[ "https://workplace.stackexchange.com/questions/73885", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/53342/" ]
Yes, which is one reason why so many of us are contractors/consultants. If you're with a good company, they will compensate you with either comp time, or an IDGAF attitude towards what you are doing during slow times. If they are a bad company and don't compensate you, update your resume and prepare to move on. A fam...
One thing to consider is your own experience level. If it takes you longer than a more experienced person to do a given job at the same pay grade, maybe you should put the time in and work on your skills so you can get work done faster. To you it may seem like a 7 month job, but to someone more experienced it may be j...
73,885
Without disclosing too much detail, a project that myself (the only junior on the project) and the team that I work in had to finish a 7 month project in 3 months. This meant the whole team had to work some crazy hours to get it done on time. So my question is, is it commonplace to not get paid for doing such hours? ...
2016/08/08
[ "https://workplace.stackexchange.com/questions/73885", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/53342/" ]
Yes, which is one reason why so many of us are contractors/consultants. If you're with a good company, they will compensate you with either comp time, or an IDGAF attitude towards what you are doing during slow times. If they are a bad company and don't compensate you, update your resume and prepare to move on. A fam...
Yes, it does seem to be a common practice (by culture, not enforced by management). My advice is to double check your contract and abide by it. No doubt it says something like "40 hours per week plus reasonable overtime", so do that. Reasonable overtime in the UK seems to be about 8 hours per week (thanks @Pete), altho...
73,885
Without disclosing too much detail, a project that myself (the only junior on the project) and the team that I work in had to finish a 7 month project in 3 months. This meant the whole team had to work some crazy hours to get it done on time. So my question is, is it commonplace to not get paid for doing such hours? ...
2016/08/08
[ "https://workplace.stackexchange.com/questions/73885", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/53342/" ]
tldr; Polish up your CV and get it out there. --- In the UK, employers do not have to pay overtime, but the average pay for the hours worked must not fall below minimum wage. You only HAVE to work overtime if compulsory overtime is stated in your contract. In any case, you are not allowed to work more than 48hours p...
Historically, this was common practice. In the decade or so of the Agile movement, we've seen improvements. The basis of current good practice is that a team should maintain a [sustainable pace](http://c2.com/cgi/wiki?KentOnWardOnSustainablePace). Usually this means about 40 hours per week, and anything above that shou...
73,885
Without disclosing too much detail, a project that myself (the only junior on the project) and the team that I work in had to finish a 7 month project in 3 months. This meant the whole team had to work some crazy hours to get it done on time. So my question is, is it commonplace to not get paid for doing such hours? ...
2016/08/08
[ "https://workplace.stackexchange.com/questions/73885", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/53342/" ]
tldr; Polish up your CV and get it out there. --- In the UK, employers do not have to pay overtime, but the average pay for the hours worked must not fall below minimum wage. You only HAVE to work overtime if compulsory overtime is stated in your contract. In any case, you are not allowed to work more than 48hours p...
One thing to consider is your own experience level. If it takes you longer than a more experienced person to do a given job at the same pay grade, maybe you should put the time in and work on your skills so you can get work done faster. To you it may seem like a 7 month job, but to someone more experienced it may be j...
73,885
Without disclosing too much detail, a project that myself (the only junior on the project) and the team that I work in had to finish a 7 month project in 3 months. This meant the whole team had to work some crazy hours to get it done on time. So my question is, is it commonplace to not get paid for doing such hours? ...
2016/08/08
[ "https://workplace.stackexchange.com/questions/73885", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/53342/" ]
tldr; Polish up your CV and get it out there. --- In the UK, employers do not have to pay overtime, but the average pay for the hours worked must not fall below minimum wage. You only HAVE to work overtime if compulsory overtime is stated in your contract. In any case, you are not allowed to work more than 48hours p...
Yes, it does seem to be a common practice (by culture, not enforced by management). My advice is to double check your contract and abide by it. No doubt it says something like "40 hours per week plus reasonable overtime", so do that. Reasonable overtime in the UK seems to be about 8 hours per week (thanks @Pete), altho...
73,885
Without disclosing too much detail, a project that myself (the only junior on the project) and the team that I work in had to finish a 7 month project in 3 months. This meant the whole team had to work some crazy hours to get it done on time. So my question is, is it commonplace to not get paid for doing such hours? ...
2016/08/08
[ "https://workplace.stackexchange.com/questions/73885", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/53342/" ]
Historically, this was common practice. In the decade or so of the Agile movement, we've seen improvements. The basis of current good practice is that a team should maintain a [sustainable pace](http://c2.com/cgi/wiki?KentOnWardOnSustainablePace). Usually this means about 40 hours per week, and anything above that shou...
One thing to consider is your own experience level. If it takes you longer than a more experienced person to do a given job at the same pay grade, maybe you should put the time in and work on your skills so you can get work done faster. To you it may seem like a 7 month job, but to someone more experienced it may be j...
73,885
Without disclosing too much detail, a project that myself (the only junior on the project) and the team that I work in had to finish a 7 month project in 3 months. This meant the whole team had to work some crazy hours to get it done on time. So my question is, is it commonplace to not get paid for doing such hours? ...
2016/08/08
[ "https://workplace.stackexchange.com/questions/73885", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/53342/" ]
Historically, this was common practice. In the decade or so of the Agile movement, we've seen improvements. The basis of current good practice is that a team should maintain a [sustainable pace](http://c2.com/cgi/wiki?KentOnWardOnSustainablePace). Usually this means about 40 hours per week, and anything above that shou...
Yes, it does seem to be a common practice (by culture, not enforced by management). My advice is to double check your contract and abide by it. No doubt it says something like "40 hours per week plus reasonable overtime", so do that. Reasonable overtime in the UK seems to be about 8 hours per week (thanks @Pete), altho...
73,885
Without disclosing too much detail, a project that myself (the only junior on the project) and the team that I work in had to finish a 7 month project in 3 months. This meant the whole team had to work some crazy hours to get it done on time. So my question is, is it commonplace to not get paid for doing such hours? ...
2016/08/08
[ "https://workplace.stackexchange.com/questions/73885", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/53342/" ]
Yes, it does seem to be a common practice (by culture, not enforced by management). My advice is to double check your contract and abide by it. No doubt it says something like "40 hours per week plus reasonable overtime", so do that. Reasonable overtime in the UK seems to be about 8 hours per week (thanks @Pete), altho...
One thing to consider is your own experience level. If it takes you longer than a more experienced person to do a given job at the same pay grade, maybe you should put the time in and work on your skills so you can get work done faster. To you it may seem like a 7 month job, but to someone more experienced it may be j...
73,351,164
I have one problem with One to One relation. I have one USER that has only one TEAM User Entity ``` @Entity @Table(name = "USER") @Data @NoArgsConstructor @AllArgsConstructor @Builder public class User implements Serializable { private static final long serialVersionUID = 3233149207833106460L; @Id @Ge...
2022/08/14
[ "https://Stackoverflow.com/questions/73351164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19761551/" ]
If you execute pm2 as the root user, the logs will be stored in `/root/.pm2/logs/`. `sudo` executes commands as the root user, and that also entails that the home directory (referred to as `$HOME` or `~`) that the command sees is the root user's home directory, which usually is `/root`. So, if a program writes logs t...
By default, pm2 will store log files in ~/.pm2/logs.
73,351,164
I have one problem with One to One relation. I have one USER that has only one TEAM User Entity ``` @Entity @Table(name = "USER") @Data @NoArgsConstructor @AllArgsConstructor @Builder public class User implements Serializable { private static final long serialVersionUID = 3233149207833106460L; @Id @Ge...
2022/08/14
[ "https://Stackoverflow.com/questions/73351164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19761551/" ]
If you execute pm2 as the root user, the logs will be stored in `/root/.pm2/logs/`. `sudo` executes commands as the root user, and that also entails that the home directory (referred to as `$HOME` or `~`) that the command sees is the root user's home directory, which usually is `/root`. So, if a program writes logs t...
You can change the logs location like this: Generate an ecosystem file: ``` pm2 ecosystem simple ``` Then edit the ecosystem file and add lines for changing the default location: ``` module.exports = { apps : [{ name : "My Application", script : "./myapp.js", error_file : "/var/log/pm2/myapp/err.lo...
73,351,164
I have one problem with One to One relation. I have one USER that has only one TEAM User Entity ``` @Entity @Table(name = "USER") @Data @NoArgsConstructor @AllArgsConstructor @Builder public class User implements Serializable { private static final long serialVersionUID = 3233149207833106460L; @Id @Ge...
2022/08/14
[ "https://Stackoverflow.com/questions/73351164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19761551/" ]
If you execute pm2 as the root user, the logs will be stored in `/root/.pm2/logs/`. `sudo` executes commands as the root user, and that also entails that the home directory (referred to as `$HOME` or `~`) that the command sees is the root user's home directory, which usually is `/root`. So, if a program writes logs t...
I believe it's in `/root/.pm2/logs/`. Probably you haven't check them all using `ls -a`
18,888,185
First of all, I use PHP Dreamweaver to make a program with phpMyAdmin Database. This program gets my records in a 1st row blank when I submit the button, and the remaining records in a rows are still there which is 2nd row and below, but the records in a 1st row is still on the database, why should it happen? any idea ...
2013/09/19
[ "https://Stackoverflow.com/questions/18888185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2767696/" ]
The problem is that the operation creates a new array that you need to reassign to `content` like this: ``` content=content+:Array(e1,e2,e3,e4,e5,e6,e7,e8,e9) ``` or a little bit cleaner: ``` content ++= Array(e1,e2,e3,e4,e5,e6,e7,e8,e9) ``` I hope this is what you want, it's not too clear what you want to do fro...
Is there a particular reason you don't want to use `Array.concat`? Something like: ``` myResult = Array.concat(content, myQueryList) ``` (Provided `myQueryList` is an `Array[Array[String]]`).
1,404,889
I've been wondering whether *transparent* `implicit` conversions are really such a good idea and whether it might actually be better to use implicits more, um, *explicitly*. For example, suppose I have a method which accepts a `Date` as a parameter and I have an implicit conversion which turns a `String` into a `Date`:...
2009/09/10
[ "https://Stackoverflow.com/questions/1404889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16853/" ]
I believe that the more "explicit" way of doing implicit conversions is much better in terms of readability than the fully transparent one, at least in this example. In my opinion, using `implicit`s fully transparently from type `A` to type `B` is OK when you can *always* view an object of type `A` as being able to b...
When you make an implicit conversion from X to Y (like the conversion from String to Date above), you're essentially saying that, had you had full control over writing X in the first place, you would have made X implement or be a subclass of Y. If it makes sense for X to implement Y, then add the conversion. If it do...
5,338,994
I have a field named X where the fieldtype is Binary(15). Now I am updating the table with ``` Update Table_name Set X = 567845329090989 Where some_condition ``` Now after executing the above command in the table while viewing I am seeing that the column is updated with the following ``` 0x0000000F000001ADB920CB...
2011/03/17
[ "https://Stackoverflow.com/questions/5338994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/651362/" ]
* 567845329090989 is bigint decimal(15,0) * using Windows calculator, this is 0x20473CB20B9AD * the value above is 0x0000000F000001 **ADB920CB730402** 00 I forget exact details but it's to [do with endianess (SO)](https://stackoverflow.com/questions/2416557/sql-server-binary128-convert-from-little-endian-to-big-endian...
From comment by @gbn. The constant `567845329090989` is read as decimal(15,0) not bigint. ``` declare @T table (X binary(15)) declare @X bigint = 567845329090989 declare @Y decimal(15,0) = 567845329090989 insert into @T values (@X) insert into @T values (567845329090989) insert into @T values (@Y) select * from @T ...
35,021,557
I have a text string that I would like to split using VBA. I cannot figure out how to output it in the format desired. The objective is to split each of the 5 strings into an array, but the For loop I have created just splits the same string over and over. The idea is to split each string by it's equipment informatio...
2016/01/26
[ "https://Stackoverflow.com/questions/35021557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5843147/" ]
You could modify the plot function for `plot.MCMCglmm` to turn off the new page prompt. You can get the code for the function by typing `plot.MCMCglmm` in the console. ``` myPlotGLMM = function (x, random = FALSE, ...) { nF <- x$Fixed$nfl #devAskNewPage.orig <- devAskNewPage() if (random) { nF <- sum(rep(x$...
Another option is to plot everything onto one page. Without a reproducible example I can't test this but this should work: ``` pdf(file="model.pdf") par(mfrow=c(2,2)) plot(model, random=FALSE) dev.off() ``` So if this generated four plots, they would be arranged on one page in 2 x2 grid.
9,478,123
My application doesn't oriented even if I use ``` - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Override to allow orientations other than the default portrait orientation. return YES; } ``` the only thing I do is to hide the lower tab bar using ``` Search...
2012/02/28
[ "https://Stackoverflow.com/questions/9478123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/712104/" ]
Some ideas: * Are the "Supported Device Orientations" set properply? * Maybe a parent ViewController is not allowing interface orientation? * If testing on a device: Is it "orientation locked"? **Setting 'Supported Device Orientations' inside Info.plist:** ``` <key>UISupportedInterfaceOrientations</key> <array> ...
Please write - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Override to allow orientations other than the default portrait orientation. return YES; } in all your tab bar's root view controller. Can you tell me your which one is root view controller that tab view...
16,734,534
I have a problem trying to learn about sockets for network communication. I have made a simple thread that listens for connections and creates processes for connecting clients, my problem though is that I can't get the thread to join properly as I haven't found a way to cancel the socket.accept()-call when I want to qu...
2013/05/24
[ "https://Stackoverflow.com/questions/16734534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415935/" ]
One way to get the thread to close seems to be to make a connection to the socket, thus continuing the thread to completion. ``` def stop(self): self.running = False socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect( (self.hostname, self.port)) self.socket.close() ``` This work...
In most cases you will open a new thread or process once a connection is accepted. To close the connection, break the while loop. Garbage collection will remove the thread or process but join will ensure none get left behind. Persistent sockets close when the user closes them or they timeout. Non-persistent, like stat...
16,734,534
I have a problem trying to learn about sockets for network communication. I have made a simple thread that listens for connections and creates processes for connecting clients, my problem though is that I can't get the thread to join properly as I haven't found a way to cancel the socket.accept()-call when I want to qu...
2013/05/24
[ "https://Stackoverflow.com/questions/16734534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415935/" ]
One way to get the thread to close seems to be to make a connection to the socket, thus continuing the thread to completion. ``` def stop(self): self.running = False socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect( (self.hostname, self.port)) self.socket.close() ``` This work...
Partially tested solution 1. Put `self.socket.settimeout(0.1)` right before `while` 2. Put `conn.settimeout(None)` right after `accept`
16,734,534
I have a problem trying to learn about sockets for network communication. I have made a simple thread that listens for connections and creates processes for connecting clients, my problem though is that I can't get the thread to join properly as I haven't found a way to cancel the socket.accept()-call when I want to qu...
2013/05/24
[ "https://Stackoverflow.com/questions/16734534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415935/" ]
One way to get the thread to close seems to be to make a connection to the socket, thus continuing the thread to completion. ``` def stop(self): self.running = False socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect( (self.hostname, self.port)) self.socket.close() ``` This work...
A dirty solution which allows to exit your program is to use `os._exit(0)`. ``` def stop(self): self.socket.close() os._exit(0) ``` note that `sys.exit` doesn't work/blocks as it tries to exit cleanly/release resources. But `os._exit` is the most low level way and it works, when nothing else does. The opera...
16,734,534
I have a problem trying to learn about sockets for network communication. I have made a simple thread that listens for connections and creates processes for connecting clients, my problem though is that I can't get the thread to join properly as I haven't found a way to cancel the socket.accept()-call when I want to qu...
2013/05/24
[ "https://Stackoverflow.com/questions/16734534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415935/" ]
One way to get the thread to close seems to be to make a connection to the socket, thus continuing the thread to completion. ``` def stop(self): self.running = False socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect( (self.hostname, self.port)) self.socket.close() ``` This work...
The best way to do this is to have a single listening thread that has nothing to do with your connection threads and give it a reasonable length timeout. On timeout, check if this thread should shutdown and if not, loop again and go back to listening. ```py def tcp_listen_handle(self, port=23, connects=5, timeout=...
16,734,534
I have a problem trying to learn about sockets for network communication. I have made a simple thread that listens for connections and creates processes for connecting clients, my problem though is that I can't get the thread to join properly as I haven't found a way to cancel the socket.accept()-call when I want to qu...
2013/05/24
[ "https://Stackoverflow.com/questions/16734534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415935/" ]
In most cases you will open a new thread or process once a connection is accepted. To close the connection, break the while loop. Garbage collection will remove the thread or process but join will ensure none get left behind. Persistent sockets close when the user closes them or they timeout. Non-persistent, like stat...
Partially tested solution 1. Put `self.socket.settimeout(0.1)` right before `while` 2. Put `conn.settimeout(None)` right after `accept`
16,734,534
I have a problem trying to learn about sockets for network communication. I have made a simple thread that listens for connections and creates processes for connecting clients, my problem though is that I can't get the thread to join properly as I haven't found a way to cancel the socket.accept()-call when I want to qu...
2013/05/24
[ "https://Stackoverflow.com/questions/16734534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415935/" ]
In most cases you will open a new thread or process once a connection is accepted. To close the connection, break the while loop. Garbage collection will remove the thread or process but join will ensure none get left behind. Persistent sockets close when the user closes them or they timeout. Non-persistent, like stat...
The best way to do this is to have a single listening thread that has nothing to do with your connection threads and give it a reasonable length timeout. On timeout, check if this thread should shutdown and if not, loop again and go back to listening. ```py def tcp_listen_handle(self, port=23, connects=5, timeout=...
16,734,534
I have a problem trying to learn about sockets for network communication. I have made a simple thread that listens for connections and creates processes for connecting clients, my problem though is that I can't get the thread to join properly as I haven't found a way to cancel the socket.accept()-call when I want to qu...
2013/05/24
[ "https://Stackoverflow.com/questions/16734534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415935/" ]
A dirty solution which allows to exit your program is to use `os._exit(0)`. ``` def stop(self): self.socket.close() os._exit(0) ``` note that `sys.exit` doesn't work/blocks as it tries to exit cleanly/release resources. But `os._exit` is the most low level way and it works, when nothing else does. The opera...
Partially tested solution 1. Put `self.socket.settimeout(0.1)` right before `while` 2. Put `conn.settimeout(None)` right after `accept`
16,734,534
I have a problem trying to learn about sockets for network communication. I have made a simple thread that listens for connections and creates processes for connecting clients, my problem though is that I can't get the thread to join properly as I haven't found a way to cancel the socket.accept()-call when I want to qu...
2013/05/24
[ "https://Stackoverflow.com/questions/16734534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415935/" ]
The best way to do this is to have a single listening thread that has nothing to do with your connection threads and give it a reasonable length timeout. On timeout, check if this thread should shutdown and if not, loop again and go back to listening. ```py def tcp_listen_handle(self, port=23, connects=5, timeout=...
Partially tested solution 1. Put `self.socket.settimeout(0.1)` right before `while` 2. Put `conn.settimeout(None)` right after `accept`
16,734,534
I have a problem trying to learn about sockets for network communication. I have made a simple thread that listens for connections and creates processes for connecting clients, my problem though is that I can't get the thread to join properly as I haven't found a way to cancel the socket.accept()-call when I want to qu...
2013/05/24
[ "https://Stackoverflow.com/questions/16734534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415935/" ]
A dirty solution which allows to exit your program is to use `os._exit(0)`. ``` def stop(self): self.socket.close() os._exit(0) ``` note that `sys.exit` doesn't work/blocks as it tries to exit cleanly/release resources. But `os._exit` is the most low level way and it works, when nothing else does. The opera...
The best way to do this is to have a single listening thread that has nothing to do with your connection threads and give it a reasonable length timeout. On timeout, check if this thread should shutdown and if not, loop again and go back to listening. ```py def tcp_listen_handle(self, port=23, connects=5, timeout=...
294,153
Could some one point to articles / books on how to create good flow chart diagrams?
2008/11/16
[ "https://Stackoverflow.com/questions/294153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35948/" ]
**BoUML-it's free!** I've used this open source tool for the last 6 months at work to create UML diagrams: bouml.free.fr/ I've used it on both a Macbook running OS X, as well as Ubuntu Linux on a desktop, both with success. It also does codegen (although I haven't used this feature myself). If you create a diagram f...
Tutorial [here](http://www.nos.org/htm/basic2.htm). Also get a copy of Microsoft [Visio](http://office.microsoft.com/en-gb/visio/default.aspx).
294,153
Could some one point to articles / books on how to create good flow chart diagrams?
2008/11/16
[ "https://Stackoverflow.com/questions/294153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35948/" ]
Check this one out: <http://drakon-editor.sourceforge.net/DRAKON.pdf>
Tutorial [here](http://www.nos.org/htm/basic2.htm). Also get a copy of Microsoft [Visio](http://office.microsoft.com/en-gb/visio/default.aspx).
19,836,143
I want to hide the text field when I select from *item2* from the list. Here is the relevant part of my code: ``` <div class="control-group"> <label class="control-label">Select Parent</label> <div class="controls"> <select name="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabind...
2013/11/07
[ "https://Stackoverflow.com/questions/19836143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2809576/" ]
``` document.getElementById("op1").style.display="none"; ```
Use this one: ``` document.getElementById("id").style.display = "none"; ``` or ``` document.getElementById("id").style.visibility = "hidden"; ```
19,836,143
I want to hide the text field when I select from *item2* from the list. Here is the relevant part of my code: ``` <div class="control-group"> <label class="control-label">Select Parent</label> <div class="controls"> <select name="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabind...
2013/11/07
[ "https://Stackoverflow.com/questions/19836143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2809576/" ]
``` document.getElementById("op1").style.display="none"; ```
try this, ``` document.getElementById("op1").style.display="none"; ```
19,836,143
I want to hide the text field when I select from *item2* from the list. Here is the relevant part of my code: ``` <div class="control-group"> <label class="control-label">Select Parent</label> <div class="controls"> <select name="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabind...
2013/11/07
[ "https://Stackoverflow.com/questions/19836143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2809576/" ]
You've placed your event handler in an `onclick` attribute of an `<option>` element. This probably isn't going to work as intended. Instead, add an `onchange` event handler to its parent `<select>` element as follows: ``` <select name="parent_id" ... onchange="document.getElementById('op1').style.visibility=(this.sele...
``` document.getElementById("op1").style.display="none"; ```
19,836,143
I want to hide the text field when I select from *item2* from the list. Here is the relevant part of my code: ``` <div class="control-group"> <label class="control-label">Select Parent</label> <div class="controls"> <select name="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabind...
2013/11/07
[ "https://Stackoverflow.com/questions/19836143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2809576/" ]
You've placed your event handler in an `onclick` attribute of an `<option>` element. This probably isn't going to work as intended. Instead, add an `onchange` event handler to its parent `<select>` element as follows: ``` <select name="parent_id" ... onchange="document.getElementById('op1').style.visibility=(this.sele...
For a list like the one you have it is required to add the event handling on the select element. ``` <select name="parent_id" id="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabindex="1" onchange="myFunction()"> <option value="0" >Select Parent</option> <option value="item2" > item2 </op...
19,836,143
I want to hide the text field when I select from *item2* from the list. Here is the relevant part of my code: ``` <div class="control-group"> <label class="control-label">Select Parent</label> <div class="controls"> <select name="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabind...
2013/11/07
[ "https://Stackoverflow.com/questions/19836143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2809576/" ]
It should be: `document.getElementById("op1").style.display="none";` instead of: `document.getElementById("op1").style.visibility="hidden";`
Use this one: ``` document.getElementById("id").style.display = "none"; ``` or ``` document.getElementById("id").style.visibility = "hidden"; ```
19,836,143
I want to hide the text field when I select from *item2* from the list. Here is the relevant part of my code: ``` <div class="control-group"> <label class="control-label">Select Parent</label> <div class="controls"> <select name="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabind...
2013/11/07
[ "https://Stackoverflow.com/questions/19836143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2809576/" ]
You've placed your event handler in an `onclick` attribute of an `<option>` element. This probably isn't going to work as intended. Instead, add an `onchange` event handler to its parent `<select>` element as follows: ``` <select name="parent_id" ... onchange="document.getElementById('op1').style.visibility=(this.sele...
It should be: `document.getElementById("op1").style.display="none";` instead of: `document.getElementById("op1").style.visibility="hidden";`
19,836,143
I want to hide the text field when I select from *item2* from the list. Here is the relevant part of my code: ``` <div class="control-group"> <label class="control-label">Select Parent</label> <div class="controls"> <select name="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabind...
2013/11/07
[ "https://Stackoverflow.com/questions/19836143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2809576/" ]
For a list like the one you have it is required to add the event handling on the select element. ``` <select name="parent_id" id="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabindex="1" onchange="myFunction()"> <option value="0" >Select Parent</option> <option value="item2" > item2 </op...
try this, ``` document.getElementById("op1").style.display="none"; ```
19,836,143
I want to hide the text field when I select from *item2* from the list. Here is the relevant part of my code: ``` <div class="control-group"> <label class="control-label">Select Parent</label> <div class="controls"> <select name="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabind...
2013/11/07
[ "https://Stackoverflow.com/questions/19836143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2809576/" ]
You've placed your event handler in an `onclick` attribute of an `<option>` element. This probably isn't going to work as intended. Instead, add an `onchange` event handler to its parent `<select>` element as follows: ``` <select name="parent_id" ... onchange="document.getElementById('op1').style.visibility=(this.sele...
try this, ``` document.getElementById("op1").style.display="none"; ```
19,836,143
I want to hide the text field when I select from *item2* from the list. Here is the relevant part of my code: ``` <div class="control-group"> <label class="control-label">Select Parent</label> <div class="controls"> <select name="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabind...
2013/11/07
[ "https://Stackoverflow.com/questions/19836143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2809576/" ]
For a list like the one you have it is required to add the event handling on the select element. ``` <select name="parent_id" id="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabindex="1" onchange="myFunction()"> <option value="0" >Select Parent</option> <option value="item2" > item2 </op...
Use this one: ``` document.getElementById("id").style.display = "none"; ``` or ``` document.getElementById("id").style.visibility = "hidden"; ```
19,836,143
I want to hide the text field when I select from *item2* from the list. Here is the relevant part of my code: ``` <div class="control-group"> <label class="control-label">Select Parent</label> <div class="controls"> <select name="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabind...
2013/11/07
[ "https://Stackoverflow.com/questions/19836143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2809576/" ]
You've placed your event handler in an `onclick` attribute of an `<option>` element. This probably isn't going to work as intended. Instead, add an `onchange` event handler to its parent `<select>` element as follows: ``` <select name="parent_id" ... onchange="document.getElementById('op1').style.visibility=(this.sele...
Use this one: ``` document.getElementById("id").style.display = "none"; ``` or ``` document.getElementById("id").style.visibility = "hidden"; ```
4,923,093
> > **Possible Duplicate:** > > [Difference between 'struct' and 'typedef struct' in C++?](https://stackoverflow.com/questions/612328/difference-between-struct-and-typedef-struct-in-c) > > > what is the difference between: ``` struct a{ ... } ``` and ``` typedef struct{ ... } a; ``` ?
2011/02/07
[ "https://Stackoverflow.com/questions/4923093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/591005/" ]
In C++, there is no difference. In C, however, use of ``` struct a { ... }; ``` Requires you to use the following to declare variables: ``` int main ( int, char ** ) { struct a instance; } ``` To avoid the redundant `struct` in variable declarations, use of the aforementioned `typedef` is required and allows...
In the first to declare you must say `struct a my_struct;` in the latter you simply say `a my_struct;`
23,904,690
I built a block of view in drupal 7 that display a nodes from a specific type in slideshow. When something change in one of the nodes, data or publish/unpublished, I want to reload the view automatic with no click or reload. I understand I can do it with ajax. I found few examples but in all I need to click on somet...
2014/05/28
[ "https://Stackoverflow.com/questions/23904690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1980099/" ]
Just create the link manually ``` <a href="{{ action('BookController@delete', [$book->id]) }}" class="btn btn-danger" data-title="Confirm" data-content="Are you sure?"> <i class="glyphicon glyphicon-trash"></i>Delete</a> ```
Passing the `title` as a string does not help, because the title is being converted to htmlentitiies: ``` /** * Convert an HTML string to entities. * * @param string $value * @return string */ public function entities($value) { return htmlentities($value, ENT_QUOTES, 'UTF-8', false); } ``` What you can do...
19,587,066
I'm trying to load html pages stored inside the jar file into a help JEditorPane. So far it works when I run it in eclipse but when i make a runnable jar it wont work, except if i put the map res/pages/... in the same map with the jar file ``` class HelpButtonHandler implements ActionListener{ @Override ...
2013/10/25
[ "https://Stackoverflow.com/questions/19587066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2919457/" ]
A file packaged inside a .jar is not a file on the file system. You cannot access it with the File class. A file inside a .jar is called an application resource. You access it using the [Class.getResource](http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getResource%28java.lang.String%29) method: ``` url...
use gerResource() method... ``` url = getClass().getClassLoader().getResource("res/pages/help.html"); ``` check this link <http://oakgreen.blogspot.com/2011/12/java-getclassgetclassloadergetresourcem.html>
19,587,066
I'm trying to load html pages stored inside the jar file into a help JEditorPane. So far it works when I run it in eclipse but when i make a runnable jar it wont work, except if i put the map res/pages/... in the same map with the jar file ``` class HelpButtonHandler implements ActionListener{ @Override ...
2013/10/25
[ "https://Stackoverflow.com/questions/19587066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2919457/" ]
When you put resources in a jar, you cannot access them using `File`. You need to access them as a resource through the (more precisely: *a*) classloader. For example: ``` HelpButtonHandler.class.getResource("/res/pages/help.html"); ``` Make sure you put the resource in the right place: if you leave out the first sl...
use gerResource() method... ``` url = getClass().getClassLoader().getResource("res/pages/help.html"); ``` check this link <http://oakgreen.blogspot.com/2011/12/java-getclassgetclassloadergetresourcem.html>
19,587,066
I'm trying to load html pages stored inside the jar file into a help JEditorPane. So far it works when I run it in eclipse but when i make a runnable jar it wont work, except if i put the map res/pages/... in the same map with the jar file ``` class HelpButtonHandler implements ActionListener{ @Override ...
2013/10/25
[ "https://Stackoverflow.com/questions/19587066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2919457/" ]
A file packaged inside a .jar is not a file on the file system. You cannot access it with the File class. A file inside a .jar is called an application resource. You access it using the [Class.getResource](http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getResource%28java.lang.String%29) method: ``` url...
When you put resources in a jar, you cannot access them using `File`. You need to access them as a resource through the (more precisely: *a*) classloader. For example: ``` HelpButtonHandler.class.getResource("/res/pages/help.html"); ``` Make sure you put the resource in the right place: if you leave out the first sl...
236
Let's say I'm editing a latex in Auctex's latex-mode, and I have the following equation. **This is just indented with `indent-region`.** ``` \begin{align} \phi & = a + b + c + d \\ & = a + b + c + d + e \end{align} ``` The above alignment is what I get if I select everything and hit `TAB`, that is...
2014/09/25
[ "https://emacs.stackexchange.com/questions/236", "https://emacs.stackexchange.com", "https://emacs.stackexchange.com/users/50/" ]
The result that you want is already an AUCTeX feature since [October 2013](http://git.savannah.gnu.org/cgit/auctex.git/commit/latex.el?id=f8c1d44c62f958e19d924deeb51c54f2413e1ef6). This is not yet present in the current release (11.87). All you have to do is mark the region and hit `TAB`. See [`LaTeX-hanging-ampersand-...
Assuming that you don't have any blank lines between the \begin and \end of your equations, you can call this function while your cursor is anywhere within the \begin-\end region. ``` (defun my/align-latex-eq () "Align the & chars and then align the +/= chars." (interactive) (backward-paragraph) (mark-paragrap...
248,504
I'm trying to run a QEMU VM but it doesn't have an internet access, only access to the host and a Docker network. What I did: 1. Created a bridge with: `brctl addbr virbr0`; 2. Turned it on: `ip link set up dev virbr0`; 3. Assigned an IP: `ip addr add 192.168.66.1/24`; 4. Updated the QEMU config: `echo "allow virbr0"...
2015/12/10
[ "https://unix.stackexchange.com/questions/248504", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/146846/" ]
To make it works I had to enable NAT. ``` $ iptables -t nat -A POSTROUTING -o envmw -j MASQUERADE $ iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT $ iptables -A FORWARD -i virbr0 -o envmw -j ACCEPT ```
You haven't added a physical interface (`envmw`) to your bridge. You also need to set that interface to promiscuous mode without an IP address: ``` brctl addif virbr0 envmw ip addr add 0/0 dev envmw ip addr del 192.168.66.1/24 dev envmw ip link set envmw promisc on ``` Running these commands from a remote session is...
50,503,512
I have a task to: > > Modify the class Car so that it overrides the method setCapacity with its own version which output the message "Cannot change capacity of a car" and does not change the engine capacity. > > > I attempted to solve the task which the code below, but it keeps on using the `Vehicle` class's `set...
2018/05/24
[ "https://Stackoverflow.com/questions/50503512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Your `setCapacity()` method of the `Car` class doesn't override the `setCapacity(int newCapacity)` method of the `Vehicle` class. In order to override a method of the base class, the sub-class method must have the same signature. Change ``` public void setCapacity() { System.out.println("Cannot change capacity of...
The problem may be that the class Car's method whose name is "setCapacity", it is not override its parent class Vehicle's method with the same name.Because it has not a param, but there is a param in its parent class. Hope can help you!
19,887,537
Suppose I have a socket: ``` std::shared_ptr<tcp::socket> socket( new tcp::socket(acceptor.get_io_service()) ); acceptor.async_accept( *socket, std::bind( handleAccept, this, std::placeholders::_1, socket, std::ref(acceptor)) ); ``` And I store a weak\_ptr to the said socket in a container. I need this because I wan...
2013/11/10
[ "https://Stackoverflow.com/questions/19887537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/325016/" ]
A TCP socket disconnect is usually signalled in `asio` by an `eof` or a `connection_reset`. E.g. ``` void async_receive(boost::system::error_code const& error, size_t bytes_transferred) { if ((boost::asio::error::eof == error) || (boost::asio::error::connection_reset == error)) ...
There are many options, some of them are: 1. As you store `weak_ptr` in container - it will not prolong lifetime of socket, so when your handler will get `boost::asio::error::eof` (or whatever), it will not do copy/move of `shared_ptr`, and socket will be deleted (if you don't have any others `shared_ptr`s to it). So,...
65,243,019
I have a code that split my char str[] to tokens: ``` void my_function(char str[]) { int i = 0; char *p = strtok(str, "/"); char *rows[SIZE] = { NULL }; while(p==NULL) { rows[i++] = p; p = strtok(NULL, "/"); } } ``` There is a problem with 2 tokens('/')...
2020/12/10
[ "https://Stackoverflow.com/questions/65243019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9453397/" ]
You may need to sort your dataframe in a very specific way. If your last `False` in the `ascending` parameter was changed to `True`, then you would get a different answer, so you should make sure it is sorted like that. Then, use can use your `groupby` with `idxmin()[0]` to return the index minimum value (`[0]` gets r...
You could first get the minimum, compare with each row, then get the index with max count and finally filter for that row: ``` cond1 = df.groupby(["experiment", "replicate"]).fdr.transform("min") row_with_max_count = df.loc[df.fdr.eq(cond1), "count"].idxmax() df.loc[[row_with_max_count]] experiment replicate c...
65,243,019
I have a code that split my char str[] to tokens: ``` void my_function(char str[]) { int i = 0; char *p = strtok(str, "/"); char *rows[SIZE] = { NULL }; while(p==NULL) { rows[i++] = p; p = strtok(NULL, "/"); } } ``` There is a problem with 2 tokens('/')...
2020/12/10
[ "https://Stackoverflow.com/questions/65243019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9453397/" ]
You could first get the minimum, compare with each row, then get the index with max count and finally filter for that row: ``` cond1 = df.groupby(["experiment", "replicate"]).fdr.transform("min") row_with_max_count = df.loc[df.fdr.eq(cond1), "count"].idxmax() df.loc[[row_with_max_count]] experiment replicate c...
``` import pandas as pd data = { 'experiment' : ['a', 'a', 'a'], 'replicate' : [1, 1, 1], 'count' : [10,8,9], 'fdr' : [0.01,0,0],} df = pd.DataFrame(data) ``` gives ``` experiment replicate count fdr 0 a 1 10 0.01 1 a 1 8 0.00 2 ...
65,243,019
I have a code that split my char str[] to tokens: ``` void my_function(char str[]) { int i = 0; char *p = strtok(str, "/"); char *rows[SIZE] = { NULL }; while(p==NULL) { rows[i++] = p; p = strtok(NULL, "/"); } } ``` There is a problem with 2 tokens('/')...
2020/12/10
[ "https://Stackoverflow.com/questions/65243019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9453397/" ]
You may need to sort your dataframe in a very specific way. If your last `False` in the `ascending` parameter was changed to `True`, then you would get a different answer, so you should make sure it is sorted like that. Then, use can use your `groupby` with `idxmin()[0]` to return the index minimum value (`[0]` gets r...
``` import pandas as pd data = { 'experiment' : ['a', 'a', 'a'], 'replicate' : [1, 1, 1], 'count' : [10,8,9], 'fdr' : [0.01,0,0],} df = pd.DataFrame(data) ``` gives ``` experiment replicate count fdr 0 a 1 10 0.01 1 a 1 8 0.00 2 ...
4,760,610
I am having issues with 'data overload' while processing [point cloud](http://en.wikipedia.org/wiki/Point_cloud) data in MATLAB. This is what I am currently doing: 1. I begin with my raw data files, each in the order of ~30Mb each. 2. I then do initial processing on them to extract n individual objects and remove outl...
2011/01/21
[ "https://Stackoverflow.com/questions/4760610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279858/" ]
For a similar problem, I have created a class structure that does the following: * Each object is linked to a raw data file * For each processing step, there is a property * The set method of the properties saves the data to file (in a directory with the same name as the raw data file), stores the file name, and upda...
I'm not completely sure if this is what you need, but the [save command](http://www.mathworks.com/help/techdoc/ref/save.html) allows you to store multiple variables inside a single .mat file. If your parameter settings are, for example, stored in an array, then you can save this together with the data set in a single ....
207,306
So I'm trying to restore my backup files with Déjà Dup, however, each time I enter in the correct password, it keeps asking for it over and over again. This seems to be a bug, and I have found a couple of bug reports already reported on this issue. I am currently using 12.04, it did not also work in 12.10. Is there a...
2012/10/27
[ "https://askubuntu.com/questions/207306", "https://askubuntu.com", "https://askubuntu.com/users/101428/" ]
Déjà Dup is a (very useful) frontend to the `duplicity` command line program. There are instructions on using it to restore backups on the GNOME wiki: [Apps/DejaDup/Help/Restore/WorstCase - GNOME Wiki!](https://wiki.gnome.org/Apps/DejaDup/Help/Restore/WorstCase)
You can't. You need to reinstall Deja dup manually or google another program to restore your backup.