qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
sequence
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
263,238
I have a prediction model tested with four methods as you can see in the boxplot figure below. The attribute that the model predicts is in range of 0-8. You may notice that there is **one upper-bound outlier** and **three lower-bound outliers** indicated by all methods. I wonder if it is appropriate to remove these instances from the data? Or is this a sort of cheating to improve the prediction model? [![enter image description here](https://i.stack.imgur.com/dFVsJ.png)](https://i.stack.imgur.com/dFVsJ.png)
2017/02/21
[ "https://stats.stackexchange.com/questions/263238", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/91142/" ]
It is **almost always** a cheating to remove observations **to improve** a regression model. You should drop observations only when you truly think that these are in fact outliers. For instance, you have time series from the heart rate monitor connected to your smart watch. If you take a look at the series, it's easy to see that there would be erroneous observations with readings like 300bps. These should be removed, but not because you want to improve the model (whatever it means). They're errors in reading which have nothing to do with your heart rate. One thing to be careful though is the correlation of errors with the data. In my example it could be argued that you have errors when the heart rate monitor is displaced during exercises such as running o jumping. Which will make these errors correlated with the hart rate. In this case, care must be taken in removal of these outliers and errors, because they are not [at random](http://missingdata.lshtm.ac.uk/index.php?option=com_content&view=article&id=76:missing-at-random-mar&catid=40:missingness-mechanisms&Itemid=96) I'll give you a made up example of when to not remove **outliers**. Let's say you're measuring the movement of a weight on a spring. If the weight is *small relative to the strength* of the weight, then you'll notice that [Hooke's law](https://en.wikipedia.org/wiki/Hooke's_law) works very well: $$F=-k\Delta x,$$ where $F$ is force, $k$ - tension coefficient and $\Delta x$ is the position of the weight. Now if you put a very heavy weight or displace the weight too much, you'll start seeing deviations: at large enough displacements $\Delta x$ the motion will seem to deviate from the linear model. So, you might be tempted to remove the *outliers* to improve the linear model. This would not be a good idea, because the model is not working very well since Hooke's law is only approximately right. UPDATE In your case I would suggest pulling those data points and looking at them closer. Could it be lab instrument failure? External interference? Sample defect? etc. Next try to identify whether the presnece of these outliers could be correlated with what you measure like in the example I gave. If there's correlation then there's no simple way to go about it. If there's no correlation then you can remove the outliers
I believe it is only reasonable to remove outliers when one has a solid qualitative reason for doing so. By this I mean that one has information that another variable, that is not in the model, is impacting the outlier observations. Then one has the choice of removing the outlier or adding additional variables. I find that when I have outlier observations within my dataset, by studying to determine why the outlier exists, I learn more about my data and possible other models to consider.
263,238
I have a prediction model tested with four methods as you can see in the boxplot figure below. The attribute that the model predicts is in range of 0-8. You may notice that there is **one upper-bound outlier** and **three lower-bound outliers** indicated by all methods. I wonder if it is appropriate to remove these instances from the data? Or is this a sort of cheating to improve the prediction model? [![enter image description here](https://i.stack.imgur.com/dFVsJ.png)](https://i.stack.imgur.com/dFVsJ.png)
2017/02/21
[ "https://stats.stackexchange.com/questions/263238", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/91142/" ]
It is **almost always** a cheating to remove observations **to improve** a regression model. You should drop observations only when you truly think that these are in fact outliers. For instance, you have time series from the heart rate monitor connected to your smart watch. If you take a look at the series, it's easy to see that there would be erroneous observations with readings like 300bps. These should be removed, but not because you want to improve the model (whatever it means). They're errors in reading which have nothing to do with your heart rate. One thing to be careful though is the correlation of errors with the data. In my example it could be argued that you have errors when the heart rate monitor is displaced during exercises such as running o jumping. Which will make these errors correlated with the hart rate. In this case, care must be taken in removal of these outliers and errors, because they are not [at random](http://missingdata.lshtm.ac.uk/index.php?option=com_content&view=article&id=76:missing-at-random-mar&catid=40:missingness-mechanisms&Itemid=96) I'll give you a made up example of when to not remove **outliers**. Let's say you're measuring the movement of a weight on a spring. If the weight is *small relative to the strength* of the weight, then you'll notice that [Hooke's law](https://en.wikipedia.org/wiki/Hooke's_law) works very well: $$F=-k\Delta x,$$ where $F$ is force, $k$ - tension coefficient and $\Delta x$ is the position of the weight. Now if you put a very heavy weight or displace the weight too much, you'll start seeing deviations: at large enough displacements $\Delta x$ the motion will seem to deviate from the linear model. So, you might be tempted to remove the *outliers* to improve the linear model. This would not be a good idea, because the model is not working very well since Hooke's law is only approximately right. UPDATE In your case I would suggest pulling those data points and looking at them closer. Could it be lab instrument failure? External interference? Sample defect? etc. Next try to identify whether the presnece of these outliers could be correlated with what you measure like in the example I gave. If there's correlation then there's no simple way to go about it. If there's no correlation then you can remove the outliers
I'm not even convinced that they are "outliers". You might want to look make a normal probability plot. Are they data or residuals from fitting a model?
56,943,623
Hi, I have this html code: ``` <ul> <li> <a href="#">Locations</a> <ul class="submenu1"> <li><a href="https://url.com">London</a></li> <li><a href="https://url.com">York</a></li> </ul> </li> <li> <a href="#">About</a> <ul class="submenu2"> <li><a href="https://url.com">Site</a></li> <li><a href="https://url.com">Contact</a></li> </ul> </li> </ul> ``` I want to select all the a elements EXCEPT the ones that are children to the `submenu` class elements. I tried like this: ``` ul li a:not([class^="submenu"] a) {background-color:darkkhaki;} ``` but it wont work. Whats the right selector for this case? Thank you.
2019/07/08
[ "https://Stackoverflow.com/questions/56943623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2230939/" ]
Hello dear CSS friend! In other words, taking your example, you want to select "Locations" and "About" links but not the others. (Kind of) dirty one ------------------- The easier to understand solution is to apply styles to all `a` then remove the styles to the others. ``` li > a { /* Styles you want to apply */ } [class^="submenu"] a { /* Remove styles here */ } ``` It's always dirty to place styles then remove them, because it's less maintainable and a bit more heavy. But it will do the job. Nicer solution -------------- In your case, the submenu links are the only child of your `li` elements. That's why I would try to target the links that are not only child of your list item to style those, like that. ``` li a:not(:only-child) { /* Your styles here */ } ``` For more information on :only-child pseudo class, I leave you with some reading :) <https://developer.mozilla.org/fr/docs/Web/CSS/:only-child> Don't hesitate if you have question, and have fun!
**Option 1:** This will work: ``` ul li a { background-color: darkkhaki; } ul ul li a { background-color: transparent; } ``` Just reset the styles on the elements you don't want styled. **Option 2:** If you have a container, for example a `<div id="menu">` you can do: ``` #menu > ul > li > a { background-color: darkkhaki; } ```
15,150,430
I am trying to use the TimePicker in the 24 hour format and I am using setIs24HourView= true, but I am still not getting 24 hour format on the TimePicker. Here is my code in the onCreate of the Activity. ``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); ``` I even tried timePicker.setCurrentHour(cal.HOUR\_OF\_DAY) after setIs24HourView, but I am not able to see the 24 hour format on the TimePicker. ``` <TimePicker android:id="@+id/timePicker1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="110dp" /> ``` Am I missing anything here? ![enter image description here](https://i.stack.imgur.com/UHJoY.jpg)
2013/03/01
[ "https://Stackoverflow.com/questions/15150430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103792/" ]
ok, I see what the problem is now. It's not correctly setting the currentHour to the new 24 hour format, which is why you got 9:05 instead of 21:05. I'm guessing it isn't 9am where you are! It is a bug, as mentioned in this [question](https://stackoverflow.com/questions/13662288/timepicker-hour-doesnt-update-after-switching-to-24h) seems the only work around, for now, is to do something like: ``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); timePicker.setCurrentHour(Calendar.get(Calendar.HOUR_OF_DAY)); ``` I see you tried cal.HOUR\_OF\_DAY, but didn't provide the code you actually used, but try this and see if it helps.
You can just use the device settings and thus let the user make this decision; ``` String clockType = android.provider.Settings.System.getString(context.getContentResolver(), android.provider.Settings.System.TIME_12_24); ```
15,150,430
I am trying to use the TimePicker in the 24 hour format and I am using setIs24HourView= true, but I am still not getting 24 hour format on the TimePicker. Here is my code in the onCreate of the Activity. ``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); ``` I even tried timePicker.setCurrentHour(cal.HOUR\_OF\_DAY) after setIs24HourView, but I am not able to see the 24 hour format on the TimePicker. ``` <TimePicker android:id="@+id/timePicker1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="110dp" /> ``` Am I missing anything here? ![enter image description here](https://i.stack.imgur.com/UHJoY.jpg)
2013/03/01
[ "https://Stackoverflow.com/questions/15150430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103792/" ]
I notice this problem in jelly bean You can set the time to show in 24 hour view ``` TimePicker picker = (TimePicker) findViewById(R.id.timePicker1); picker.setIs24HourView(true); Calendar calendar = Calendar.getInstance(); int h = calendar.get(Calendar.HOUR_OF_DAY); int m = calendar.get(Calendar.MINUTE); picker.setCurrentHour(h); picker.setCurrentMinute(m); ```
You can just use the device settings and thus let the user make this decision; ``` String clockType = android.provider.Settings.System.getString(context.getContentResolver(), android.provider.Settings.System.TIME_12_24); ```
15,150,430
I am trying to use the TimePicker in the 24 hour format and I am using setIs24HourView= true, but I am still not getting 24 hour format on the TimePicker. Here is my code in the onCreate of the Activity. ``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); ``` I even tried timePicker.setCurrentHour(cal.HOUR\_OF\_DAY) after setIs24HourView, but I am not able to see the 24 hour format on the TimePicker. ``` <TimePicker android:id="@+id/timePicker1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="110dp" /> ``` Am I missing anything here? ![enter image description here](https://i.stack.imgur.com/UHJoY.jpg)
2013/03/01
[ "https://Stackoverflow.com/questions/15150430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103792/" ]
ok, I see what the problem is now. It's not correctly setting the currentHour to the new 24 hour format, which is why you got 9:05 instead of 21:05. I'm guessing it isn't 9am where you are! It is a bug, as mentioned in this [question](https://stackoverflow.com/questions/13662288/timepicker-hour-doesnt-update-after-switching-to-24h) seems the only work around, for now, is to do something like: ``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); timePicker.setCurrentHour(Calendar.get(Calendar.HOUR_OF_DAY)); ``` I see you tried cal.HOUR\_OF\_DAY, but didn't provide the code you actually used, but try this and see if it helps.
I notice this problem in jelly bean You can set the time to show in 24 hour view ``` TimePicker picker = (TimePicker) findViewById(R.id.timePicker1); picker.setIs24HourView(true); Calendar calendar = Calendar.getInstance(); int h = calendar.get(Calendar.HOUR_OF_DAY); int m = calendar.get(Calendar.MINUTE); picker.setCurrentHour(h); picker.setCurrentMinute(m); ```
15,150,430
I am trying to use the TimePicker in the 24 hour format and I am using setIs24HourView= true, but I am still not getting 24 hour format on the TimePicker. Here is my code in the onCreate of the Activity. ``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); ``` I even tried timePicker.setCurrentHour(cal.HOUR\_OF\_DAY) after setIs24HourView, but I am not able to see the 24 hour format on the TimePicker. ``` <TimePicker android:id="@+id/timePicker1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="110dp" /> ``` Am I missing anything here? ![enter image description here](https://i.stack.imgur.com/UHJoY.jpg)
2013/03/01
[ "https://Stackoverflow.com/questions/15150430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103792/" ]
ok, I see what the problem is now. It's not correctly setting the currentHour to the new 24 hour format, which is why you got 9:05 instead of 21:05. I'm guessing it isn't 9am where you are! It is a bug, as mentioned in this [question](https://stackoverflow.com/questions/13662288/timepicker-hour-doesnt-update-after-switching-to-24h) seems the only work around, for now, is to do something like: ``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); timePicker.setCurrentHour(Calendar.get(Calendar.HOUR_OF_DAY)); ``` I see you tried cal.HOUR\_OF\_DAY, but didn't provide the code you actually used, but try this and see if it helps.
setting `timePicker.setCurrentHour(Calendar.get(Calendar.HOUR_OF_DAY))` solved the problem
15,150,430
I am trying to use the TimePicker in the 24 hour format and I am using setIs24HourView= true, but I am still not getting 24 hour format on the TimePicker. Here is my code in the onCreate of the Activity. ``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); ``` I even tried timePicker.setCurrentHour(cal.HOUR\_OF\_DAY) after setIs24HourView, but I am not able to see the 24 hour format on the TimePicker. ``` <TimePicker android:id="@+id/timePicker1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="110dp" /> ``` Am I missing anything here? ![enter image description here](https://i.stack.imgur.com/UHJoY.jpg)
2013/03/01
[ "https://Stackoverflow.com/questions/15150430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103792/" ]
ok, I see what the problem is now. It's not correctly setting the currentHour to the new 24 hour format, which is why you got 9:05 instead of 21:05. I'm guessing it isn't 9am where you are! It is a bug, as mentioned in this [question](https://stackoverflow.com/questions/13662288/timepicker-hour-doesnt-update-after-switching-to-24h) seems the only work around, for now, is to do something like: ``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); timePicker.setCurrentHour(Calendar.get(Calendar.HOUR_OF_DAY)); ``` I see you tried cal.HOUR\_OF\_DAY, but didn't provide the code you actually used, but try this and see if it helps.
``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); ``` We need to add this: ``` Calendar calendar = Calendar.getInstance(); timePicker.setCurrentHour(calendar.get(calendar.HOUR_OF_DAY)); ```
15,150,430
I am trying to use the TimePicker in the 24 hour format and I am using setIs24HourView= true, but I am still not getting 24 hour format on the TimePicker. Here is my code in the onCreate of the Activity. ``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); ``` I even tried timePicker.setCurrentHour(cal.HOUR\_OF\_DAY) after setIs24HourView, but I am not able to see the 24 hour format on the TimePicker. ``` <TimePicker android:id="@+id/timePicker1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="110dp" /> ``` Am I missing anything here? ![enter image description here](https://i.stack.imgur.com/UHJoY.jpg)
2013/03/01
[ "https://Stackoverflow.com/questions/15150430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103792/" ]
I notice this problem in jelly bean You can set the time to show in 24 hour view ``` TimePicker picker = (TimePicker) findViewById(R.id.timePicker1); picker.setIs24HourView(true); Calendar calendar = Calendar.getInstance(); int h = calendar.get(Calendar.HOUR_OF_DAY); int m = calendar.get(Calendar.MINUTE); picker.setCurrentHour(h); picker.setCurrentMinute(m); ```
setting `timePicker.setCurrentHour(Calendar.get(Calendar.HOUR_OF_DAY))` solved the problem
15,150,430
I am trying to use the TimePicker in the 24 hour format and I am using setIs24HourView= true, but I am still not getting 24 hour format on the TimePicker. Here is my code in the onCreate of the Activity. ``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); ``` I even tried timePicker.setCurrentHour(cal.HOUR\_OF\_DAY) after setIs24HourView, but I am not able to see the 24 hour format on the TimePicker. ``` <TimePicker android:id="@+id/timePicker1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="110dp" /> ``` Am I missing anything here? ![enter image description here](https://i.stack.imgur.com/UHJoY.jpg)
2013/03/01
[ "https://Stackoverflow.com/questions/15150430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103792/" ]
I notice this problem in jelly bean You can set the time to show in 24 hour view ``` TimePicker picker = (TimePicker) findViewById(R.id.timePicker1); picker.setIs24HourView(true); Calendar calendar = Calendar.getInstance(); int h = calendar.get(Calendar.HOUR_OF_DAY); int m = calendar.get(Calendar.MINUTE); picker.setCurrentHour(h); picker.setCurrentMinute(m); ```
``` timePicker = (TimePicker) findViewById(R.id.timePicker1); timePicker.setIs24HourView(true); ``` We need to add this: ``` Calendar calendar = Calendar.getInstance(); timePicker.setCurrentHour(calendar.get(calendar.HOUR_OF_DAY)); ```
56,908,604
I'm on Fedora 30. I am trying to install "epel-release". I am following this guide: <https://www.phusionpassenger.com/library/install/standalone/install/oss/el7/> -- I am unable to successfully run the command: ``` $ sudo yum install -y epel-release yum-utils ``` I get as a result: ``` No match for argument: epel-release ``` So, I tried the following commands from this article: <https://www.liquidweb.com/kb/enable-epel-repository/> ``` $ cd /tmp $ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm $ yum install ./epel-release-latest-*.noarch.rpm ``` No such luck - this is the output: ``` Error: Problem: problem with installed package fedora-release-workstation-30-1.noarch - package epel-release-7-11.noarch conflicts with fedora-release provided by fedora-release-workstation-30-1.noarch - package epel-release-7-11.noarch conflicts with fedora-release provided by fedora-release-workstation-30-4.noarch - conflicting requests ``` I have also tried: ``` $ sudo dnf install epel-relase ``` which that didn't work either, here's the results: ``` No match for argument: epel-release Error: Unable to find a match ``` I have come across several different articles basically saying to either use the first command listed or variations of the second command I've tried - all unsuccessful. side note: Is this because Fedora 30 was just "recently" released? My end goal is to deploy a Ruby on Rails web app internally using Nginx. For that, I am following this guide: <https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/el7/deploy_app.html> Any direction for how to install epel-release would be great as I can't move forward until passenger is installed.
2019/07/05
[ "https://Stackoverflow.com/questions/56908604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5479897/" ]
Note that [EPEL](https://fedoraproject.org/wiki/EPEL) is not suitable for use in Fedora! Fedora is not Enterprise Linux. EPEL provides "a high quality set of additional packages **for Enterprise Linux**, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL)". Put simply, *Enterprise Linux* is a term that refers to *Red Hat Enterprise Linux* or one of its clones. And Fedora is not a Red Hat clone. That is why you cannot install the "epel-release" package in Fedora. It simply does not exist. Don't try to use EPEL on Fedora. As noted before, the Fedora repositories provide most (if not all) of the EPEL packages. Additional software for Fedora is available in the [RPMFusion](https://rpmfusion.org/) repositories. In their own words, RPMFusion is "an extension of Fedora" that "provides software that the Fedora Project or Red Hat doesn't want to ship." RPMFusion can not be used on Enterprise Linux. You could see RPMFusion as the "EPEL alternative" for Fedora, but be aware that the software collections provided by RPMFusion and EPEL are entirely unrelated and uncomparable. EPEL is managed from within the Fedora project, and thus part of Red Hat. RPMFusion is an independent organization. You can consider their repositories reliable, but always be cautious when you install software from external sources. Finally - on a sidenote - on recent Fedora versions, 'dnf' has [replaced](https://opensource.com/article/18/8/guide-yum-dnf) 'yum'.
Okay, so turns out that this can be simplified to just: ``` $ sudo dnf install passenger ``` Crazy that they have an entire tutorial for how to install passenger when it can just be simplified to this one line.
56,908,604
I'm on Fedora 30. I am trying to install "epel-release". I am following this guide: <https://www.phusionpassenger.com/library/install/standalone/install/oss/el7/> -- I am unable to successfully run the command: ``` $ sudo yum install -y epel-release yum-utils ``` I get as a result: ``` No match for argument: epel-release ``` So, I tried the following commands from this article: <https://www.liquidweb.com/kb/enable-epel-repository/> ``` $ cd /tmp $ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm $ yum install ./epel-release-latest-*.noarch.rpm ``` No such luck - this is the output: ``` Error: Problem: problem with installed package fedora-release-workstation-30-1.noarch - package epel-release-7-11.noarch conflicts with fedora-release provided by fedora-release-workstation-30-1.noarch - package epel-release-7-11.noarch conflicts with fedora-release provided by fedora-release-workstation-30-4.noarch - conflicting requests ``` I have also tried: ``` $ sudo dnf install epel-relase ``` which that didn't work either, here's the results: ``` No match for argument: epel-release Error: Unable to find a match ``` I have come across several different articles basically saying to either use the first command listed or variations of the second command I've tried - all unsuccessful. side note: Is this because Fedora 30 was just "recently" released? My end goal is to deploy a Ruby on Rails web app internally using Nginx. For that, I am following this guide: <https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/el7/deploy_app.html> Any direction for how to install epel-release would be great as I can't move forward until passenger is installed.
2019/07/05
[ "https://Stackoverflow.com/questions/56908604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5479897/" ]
Okay, so turns out that this can be simplified to just: ``` $ sudo dnf install passenger ``` Crazy that they have an entire tutorial for how to install passenger when it can just be simplified to this one line.
you'll need to install the EPEL (Extra Packages for Enterprise Linux) repository. The EPEL project is run by the Fedora team. When you install third-party repositories on Red Hat and CentOS systems. Install in centos: ``` sudo yum install yum-plugin-priorities epel-release ``` When the installation completes, navigate to the /etc/yum.repos.d directory, and open the **CentOS-Base.repo** file in your favorite text editor. After the last line of the base, updates, and extras sections, add the line: `priority=1`. After the last line of the centosplus section, add the line: `priority=2`. Save the file and close the editor. Now, Open the **epel.repo** file for editing. After the last line of the epel section,add the line: `priority=10`. After the last line of each remaining section, add the line: `priority=11`. Update the system and then create a list of the installed and available packages by running: ``` sudo yum upgrade sudo yum list > yum_list.txt ```
56,908,604
I'm on Fedora 30. I am trying to install "epel-release". I am following this guide: <https://www.phusionpassenger.com/library/install/standalone/install/oss/el7/> -- I am unable to successfully run the command: ``` $ sudo yum install -y epel-release yum-utils ``` I get as a result: ``` No match for argument: epel-release ``` So, I tried the following commands from this article: <https://www.liquidweb.com/kb/enable-epel-repository/> ``` $ cd /tmp $ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm $ yum install ./epel-release-latest-*.noarch.rpm ``` No such luck - this is the output: ``` Error: Problem: problem with installed package fedora-release-workstation-30-1.noarch - package epel-release-7-11.noarch conflicts with fedora-release provided by fedora-release-workstation-30-1.noarch - package epel-release-7-11.noarch conflicts with fedora-release provided by fedora-release-workstation-30-4.noarch - conflicting requests ``` I have also tried: ``` $ sudo dnf install epel-relase ``` which that didn't work either, here's the results: ``` No match for argument: epel-release Error: Unable to find a match ``` I have come across several different articles basically saying to either use the first command listed or variations of the second command I've tried - all unsuccessful. side note: Is this because Fedora 30 was just "recently" released? My end goal is to deploy a Ruby on Rails web app internally using Nginx. For that, I am following this guide: <https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/el7/deploy_app.html> Any direction for how to install epel-release would be great as I can't move forward until passenger is installed.
2019/07/05
[ "https://Stackoverflow.com/questions/56908604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5479897/" ]
Okay, so turns out that this can be simplified to just: ``` $ sudo dnf install passenger ``` Crazy that they have an entire tutorial for how to install passenger when it can just be simplified to this one line.
For RHEL - dnf install <https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm> Try with the above command to install epel-release in RHEL 8
56,908,604
I'm on Fedora 30. I am trying to install "epel-release". I am following this guide: <https://www.phusionpassenger.com/library/install/standalone/install/oss/el7/> -- I am unable to successfully run the command: ``` $ sudo yum install -y epel-release yum-utils ``` I get as a result: ``` No match for argument: epel-release ``` So, I tried the following commands from this article: <https://www.liquidweb.com/kb/enable-epel-repository/> ``` $ cd /tmp $ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm $ yum install ./epel-release-latest-*.noarch.rpm ``` No such luck - this is the output: ``` Error: Problem: problem with installed package fedora-release-workstation-30-1.noarch - package epel-release-7-11.noarch conflicts with fedora-release provided by fedora-release-workstation-30-1.noarch - package epel-release-7-11.noarch conflicts with fedora-release provided by fedora-release-workstation-30-4.noarch - conflicting requests ``` I have also tried: ``` $ sudo dnf install epel-relase ``` which that didn't work either, here's the results: ``` No match for argument: epel-release Error: Unable to find a match ``` I have come across several different articles basically saying to either use the first command listed or variations of the second command I've tried - all unsuccessful. side note: Is this because Fedora 30 was just "recently" released? My end goal is to deploy a Ruby on Rails web app internally using Nginx. For that, I am following this guide: <https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/el7/deploy_app.html> Any direction for how to install epel-release would be great as I can't move forward until passenger is installed.
2019/07/05
[ "https://Stackoverflow.com/questions/56908604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5479897/" ]
Note that [EPEL](https://fedoraproject.org/wiki/EPEL) is not suitable for use in Fedora! Fedora is not Enterprise Linux. EPEL provides "a high quality set of additional packages **for Enterprise Linux**, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL)". Put simply, *Enterprise Linux* is a term that refers to *Red Hat Enterprise Linux* or one of its clones. And Fedora is not a Red Hat clone. That is why you cannot install the "epel-release" package in Fedora. It simply does not exist. Don't try to use EPEL on Fedora. As noted before, the Fedora repositories provide most (if not all) of the EPEL packages. Additional software for Fedora is available in the [RPMFusion](https://rpmfusion.org/) repositories. In their own words, RPMFusion is "an extension of Fedora" that "provides software that the Fedora Project or Red Hat doesn't want to ship." RPMFusion can not be used on Enterprise Linux. You could see RPMFusion as the "EPEL alternative" for Fedora, but be aware that the software collections provided by RPMFusion and EPEL are entirely unrelated and uncomparable. EPEL is managed from within the Fedora project, and thus part of Red Hat. RPMFusion is an independent organization. You can consider their repositories reliable, but always be cautious when you install software from external sources. Finally - on a sidenote - on recent Fedora versions, 'dnf' has [replaced](https://opensource.com/article/18/8/guide-yum-dnf) 'yum'.
you'll need to install the EPEL (Extra Packages for Enterprise Linux) repository. The EPEL project is run by the Fedora team. When you install third-party repositories on Red Hat and CentOS systems. Install in centos: ``` sudo yum install yum-plugin-priorities epel-release ``` When the installation completes, navigate to the /etc/yum.repos.d directory, and open the **CentOS-Base.repo** file in your favorite text editor. After the last line of the base, updates, and extras sections, add the line: `priority=1`. After the last line of the centosplus section, add the line: `priority=2`. Save the file and close the editor. Now, Open the **epel.repo** file for editing. After the last line of the epel section,add the line: `priority=10`. After the last line of each remaining section, add the line: `priority=11`. Update the system and then create a list of the installed and available packages by running: ``` sudo yum upgrade sudo yum list > yum_list.txt ```
56,908,604
I'm on Fedora 30. I am trying to install "epel-release". I am following this guide: <https://www.phusionpassenger.com/library/install/standalone/install/oss/el7/> -- I am unable to successfully run the command: ``` $ sudo yum install -y epel-release yum-utils ``` I get as a result: ``` No match for argument: epel-release ``` So, I tried the following commands from this article: <https://www.liquidweb.com/kb/enable-epel-repository/> ``` $ cd /tmp $ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm $ yum install ./epel-release-latest-*.noarch.rpm ``` No such luck - this is the output: ``` Error: Problem: problem with installed package fedora-release-workstation-30-1.noarch - package epel-release-7-11.noarch conflicts with fedora-release provided by fedora-release-workstation-30-1.noarch - package epel-release-7-11.noarch conflicts with fedora-release provided by fedora-release-workstation-30-4.noarch - conflicting requests ``` I have also tried: ``` $ sudo dnf install epel-relase ``` which that didn't work either, here's the results: ``` No match for argument: epel-release Error: Unable to find a match ``` I have come across several different articles basically saying to either use the first command listed or variations of the second command I've tried - all unsuccessful. side note: Is this because Fedora 30 was just "recently" released? My end goal is to deploy a Ruby on Rails web app internally using Nginx. For that, I am following this guide: <https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/el7/deploy_app.html> Any direction for how to install epel-release would be great as I can't move forward until passenger is installed.
2019/07/05
[ "https://Stackoverflow.com/questions/56908604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5479897/" ]
Note that [EPEL](https://fedoraproject.org/wiki/EPEL) is not suitable for use in Fedora! Fedora is not Enterprise Linux. EPEL provides "a high quality set of additional packages **for Enterprise Linux**, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL)". Put simply, *Enterprise Linux* is a term that refers to *Red Hat Enterprise Linux* or one of its clones. And Fedora is not a Red Hat clone. That is why you cannot install the "epel-release" package in Fedora. It simply does not exist. Don't try to use EPEL on Fedora. As noted before, the Fedora repositories provide most (if not all) of the EPEL packages. Additional software for Fedora is available in the [RPMFusion](https://rpmfusion.org/) repositories. In their own words, RPMFusion is "an extension of Fedora" that "provides software that the Fedora Project or Red Hat doesn't want to ship." RPMFusion can not be used on Enterprise Linux. You could see RPMFusion as the "EPEL alternative" for Fedora, but be aware that the software collections provided by RPMFusion and EPEL are entirely unrelated and uncomparable. EPEL is managed from within the Fedora project, and thus part of Red Hat. RPMFusion is an independent organization. You can consider their repositories reliable, but always be cautious when you install software from external sources. Finally - on a sidenote - on recent Fedora versions, 'dnf' has [replaced](https://opensource.com/article/18/8/guide-yum-dnf) 'yum'.
For RHEL - dnf install <https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm> Try with the above command to install epel-release in RHEL 8
56,908,604
I'm on Fedora 30. I am trying to install "epel-release". I am following this guide: <https://www.phusionpassenger.com/library/install/standalone/install/oss/el7/> -- I am unable to successfully run the command: ``` $ sudo yum install -y epel-release yum-utils ``` I get as a result: ``` No match for argument: epel-release ``` So, I tried the following commands from this article: <https://www.liquidweb.com/kb/enable-epel-repository/> ``` $ cd /tmp $ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm $ yum install ./epel-release-latest-*.noarch.rpm ``` No such luck - this is the output: ``` Error: Problem: problem with installed package fedora-release-workstation-30-1.noarch - package epel-release-7-11.noarch conflicts with fedora-release provided by fedora-release-workstation-30-1.noarch - package epel-release-7-11.noarch conflicts with fedora-release provided by fedora-release-workstation-30-4.noarch - conflicting requests ``` I have also tried: ``` $ sudo dnf install epel-relase ``` which that didn't work either, here's the results: ``` No match for argument: epel-release Error: Unable to find a match ``` I have come across several different articles basically saying to either use the first command listed or variations of the second command I've tried - all unsuccessful. side note: Is this because Fedora 30 was just "recently" released? My end goal is to deploy a Ruby on Rails web app internally using Nginx. For that, I am following this guide: <https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/el7/deploy_app.html> Any direction for how to install epel-release would be great as I can't move forward until passenger is installed.
2019/07/05
[ "https://Stackoverflow.com/questions/56908604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5479897/" ]
you'll need to install the EPEL (Extra Packages for Enterprise Linux) repository. The EPEL project is run by the Fedora team. When you install third-party repositories on Red Hat and CentOS systems. Install in centos: ``` sudo yum install yum-plugin-priorities epel-release ``` When the installation completes, navigate to the /etc/yum.repos.d directory, and open the **CentOS-Base.repo** file in your favorite text editor. After the last line of the base, updates, and extras sections, add the line: `priority=1`. After the last line of the centosplus section, add the line: `priority=2`. Save the file and close the editor. Now, Open the **epel.repo** file for editing. After the last line of the epel section,add the line: `priority=10`. After the last line of each remaining section, add the line: `priority=11`. Update the system and then create a list of the installed and available packages by running: ``` sudo yum upgrade sudo yum list > yum_list.txt ```
For RHEL - dnf install <https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm> Try with the above command to install epel-release in RHEL 8
2,168,510
The question is related to the question [Transition between matrices of full rank](https://math.stackexchange.com/questions/2166866/transition-between-matrices-of-full-rank) Suppose we have in matrix space (I treat matrices here as vectors describing points in some $n \times n$ dimensional space) three real square matrices $A\_1,A\_2,A\_3$ that all are of full rank and any matrix $P$, lying on the segment $A\_1A\_2$ or $A\_2A\_3$ or $A\_3A\_1$ between these matrices, is also of full rank. (what is equivalent to the fact that this matrix $P = t\_i{A\_i}+{t\_iA\_j}$ where $t\_i,t\_j$ are positive and $t\_i+t\_j=1$) * Does it mean that any matrix $D$ in the interior of $\triangle ABC$ located in the two-dimensional plane determined by these matrices is also of full rank? * If not what condition should be stated additionally to satisfy non-singularity for all these internal matrices? Matrix $D$ is treated as an internal point of $\triangle ABC$ if the equation $D= t\_1A+t\_2B+t\_3C$ is satisfied for some positive $t\_1$, $t\_2$, $t\_3$ constrained by the equation $t\_1+t\_2+t\_3=1$.
2017/03/02
[ "https://math.stackexchange.com/questions/2168510", "https://math.stackexchange.com", "https://math.stackexchange.com/users/334463/" ]
Given a curve $\gamma$ of class $C^{1}$ in $\mathbb{R}^{2}$ parametrized by a function $h:[a,b]\rightarrow\mathbb{R}^{2}$, the integral of a function $f$ along $\gamma$ is given by $$ \int\_{\gamma}f\,d\sigma=\int\_{a}^{b}f(h(t))\sqrt{(h\_{1}^{\prime}% (t))^{2}+(h\_{2}^{\prime}(t))^{2}}dt. $$ In your case, you can take $h(\theta)=(R\cos\theta,R\sin\theta)$ and so $h^{\prime}(\theta)=(-R\sin\theta,R\cos\theta)$ which gives \begin{align\*} \int\_{\partial B\_{R}}f\,d\sigma & =\int\_{0}^{2\pi}f(R\cos\theta,R\sin \theta)\sqrt{(-R\sin\theta)^{2}+(R\cos\theta)^{2}}d\theta\\ & =\int\_{0}^{2\pi}f(R\cos\theta,R\sin\theta)R\,d\theta. \end{align\*} The outer normal $\nu$ to $\partial B\_{R}$ at $(x,y)$ is given by $\frac{(x,y)}{\sqrt{x^{2}+y^{2}}}$, so in polar coordinate $\nu(\theta )=(\cos\theta,\sin\theta)$ and so \begin{align\*} \frac{\partial u}{\partial\nu}(R\cos\theta,R\sin\theta) & =\nabla u(R\cos\theta,R\sin\theta)\cdot\nu(\theta)\\ & =\partial\_{x}u(R\cos\theta,R\sin\theta)\cos\theta+\partial\_{y}u(R\cos \theta,R\sin\theta)\sin\theta\\ & =\frac{\partial u}{\partial r}(R\cos\theta,R\sin\theta)=7R^{6}\left( \frac{1}{98}+\frac{1}{90}\cos2\theta\right) . \end{align\*} It follows that \begin{align\*} \int\_{\partial B\_{R}}g\frac{\partial u}{\partial\nu}\,d\theta & =\int% \_{0}^{2\pi}g(R\cos\theta,R\sin\theta)\frac{\partial u}{\partial r}(R\cos \theta,R\sin\theta)R\,d\theta\\ & =\int\_{0}^{2\pi}g(R\cos\theta,R\sin\theta)7R^{6}\left( \frac{1}{98}% +\frac{1}{90}\cos2\theta\right) R\,d\theta, \end{align\*} which is what you have in your notes.
In polar coordinates the gradient is $$\nabla u=\hat{r}\frac{\partial u}{\partial r} + \hat{\theta}\frac{1}{r}\frac{\partial u}{\partial\theta}$$ Dotting with the outward normal $\hat{r}$ yields $$\hat{r}\cdot\nabla u=\frac{\partial u}{\partial r}$$ Likewise, in polar coordinates, the differential of a circular arc is $$d\sigma = r\,d\theta$$ Substituting these 2 results into the integral $$\eqalign{ \oint g\,\frac{\partial u}{\partial\nu}\,d\sigma &= \oint g\,\frac{\partial u}{\partial r}\,\,r\,d\theta \cr &= \oint g\,7\,r^6\,\Big(\frac{1}{98}+\frac{\cos(2\theta)}{90}\Big)\,\,r\,d\theta \cr &= \oint g\,7\,r^7\,\Big(\frac{1}{98}+\frac{\cos(2\theta)}{90}\Big)\,\,d\theta \cr }$$ The path of this integral is the surface of the ball, where $r$ is a constant. The effect of this is to evaluate any $r$-dependent functions at the boundary value, e.g. $\,f(r)$ becomes $f(R)$. Pulling the constant terms out of the integral, we are left with the result from your notes $$\eqalign{ \oint g\,\frac{\partial u}{\partial\nu}\,d\sigma &= 7\,R^7\,\int\_0^{2\pi} \Big(\frac{1}{98}+\frac{\cos(2\theta)}{90}\Big)\,g\,d\theta \cr \cr }$$
38,766,636
i m trying to keep Hello as a heading below nav tag. This is my HTML. ``` <nav class="navbar navbar-default navbar-fixed-top" style="background-color: aliceblue;" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <img class="img-responsive" src="img/logo.png" style="width: 330px; height: 49px;" /> </div> <ul class="nav navbar-nav navbar-right" id="navbarprop"> <li id="home" class="active"> <a class="color" href="#"><i class="glyphicon glyphicon-home"></i>&nbsp Home</a> </li> </ul> </div> </nav> <div class="container"> <h1>HELLO</h1> </div> ``` I want to make my page responsive. The problem arise is the Hello is printed inside the nav tag. i have to apply margin-top:50px; to make "HELLO" visible. How do i make it responsive. This is the image with no margin top <http://imgur.com/q5yol6t> Hello is inside the nav. This is the image with margin top <http://imgur.com/j8tjUbZ> Thank You in advance!
2016/08/04
[ "https://Stackoverflow.com/questions/38766636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6677896/" ]
<http://getbootstrap.com/components/#navbar-fixed-top> Look particularly at the part where it says the body requires padding. > > The fixed navbar will overlay your other content, unless you add padding to the top of the `<body>`. Try out your own values or use our snippet below. Tip: By default, the navbar is 50px high. > > > ``` body { padding-top: 70px; } ``` > > Make sure to include this after the core Bootstrap CSS. > > >
You can solve this with media screen, just give another margin top for screens less than 767px(except tablet,laptop and desktop) Hope it will help you. ``` <style> body { background-color:#4FE1A8; } #wrapper { margin-top:50px; } @media screen and (max-width:767px) { #wrapper { margin-top:100px; } } </style> <nav class="navbar navbar-default navbar-fixed-top" style="background-color: aliceblue;" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <img class="img-responsive" src="img/logo.png" style="width: 330px; height: 49px;" /> </div> <ul class="nav navbar-nav navbar-right" id="navbarprop"> <li id="home" class="active"> <a class="color" href="#"><i class="glyphicon glyphicon-home"></i>&nbsp Home</a> </li> </ul> </div> </nav> <div class="container" id="wrapper"> <h1>HELLO</h1> </div> ```
232,805
In *Asterix and the Magic Carpet*, [Cacofonix's](https://www.asterix.com/en/portfolio/cacofonix/) singing produces rain. (Previously, this had never happened.) **Why is it that when Cacofonix sings, it rains in #28 (*Magic Carpet*, 1987), but not in Books #1-27 (1961-83)?** (Others may disagree, but I find this problematic, puzzling, and in need of explanation.) (This effect also continues in the next book *Asterix and the Secret Weapon*.) --- Four of the five current answers simply quote from Wikipedia's (unsourced) assertion that there is a French saying that when one sings poorly, it rains. This could very well be an explanation. But absent either in-universe (i.e. within the comic books, perhaps cleared up in later books) or out-of-universe (e.g. interviews with Uderzo) evidence, this is just speculation. Moreover, it is unsatisfying because it fails to address my above question (in bold). --- Edit: In case it isn't clear, I am not disputing the existence of such a French saying. I am disputing that the existence of such a French saying is a satisfactory explanation to my question. In particular, it fails to explain why Cacofonix's singing had not previously produced rain in the previous 27 books.
2020/06/15
[ "https://scifi.stackexchange.com/questions/232805", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/130048/" ]
According to [the Wikipedia section on Cacofonix](https://en.wikipedia.org/wiki/List_of_Asterix_characters#Cacofonix): > > In later albums his music is so spectacularly horrible that it actually starts thunderstorms (even indoors), because of an old French saying that bad singing causes rain. > > > A French person reading the comics would automatically get the reference, and thus it isn't stated.
As many have pointed out, it could be because of the French connection and the French proverb that bad singing may cause rain. Another possibility could be interpreted from the fact that Watziznehm requests the Gauls to help him with draught in his region in the Ganges region. In the Ganges region, although the timeline doesn't match, back in the days, there exists a myth that a singer "Tansen", residing in a Mughal emperor's court, was capable of causing rain and thunderstorms merely by his singing. It might be a small chance that the writers slipped a reference to Tansen but I wouldn't put it past them to have thought of this too!
232,805
In *Asterix and the Magic Carpet*, [Cacofonix's](https://www.asterix.com/en/portfolio/cacofonix/) singing produces rain. (Previously, this had never happened.) **Why is it that when Cacofonix sings, it rains in #28 (*Magic Carpet*, 1987), but not in Books #1-27 (1961-83)?** (Others may disagree, but I find this problematic, puzzling, and in need of explanation.) (This effect also continues in the next book *Asterix and the Secret Weapon*.) --- Four of the five current answers simply quote from Wikipedia's (unsourced) assertion that there is a French saying that when one sings poorly, it rains. This could very well be an explanation. But absent either in-universe (i.e. within the comic books, perhaps cleared up in later books) or out-of-universe (e.g. interviews with Uderzo) evidence, this is just speculation. Moreover, it is unsatisfying because it fails to address my above question (in bold). --- Edit: In case it isn't clear, I am not disputing the existence of such a French saying. I am disputing that the existence of such a French saying is a satisfactory explanation to my question. In particular, it fails to explain why Cacofonix's singing had not previously produced rain in the previous 27 books.
2020/06/15
[ "https://scifi.stackexchange.com/questions/232805", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/130048/" ]
On page 6 of *Asterix and the Magic Carpet* (in-panel numbering), Vitalstatistix says regarding Cacofonix’ rainmaking abilities: > > Oh, yes … I was forgetting, Cacofonix has new string to his lyre these days. > > > As noted by [Darren](https://scifi.stackexchange.com/users/75476/darren), this is probably a pun involving adding a [string to one’s bow](https://en.wiktionary.org/wiki/string_to_one%27s_bow), which analogously works with [avoir plus d’une corde à son arc](https://en.wiktionary.org/wiki/avoir_plus_d%27une_corde_%C3%A0_son_arc) in the French original. Now, there are two ways to interpret this: * The pun only happens out-of-universe, in which case the new string actually is responsible in-universe. * The pun happens in-universe, i.e., Vitalstatistix (as opposed to only Uderzo) makes the pun, in which case Cacofonix somehow acquired a new “skill” to do this. Either way, the new rainmaking effects of Cacofonix’ music are addressed on the page: Either it’s because he actually upgraded (or rather: downgraded) his instrument or his abilities.
Perhaps not immediately clear for English readers, the original French name of the bard in the cartoons is *Assurancetourix*, a contraction of the French term *Assurance tous risques*, literally "all-risk insurance". An all-risk insurance includes coverage that automatically covers any risk, including natural disasters. It's not unreasonable to assume that in the development of the character the new writers (Goscinni, the original story writer died in 1977) some of the "all-risk" natural disasters are being incorporated.
232,805
In *Asterix and the Magic Carpet*, [Cacofonix's](https://www.asterix.com/en/portfolio/cacofonix/) singing produces rain. (Previously, this had never happened.) **Why is it that when Cacofonix sings, it rains in #28 (*Magic Carpet*, 1987), but not in Books #1-27 (1961-83)?** (Others may disagree, but I find this problematic, puzzling, and in need of explanation.) (This effect also continues in the next book *Asterix and the Secret Weapon*.) --- Four of the five current answers simply quote from Wikipedia's (unsourced) assertion that there is a French saying that when one sings poorly, it rains. This could very well be an explanation. But absent either in-universe (i.e. within the comic books, perhaps cleared up in later books) or out-of-universe (e.g. interviews with Uderzo) evidence, this is just speculation. Moreover, it is unsatisfying because it fails to address my above question (in bold). --- Edit: In case it isn't clear, I am not disputing the existence of such a French saying. I am disputing that the existence of such a French saying is a satisfactory explanation to my question. In particular, it fails to explain why Cacofonix's singing had not previously produced rain in the previous 27 books.
2020/06/15
[ "https://scifi.stackexchange.com/questions/232805", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/130048/" ]
In France we have this saying that if you sing badly it will produce rain. More precisely if you sing out of key, or pitchy, then you'll make it rain. "Cacophonix" means "cacophonie" which is French for "cacophony": harsh discordant mixture of sounds. Thus triggering the rain.
Perhaps not immediately clear for English readers, the original French name of the bard in the cartoons is *Assurancetourix*, a contraction of the French term *Assurance tous risques*, literally "all-risk insurance". An all-risk insurance includes coverage that automatically covers any risk, including natural disasters. It's not unreasonable to assume that in the development of the character the new writers (Goscinni, the original story writer died in 1977) some of the "all-risk" natural disasters are being incorporated.
232,805
In *Asterix and the Magic Carpet*, [Cacofonix's](https://www.asterix.com/en/portfolio/cacofonix/) singing produces rain. (Previously, this had never happened.) **Why is it that when Cacofonix sings, it rains in #28 (*Magic Carpet*, 1987), but not in Books #1-27 (1961-83)?** (Others may disagree, but I find this problematic, puzzling, and in need of explanation.) (This effect also continues in the next book *Asterix and the Secret Weapon*.) --- Four of the five current answers simply quote from Wikipedia's (unsourced) assertion that there is a French saying that when one sings poorly, it rains. This could very well be an explanation. But absent either in-universe (i.e. within the comic books, perhaps cleared up in later books) or out-of-universe (e.g. interviews with Uderzo) evidence, this is just speculation. Moreover, it is unsatisfying because it fails to address my above question (in bold). --- Edit: In case it isn't clear, I am not disputing the existence of such a French saying. I am disputing that the existence of such a French saying is a satisfactory explanation to my question. In particular, it fails to explain why Cacofonix's singing had not previously produced rain in the previous 27 books.
2020/06/15
[ "https://scifi.stackexchange.com/questions/232805", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/130048/" ]
This is an ongoing joke that Cacofonix's singing is so bad, it causes negative things to happen (a common trope). [![A group proposes a toast at a banquet but Cacofonix starts signing in a treehouse which causes it to rain; when he stops singing the rain stops again](https://i.stack.imgur.com/6xBoN.jpg)](https://i.stack.imgur.com/6xBoN.jpg) According to [Wikipedia](https://en.wikipedia.org/wiki/List_of_Asterix_characters#Cacofonix) (My emphasis): > > In Asterix and the Normans [his singing] is so unbearable that it teaches the fearless Normans the meaning of fear. In later albums his music is so spectacularly horrible that it actually starts thunderstorms (even indoors), **because of an old French saying that bad singing causes rain.** > > > The joke even leads to him causing it to rain inside: [![Cacofonix sings inside and it starts raining in the building, a gentlemen walks passed in the sun and notices it is only raining inside the bulding](https://i.stack.imgur.com/groSL.png)](https://i.stack.imgur.com/groSL.png) And sometimes even leads to Cacofonix saving the day: [![Cacofonix's singing started the monsoon season which was delayed resulting in people bathing in a stream](https://i.stack.imgur.com/wURO3.png)](https://i.stack.imgur.com/wURO3.png)
As many have pointed out, it could be because of the French connection and the French proverb that bad singing may cause rain. Another possibility could be interpreted from the fact that Watziznehm requests the Gauls to help him with draught in his region in the Ganges region. In the Ganges region, although the timeline doesn't match, back in the days, there exists a myth that a singer "Tansen", residing in a Mughal emperor's court, was capable of causing rain and thunderstorms merely by his singing. It might be a small chance that the writers slipped a reference to Tansen but I wouldn't put it past them to have thought of this too!
232,805
In *Asterix and the Magic Carpet*, [Cacofonix's](https://www.asterix.com/en/portfolio/cacofonix/) singing produces rain. (Previously, this had never happened.) **Why is it that when Cacofonix sings, it rains in #28 (*Magic Carpet*, 1987), but not in Books #1-27 (1961-83)?** (Others may disagree, but I find this problematic, puzzling, and in need of explanation.) (This effect also continues in the next book *Asterix and the Secret Weapon*.) --- Four of the five current answers simply quote from Wikipedia's (unsourced) assertion that there is a French saying that when one sings poorly, it rains. This could very well be an explanation. But absent either in-universe (i.e. within the comic books, perhaps cleared up in later books) or out-of-universe (e.g. interviews with Uderzo) evidence, this is just speculation. Moreover, it is unsatisfying because it fails to address my above question (in bold). --- Edit: In case it isn't clear, I am not disputing the existence of such a French saying. I am disputing that the existence of such a French saying is a satisfactory explanation to my question. In particular, it fails to explain why Cacofonix's singing had not previously produced rain in the previous 27 books.
2020/06/15
[ "https://scifi.stackexchange.com/questions/232805", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/130048/" ]
This is an ongoing joke that Cacofonix's singing is so bad, it causes negative things to happen (a common trope). [![A group proposes a toast at a banquet but Cacofonix starts signing in a treehouse which causes it to rain; when he stops singing the rain stops again](https://i.stack.imgur.com/6xBoN.jpg)](https://i.stack.imgur.com/6xBoN.jpg) According to [Wikipedia](https://en.wikipedia.org/wiki/List_of_Asterix_characters#Cacofonix) (My emphasis): > > In Asterix and the Normans [his singing] is so unbearable that it teaches the fearless Normans the meaning of fear. In later albums his music is so spectacularly horrible that it actually starts thunderstorms (even indoors), **because of an old French saying that bad singing causes rain.** > > > The joke even leads to him causing it to rain inside: [![Cacofonix sings inside and it starts raining in the building, a gentlemen walks passed in the sun and notices it is only raining inside the bulding](https://i.stack.imgur.com/groSL.png)](https://i.stack.imgur.com/groSL.png) And sometimes even leads to Cacofonix saving the day: [![Cacofonix's singing started the monsoon season which was delayed resulting in people bathing in a stream](https://i.stack.imgur.com/wURO3.png)](https://i.stack.imgur.com/wURO3.png)
In France we have this saying that if you sing badly it will produce rain. More precisely if you sing out of key, or pitchy, then you'll make it rain. "Cacophonix" means "cacophonie" which is French for "cacophony": harsh discordant mixture of sounds. Thus triggering the rain.
232,805
In *Asterix and the Magic Carpet*, [Cacofonix's](https://www.asterix.com/en/portfolio/cacofonix/) singing produces rain. (Previously, this had never happened.) **Why is it that when Cacofonix sings, it rains in #28 (*Magic Carpet*, 1987), but not in Books #1-27 (1961-83)?** (Others may disagree, but I find this problematic, puzzling, and in need of explanation.) (This effect also continues in the next book *Asterix and the Secret Weapon*.) --- Four of the five current answers simply quote from Wikipedia's (unsourced) assertion that there is a French saying that when one sings poorly, it rains. This could very well be an explanation. But absent either in-universe (i.e. within the comic books, perhaps cleared up in later books) or out-of-universe (e.g. interviews with Uderzo) evidence, this is just speculation. Moreover, it is unsatisfying because it fails to address my above question (in bold). --- Edit: In case it isn't clear, I am not disputing the existence of such a French saying. I am disputing that the existence of such a French saying is a satisfactory explanation to my question. In particular, it fails to explain why Cacofonix's singing had not previously produced rain in the previous 27 books.
2020/06/15
[ "https://scifi.stackexchange.com/questions/232805", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/130048/" ]
This is an ongoing joke that Cacofonix's singing is so bad, it causes negative things to happen (a common trope). [![A group proposes a toast at a banquet but Cacofonix starts signing in a treehouse which causes it to rain; when he stops singing the rain stops again](https://i.stack.imgur.com/6xBoN.jpg)](https://i.stack.imgur.com/6xBoN.jpg) According to [Wikipedia](https://en.wikipedia.org/wiki/List_of_Asterix_characters#Cacofonix) (My emphasis): > > In Asterix and the Normans [his singing] is so unbearable that it teaches the fearless Normans the meaning of fear. In later albums his music is so spectacularly horrible that it actually starts thunderstorms (even indoors), **because of an old French saying that bad singing causes rain.** > > > The joke even leads to him causing it to rain inside: [![Cacofonix sings inside and it starts raining in the building, a gentlemen walks passed in the sun and notices it is only raining inside the bulding](https://i.stack.imgur.com/groSL.png)](https://i.stack.imgur.com/groSL.png) And sometimes even leads to Cacofonix saving the day: [![Cacofonix's singing started the monsoon season which was delayed resulting in people bathing in a stream](https://i.stack.imgur.com/wURO3.png)](https://i.stack.imgur.com/wURO3.png)
On page 6 of *Asterix and the Magic Carpet* (in-panel numbering), Vitalstatistix says regarding Cacofonix’ rainmaking abilities: > > Oh, yes … I was forgetting, Cacofonix has new string to his lyre these days. > > > As noted by [Darren](https://scifi.stackexchange.com/users/75476/darren), this is probably a pun involving adding a [string to one’s bow](https://en.wiktionary.org/wiki/string_to_one%27s_bow), which analogously works with [avoir plus d’une corde à son arc](https://en.wiktionary.org/wiki/avoir_plus_d%27une_corde_%C3%A0_son_arc) in the French original. Now, there are two ways to interpret this: * The pun only happens out-of-universe, in which case the new string actually is responsible in-universe. * The pun happens in-universe, i.e., Vitalstatistix (as opposed to only Uderzo) makes the pun, in which case Cacofonix somehow acquired a new “skill” to do this. Either way, the new rainmaking effects of Cacofonix’ music are addressed on the page: Either it’s because he actually upgraded (or rather: downgraded) his instrument or his abilities.
232,805
In *Asterix and the Magic Carpet*, [Cacofonix's](https://www.asterix.com/en/portfolio/cacofonix/) singing produces rain. (Previously, this had never happened.) **Why is it that when Cacofonix sings, it rains in #28 (*Magic Carpet*, 1987), but not in Books #1-27 (1961-83)?** (Others may disagree, but I find this problematic, puzzling, and in need of explanation.) (This effect also continues in the next book *Asterix and the Secret Weapon*.) --- Four of the five current answers simply quote from Wikipedia's (unsourced) assertion that there is a French saying that when one sings poorly, it rains. This could very well be an explanation. But absent either in-universe (i.e. within the comic books, perhaps cleared up in later books) or out-of-universe (e.g. interviews with Uderzo) evidence, this is just speculation. Moreover, it is unsatisfying because it fails to address my above question (in bold). --- Edit: In case it isn't clear, I am not disputing the existence of such a French saying. I am disputing that the existence of such a French saying is a satisfactory explanation to my question. In particular, it fails to explain why Cacofonix's singing had not previously produced rain in the previous 27 books.
2020/06/15
[ "https://scifi.stackexchange.com/questions/232805", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/130048/" ]
According to [the Wikipedia section on Cacofonix](https://en.wikipedia.org/wiki/List_of_Asterix_characters#Cacofonix): > > In later albums his music is so spectacularly horrible that it actually starts thunderstorms (even indoors), because of an old French saying that bad singing causes rain. > > > A French person reading the comics would automatically get the reference, and thus it isn't stated.
In France we have this saying that if you sing badly it will produce rain. More precisely if you sing out of key, or pitchy, then you'll make it rain. "Cacophonix" means "cacophonie" which is French for "cacophony": harsh discordant mixture of sounds. Thus triggering the rain.
232,805
In *Asterix and the Magic Carpet*, [Cacofonix's](https://www.asterix.com/en/portfolio/cacofonix/) singing produces rain. (Previously, this had never happened.) **Why is it that when Cacofonix sings, it rains in #28 (*Magic Carpet*, 1987), but not in Books #1-27 (1961-83)?** (Others may disagree, but I find this problematic, puzzling, and in need of explanation.) (This effect also continues in the next book *Asterix and the Secret Weapon*.) --- Four of the five current answers simply quote from Wikipedia's (unsourced) assertion that there is a French saying that when one sings poorly, it rains. This could very well be an explanation. But absent either in-universe (i.e. within the comic books, perhaps cleared up in later books) or out-of-universe (e.g. interviews with Uderzo) evidence, this is just speculation. Moreover, it is unsatisfying because it fails to address my above question (in bold). --- Edit: In case it isn't clear, I am not disputing the existence of such a French saying. I am disputing that the existence of such a French saying is a satisfactory explanation to my question. In particular, it fails to explain why Cacofonix's singing had not previously produced rain in the previous 27 books.
2020/06/15
[ "https://scifi.stackexchange.com/questions/232805", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/130048/" ]
This is an ongoing joke that Cacofonix's singing is so bad, it causes negative things to happen (a common trope). [![A group proposes a toast at a banquet but Cacofonix starts signing in a treehouse which causes it to rain; when he stops singing the rain stops again](https://i.stack.imgur.com/6xBoN.jpg)](https://i.stack.imgur.com/6xBoN.jpg) According to [Wikipedia](https://en.wikipedia.org/wiki/List_of_Asterix_characters#Cacofonix) (My emphasis): > > In Asterix and the Normans [his singing] is so unbearable that it teaches the fearless Normans the meaning of fear. In later albums his music is so spectacularly horrible that it actually starts thunderstorms (even indoors), **because of an old French saying that bad singing causes rain.** > > > The joke even leads to him causing it to rain inside: [![Cacofonix sings inside and it starts raining in the building, a gentlemen walks passed in the sun and notices it is only raining inside the bulding](https://i.stack.imgur.com/groSL.png)](https://i.stack.imgur.com/groSL.png) And sometimes even leads to Cacofonix saving the day: [![Cacofonix's singing started the monsoon season which was delayed resulting in people bathing in a stream](https://i.stack.imgur.com/wURO3.png)](https://i.stack.imgur.com/wURO3.png)
According to [the Wikipedia section on Cacofonix](https://en.wikipedia.org/wiki/List_of_Asterix_characters#Cacofonix): > > In later albums his music is so spectacularly horrible that it actually starts thunderstorms (even indoors), because of an old French saying that bad singing causes rain. > > > A French person reading the comics would automatically get the reference, and thus it isn't stated.
232,805
In *Asterix and the Magic Carpet*, [Cacofonix's](https://www.asterix.com/en/portfolio/cacofonix/) singing produces rain. (Previously, this had never happened.) **Why is it that when Cacofonix sings, it rains in #28 (*Magic Carpet*, 1987), but not in Books #1-27 (1961-83)?** (Others may disagree, but I find this problematic, puzzling, and in need of explanation.) (This effect also continues in the next book *Asterix and the Secret Weapon*.) --- Four of the five current answers simply quote from Wikipedia's (unsourced) assertion that there is a French saying that when one sings poorly, it rains. This could very well be an explanation. But absent either in-universe (i.e. within the comic books, perhaps cleared up in later books) or out-of-universe (e.g. interviews with Uderzo) evidence, this is just speculation. Moreover, it is unsatisfying because it fails to address my above question (in bold). --- Edit: In case it isn't clear, I am not disputing the existence of such a French saying. I am disputing that the existence of such a French saying is a satisfactory explanation to my question. In particular, it fails to explain why Cacofonix's singing had not previously produced rain in the previous 27 books.
2020/06/15
[ "https://scifi.stackexchange.com/questions/232805", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/130048/" ]
This is an ongoing joke that Cacofonix's singing is so bad, it causes negative things to happen (a common trope). [![A group proposes a toast at a banquet but Cacofonix starts signing in a treehouse which causes it to rain; when he stops singing the rain stops again](https://i.stack.imgur.com/6xBoN.jpg)](https://i.stack.imgur.com/6xBoN.jpg) According to [Wikipedia](https://en.wikipedia.org/wiki/List_of_Asterix_characters#Cacofonix) (My emphasis): > > In Asterix and the Normans [his singing] is so unbearable that it teaches the fearless Normans the meaning of fear. In later albums his music is so spectacularly horrible that it actually starts thunderstorms (even indoors), **because of an old French saying that bad singing causes rain.** > > > The joke even leads to him causing it to rain inside: [![Cacofonix sings inside and it starts raining in the building, a gentlemen walks passed in the sun and notices it is only raining inside the bulding](https://i.stack.imgur.com/groSL.png)](https://i.stack.imgur.com/groSL.png) And sometimes even leads to Cacofonix saving the day: [![Cacofonix's singing started the monsoon season which was delayed resulting in people bathing in a stream](https://i.stack.imgur.com/wURO3.png)](https://i.stack.imgur.com/wURO3.png)
Perhaps not immediately clear for English readers, the original French name of the bard in the cartoons is *Assurancetourix*, a contraction of the French term *Assurance tous risques*, literally "all-risk insurance". An all-risk insurance includes coverage that automatically covers any risk, including natural disasters. It's not unreasonable to assume that in the development of the character the new writers (Goscinni, the original story writer died in 1977) some of the "all-risk" natural disasters are being incorporated.
232,805
In *Asterix and the Magic Carpet*, [Cacofonix's](https://www.asterix.com/en/portfolio/cacofonix/) singing produces rain. (Previously, this had never happened.) **Why is it that when Cacofonix sings, it rains in #28 (*Magic Carpet*, 1987), but not in Books #1-27 (1961-83)?** (Others may disagree, but I find this problematic, puzzling, and in need of explanation.) (This effect also continues in the next book *Asterix and the Secret Weapon*.) --- Four of the five current answers simply quote from Wikipedia's (unsourced) assertion that there is a French saying that when one sings poorly, it rains. This could very well be an explanation. But absent either in-universe (i.e. within the comic books, perhaps cleared up in later books) or out-of-universe (e.g. interviews with Uderzo) evidence, this is just speculation. Moreover, it is unsatisfying because it fails to address my above question (in bold). --- Edit: In case it isn't clear, I am not disputing the existence of such a French saying. I am disputing that the existence of such a French saying is a satisfactory explanation to my question. In particular, it fails to explain why Cacofonix's singing had not previously produced rain in the previous 27 books.
2020/06/15
[ "https://scifi.stackexchange.com/questions/232805", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/130048/" ]
According to [the Wikipedia section on Cacofonix](https://en.wikipedia.org/wiki/List_of_Asterix_characters#Cacofonix): > > In later albums his music is so spectacularly horrible that it actually starts thunderstorms (even indoors), because of an old French saying that bad singing causes rain. > > > A French person reading the comics would automatically get the reference, and thus it isn't stated.
Perhaps not immediately clear for English readers, the original French name of the bard in the cartoons is *Assurancetourix*, a contraction of the French term *Assurance tous risques*, literally "all-risk insurance". An all-risk insurance includes coverage that automatically covers any risk, including natural disasters. It's not unreasonable to assume that in the development of the character the new writers (Goscinni, the original story writer died in 1977) some of the "all-risk" natural disasters are being incorporated.
191
I'm having a hard time figuring out which is the correct form of asking this kind of question. I mean speaking strictly, this doesn't sound right: ***You alright?*** or ***You eaten anything?*** compared to ***Are you alright?*** and ***Have you eaten anything?***. So please enlighten me. Are those both forms correct or just something which is ignored for the sake slang speakers?
2013/01/24
[ "https://ell.stackexchange.com/questions/191", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/101/" ]
Those phrases are examples of ellipsis: the omission of words that can be understood from the context, or given contextual clues. While ellipsis is not normally used in formal English, it is more used in spoken English, or informal English.
These aren't correct in formal English. Here, the sentences say "Are you alright?", "Have you eaten anything", as you mentioned. The "Are"/"Have" are implied here, that's all. One finds this a lot in informal English -- words which can be guessed from context are sometimes dropped altogether. It's just a way to save time, similar to how contractions are used (though contractions may be used in formal English as well)
191
I'm having a hard time figuring out which is the correct form of asking this kind of question. I mean speaking strictly, this doesn't sound right: ***You alright?*** or ***You eaten anything?*** compared to ***Are you alright?*** and ***Have you eaten anything?***. So please enlighten me. Are those both forms correct or just something which is ignored for the sake slang speakers?
2013/01/24
[ "https://ell.stackexchange.com/questions/191", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/101/" ]
These aren't correct in formal English. Here, the sentences say "Are you alright?", "Have you eaten anything", as you mentioned. The "Are"/"Have" are implied here, that's all. One finds this a lot in informal English -- words which can be guessed from context are sometimes dropped altogether. It's just a way to save time, similar to how contractions are used (though contractions may be used in formal English as well)
*“You alright?”* is not necessarily true according to the grammar rules. It is instead used for conversations with friends and relatives. The most correct sentence, in my opinion, would definitely be: **“*Are you alright*?”**
191
I'm having a hard time figuring out which is the correct form of asking this kind of question. I mean speaking strictly, this doesn't sound right: ***You alright?*** or ***You eaten anything?*** compared to ***Are you alright?*** and ***Have you eaten anything?***. So please enlighten me. Are those both forms correct or just something which is ignored for the sake slang speakers?
2013/01/24
[ "https://ell.stackexchange.com/questions/191", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/101/" ]
These aren't correct in formal English. Here, the sentences say "Are you alright?", "Have you eaten anything", as you mentioned. The "Are"/"Have" are implied here, that's all. One finds this a lot in informal English -- words which can be guessed from context are sometimes dropped altogether. It's just a way to save time, similar to how contractions are used (though contractions may be used in formal English as well)
We use ellipsis a lot in spoken English. It's certainly not good written style though! I might have a conversation like this with friends: Alright? Coming to the pub tonight? Naa (No). Too tired. Went out last night. Stay out late, did ya (you)? Yeah. Got home about 2 in the morning. Wife wasn't happy!
191
I'm having a hard time figuring out which is the correct form of asking this kind of question. I mean speaking strictly, this doesn't sound right: ***You alright?*** or ***You eaten anything?*** compared to ***Are you alright?*** and ***Have you eaten anything?***. So please enlighten me. Are those both forms correct or just something which is ignored for the sake slang speakers?
2013/01/24
[ "https://ell.stackexchange.com/questions/191", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/101/" ]
Those phrases are examples of ellipsis: the omission of words that can be understood from the context, or given contextual clues. While ellipsis is not normally used in formal English, it is more used in spoken English, or informal English.
*“You alright?”* is not necessarily true according to the grammar rules. It is instead used for conversations with friends and relatives. The most correct sentence, in my opinion, would definitely be: **“*Are you alright*?”**
191
I'm having a hard time figuring out which is the correct form of asking this kind of question. I mean speaking strictly, this doesn't sound right: ***You alright?*** or ***You eaten anything?*** compared to ***Are you alright?*** and ***Have you eaten anything?***. So please enlighten me. Are those both forms correct or just something which is ignored for the sake slang speakers?
2013/01/24
[ "https://ell.stackexchange.com/questions/191", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/101/" ]
Those phrases are examples of ellipsis: the omission of words that can be understood from the context, or given contextual clues. While ellipsis is not normally used in formal English, it is more used in spoken English, or informal English.
We use ellipsis a lot in spoken English. It's certainly not good written style though! I might have a conversation like this with friends: Alright? Coming to the pub tonight? Naa (No). Too tired. Went out last night. Stay out late, did ya (you)? Yeah. Got home about 2 in the morning. Wife wasn't happy!
191
I'm having a hard time figuring out which is the correct form of asking this kind of question. I mean speaking strictly, this doesn't sound right: ***You alright?*** or ***You eaten anything?*** compared to ***Are you alright?*** and ***Have you eaten anything?***. So please enlighten me. Are those both forms correct or just something which is ignored for the sake slang speakers?
2013/01/24
[ "https://ell.stackexchange.com/questions/191", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/101/" ]
We use ellipsis a lot in spoken English. It's certainly not good written style though! I might have a conversation like this with friends: Alright? Coming to the pub tonight? Naa (No). Too tired. Went out last night. Stay out late, did ya (you)? Yeah. Got home about 2 in the morning. Wife wasn't happy!
*“You alright?”* is not necessarily true according to the grammar rules. It is instead used for conversations with friends and relatives. The most correct sentence, in my opinion, would definitely be: **“*Are you alright*?”**
30,343,029
I am new to Perl. How do I create a a loop that runs until the current time is a multiple of 5 seconds?
2015/05/20
[ "https://Stackoverflow.com/questions/30343029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you just want to suspend your process until the seconds are a multiple of 5, then you can use the [`Time::HiRes`](https://metacpan.org/pod/Time::HiRes) module like this ``` use Time::HiRes qw/ gettimeofday usleep /; my ($s, $us) = gettimeofday; my $delay = 1_000_000 * (5 - $s % 5) - $us; usleep $delay; # Do stuff ``` or if you want to execute some code until the next multiple of 5 seconds then use this ``` use Time::HiRes qw/ gettimeofday tv_interval /; my $t1 = [ gettimeofday ]; $t1->[0] += 5 - $t1->[0] % 5; $t1->[1] = 0; while ( tv_interval([ gettimeofday ], $t1) > 0 ) { # Do stuff } ```
Borodin's answer is what you want if you really need the seconds to be a multiple of five. However, is it possible you just want to implement five second delays in your program? If so: ``` sleep 5; ```
9,648,015
I put [a package on PyPi](http://pypi.python.org/pypi/powerlaw) for the first time ~2 months ago, and have made some version updates since then. I noticed this week the download count recording, and was surprised to see it had been downloaded hundreds of times. Over the next few days, I was more surprised to see the download count increasing by sometimes hundreds *per day*, even though this is a niche statistical test toolbox. In particular, older versions of package are continuing to be downloaded, sometimes at higher rates than the newest version. What is going on here? Is there a bug in PyPi's downloaded counting, or is there an abundance of crawlers grabbing open source code (as mine is)?
2012/03/10
[ "https://Stackoverflow.com/questions/9648015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897578/" ]
This is kind of an old question at this point, but I noticed the same thing about a package I have on PyPI and investigated further. It turns out PyPI keeps reasonably detailed [download statistics](http://pypi.python.org/stats/), including (apparently slightly anonymised) user agents. From that, it was apparent that most people downloading my package were things like "z3c.pypimirror/1.0.15.1" and "pep381client/1.5". (PEP 381 describes a mirroring infrastructure for PyPI.) I wrote [a quick script](https://gist.github.com/Cairnarvon/4715057) to tally everything up, first including all of them and then leaving out the most obvious bots, and it turns out that **literally 99%** of the download activity for my package was caused by mirrorbots: 14,335 downloads total, compared to only 146 downloads with the bots filtered. And that's just leaving out the very obvious ones, so it's probably still an overestimate. It looks like the main reason PyPI needs mirrors is because it has them.
You also have to take into account that virtualenv is getting more popular. If your package is something like a core library that people use in many of their projects, they will usually download it multiple times. Consider a single user has 5 projects where he uses your package and each lives in its own virtualenv. Using pip to meet the requirements, your package is already downloaded 5 times this way. Then these projects might be set up on different machines, like work, home and laptop computers, in addition there might be a staging and a live server in case of a web application. Summing this up, you end up with many downloads by a single person. Just a thought... perhaps your package is simply good. ;)
9,648,015
I put [a package on PyPi](http://pypi.python.org/pypi/powerlaw) for the first time ~2 months ago, and have made some version updates since then. I noticed this week the download count recording, and was surprised to see it had been downloaded hundreds of times. Over the next few days, I was more surprised to see the download count increasing by sometimes hundreds *per day*, even though this is a niche statistical test toolbox. In particular, older versions of package are continuing to be downloaded, sometimes at higher rates than the newest version. What is going on here? Is there a bug in PyPi's downloaded counting, or is there an abundance of crawlers grabbing open source code (as mine is)?
2012/03/10
[ "https://Stackoverflow.com/questions/9648015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897578/" ]
Starting with Cairnarvon's summarizing statement: > > "It looks like the main reason PyPI needs mirrors is because it has them." > > > I would slightly modify this: > > It might be more the **way** PyPI actually works and thus has to be mirrored, that might contribute an additional bit (or two :-) to the *real* traffic. > > > At the moment I think you MUST interact with the main index to know what to update in your repository. State is not simply accesible through timestamps on some publicly accessible folder hierarchy. So, the bad thing is, rsync is out of the equation. The good thing is, you MAY talk to the index through JSON, OAuth, XML-RPC or HTTP interfaces. For XML-RPC: ``` $> python >>> import xmlrpclib >>> import pprint >>> client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi') >>> client.package_releases('PartitionSets') ['0.1.1'] ``` For JSON eg.: ``` $> curl https://pypi.python.org/pypi/PartitionSets/0.1.1/json ``` If there are approx. 30.000 packages hosted [[1](https://pypi.python.org/pypi)] with some being downloaded 50.000 to 300.000 times a week [[2](http://pypi-ranking.info/week)] (like distribute, pip, requests, paramiko, lxml, boto, paramike, redis and others) you really need mirrors at least from an accessibilty perspective. Just imagine what a user does when `pip install NeedThisPackage` fails: *Wait*? Also company wide PyPI mirrors are quite common acting as proxies for otherwise unrouteable networks. Finally not to forget the wonderful multi version checking enabled through virtualenv and friends. These all are IMO legitimate and potentially wonderful uses of packages ... In the end, you never know what an agent *really* does with a downloaded package: Have N users really use it or just overwrite it next time ... and after all, IMHO package authors should care more for **number and nature of uses**, than the pure *number of potential users* ;-) --- Refs: The guestimated numbers are from <https://pypi.python.org/pypi> (29303 packages) and <http://pypi-ranking.info/week> (for the weekly numbers, requested 2013-03-23).
You also have to take into account that virtualenv is getting more popular. If your package is something like a core library that people use in many of their projects, they will usually download it multiple times. Consider a single user has 5 projects where he uses your package and each lives in its own virtualenv. Using pip to meet the requirements, your package is already downloaded 5 times this way. Then these projects might be set up on different machines, like work, home and laptop computers, in addition there might be a staging and a live server in case of a web application. Summing this up, you end up with many downloads by a single person. Just a thought... perhaps your package is simply good. ;)
9,648,015
I put [a package on PyPi](http://pypi.python.org/pypi/powerlaw) for the first time ~2 months ago, and have made some version updates since then. I noticed this week the download count recording, and was surprised to see it had been downloaded hundreds of times. Over the next few days, I was more surprised to see the download count increasing by sometimes hundreds *per day*, even though this is a niche statistical test toolbox. In particular, older versions of package are continuing to be downloaded, sometimes at higher rates than the newest version. What is going on here? Is there a bug in PyPi's downloaded counting, or is there an abundance of crawlers grabbing open source code (as mine is)?
2012/03/10
[ "https://Stackoverflow.com/questions/9648015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897578/" ]
You also have to take into account that virtualenv is getting more popular. If your package is something like a core library that people use in many of their projects, they will usually download it multiple times. Consider a single user has 5 projects where he uses your package and each lives in its own virtualenv. Using pip to meet the requirements, your package is already downloaded 5 times this way. Then these projects might be set up on different machines, like work, home and laptop computers, in addition there might be a staging and a live server in case of a web application. Summing this up, you end up with many downloads by a single person. Just a thought... perhaps your package is simply good. ;)
Hypothesis: CI tools like Travis CI and Appveyor also contribute quite a bit. It might mean that each commit/push leads to a build of a package and the installation of everything in requirements.txt
9,648,015
I put [a package on PyPi](http://pypi.python.org/pypi/powerlaw) for the first time ~2 months ago, and have made some version updates since then. I noticed this week the download count recording, and was surprised to see it had been downloaded hundreds of times. Over the next few days, I was more surprised to see the download count increasing by sometimes hundreds *per day*, even though this is a niche statistical test toolbox. In particular, older versions of package are continuing to be downloaded, sometimes at higher rates than the newest version. What is going on here? Is there a bug in PyPi's downloaded counting, or is there an abundance of crawlers grabbing open source code (as mine is)?
2012/03/10
[ "https://Stackoverflow.com/questions/9648015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897578/" ]
This is kind of an old question at this point, but I noticed the same thing about a package I have on PyPI and investigated further. It turns out PyPI keeps reasonably detailed [download statistics](http://pypi.python.org/stats/), including (apparently slightly anonymised) user agents. From that, it was apparent that most people downloading my package were things like "z3c.pypimirror/1.0.15.1" and "pep381client/1.5". (PEP 381 describes a mirroring infrastructure for PyPI.) I wrote [a quick script](https://gist.github.com/Cairnarvon/4715057) to tally everything up, first including all of them and then leaving out the most obvious bots, and it turns out that **literally 99%** of the download activity for my package was caused by mirrorbots: 14,335 downloads total, compared to only 146 downloads with the bots filtered. And that's just leaving out the very obvious ones, so it's probably still an overestimate. It looks like the main reason PyPI needs mirrors is because it has them.
Starting with Cairnarvon's summarizing statement: > > "It looks like the main reason PyPI needs mirrors is because it has them." > > > I would slightly modify this: > > It might be more the **way** PyPI actually works and thus has to be mirrored, that might contribute an additional bit (or two :-) to the *real* traffic. > > > At the moment I think you MUST interact with the main index to know what to update in your repository. State is not simply accesible through timestamps on some publicly accessible folder hierarchy. So, the bad thing is, rsync is out of the equation. The good thing is, you MAY talk to the index through JSON, OAuth, XML-RPC or HTTP interfaces. For XML-RPC: ``` $> python >>> import xmlrpclib >>> import pprint >>> client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi') >>> client.package_releases('PartitionSets') ['0.1.1'] ``` For JSON eg.: ``` $> curl https://pypi.python.org/pypi/PartitionSets/0.1.1/json ``` If there are approx. 30.000 packages hosted [[1](https://pypi.python.org/pypi)] with some being downloaded 50.000 to 300.000 times a week [[2](http://pypi-ranking.info/week)] (like distribute, pip, requests, paramiko, lxml, boto, paramike, redis and others) you really need mirrors at least from an accessibilty perspective. Just imagine what a user does when `pip install NeedThisPackage` fails: *Wait*? Also company wide PyPI mirrors are quite common acting as proxies for otherwise unrouteable networks. Finally not to forget the wonderful multi version checking enabled through virtualenv and friends. These all are IMO legitimate and potentially wonderful uses of packages ... In the end, you never know what an agent *really* does with a downloaded package: Have N users really use it or just overwrite it next time ... and after all, IMHO package authors should care more for **number and nature of uses**, than the pure *number of potential users* ;-) --- Refs: The guestimated numbers are from <https://pypi.python.org/pypi> (29303 packages) and <http://pypi-ranking.info/week> (for the weekly numbers, requested 2013-03-23).
9,648,015
I put [a package on PyPi](http://pypi.python.org/pypi/powerlaw) for the first time ~2 months ago, and have made some version updates since then. I noticed this week the download count recording, and was surprised to see it had been downloaded hundreds of times. Over the next few days, I was more surprised to see the download count increasing by sometimes hundreds *per day*, even though this is a niche statistical test toolbox. In particular, older versions of package are continuing to be downloaded, sometimes at higher rates than the newest version. What is going on here? Is there a bug in PyPi's downloaded counting, or is there an abundance of crawlers grabbing open source code (as mine is)?
2012/03/10
[ "https://Stackoverflow.com/questions/9648015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897578/" ]
This is kind of an old question at this point, but I noticed the same thing about a package I have on PyPI and investigated further. It turns out PyPI keeps reasonably detailed [download statistics](http://pypi.python.org/stats/), including (apparently slightly anonymised) user agents. From that, it was apparent that most people downloading my package were things like "z3c.pypimirror/1.0.15.1" and "pep381client/1.5". (PEP 381 describes a mirroring infrastructure for PyPI.) I wrote [a quick script](https://gist.github.com/Cairnarvon/4715057) to tally everything up, first including all of them and then leaving out the most obvious bots, and it turns out that **literally 99%** of the download activity for my package was caused by mirrorbots: 14,335 downloads total, compared to only 146 downloads with the bots filtered. And that's just leaving out the very obvious ones, so it's probably still an overestimate. It looks like the main reason PyPI needs mirrors is because it has them.
Hypothesis: CI tools like Travis CI and Appveyor also contribute quite a bit. It might mean that each commit/push leads to a build of a package and the installation of everything in requirements.txt
9,648,015
I put [a package on PyPi](http://pypi.python.org/pypi/powerlaw) for the first time ~2 months ago, and have made some version updates since then. I noticed this week the download count recording, and was surprised to see it had been downloaded hundreds of times. Over the next few days, I was more surprised to see the download count increasing by sometimes hundreds *per day*, even though this is a niche statistical test toolbox. In particular, older versions of package are continuing to be downloaded, sometimes at higher rates than the newest version. What is going on here? Is there a bug in PyPi's downloaded counting, or is there an abundance of crawlers grabbing open source code (as mine is)?
2012/03/10
[ "https://Stackoverflow.com/questions/9648015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897578/" ]
Starting with Cairnarvon's summarizing statement: > > "It looks like the main reason PyPI needs mirrors is because it has them." > > > I would slightly modify this: > > It might be more the **way** PyPI actually works and thus has to be mirrored, that might contribute an additional bit (or two :-) to the *real* traffic. > > > At the moment I think you MUST interact with the main index to know what to update in your repository. State is not simply accesible through timestamps on some publicly accessible folder hierarchy. So, the bad thing is, rsync is out of the equation. The good thing is, you MAY talk to the index through JSON, OAuth, XML-RPC or HTTP interfaces. For XML-RPC: ``` $> python >>> import xmlrpclib >>> import pprint >>> client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi') >>> client.package_releases('PartitionSets') ['0.1.1'] ``` For JSON eg.: ``` $> curl https://pypi.python.org/pypi/PartitionSets/0.1.1/json ``` If there are approx. 30.000 packages hosted [[1](https://pypi.python.org/pypi)] with some being downloaded 50.000 to 300.000 times a week [[2](http://pypi-ranking.info/week)] (like distribute, pip, requests, paramiko, lxml, boto, paramike, redis and others) you really need mirrors at least from an accessibilty perspective. Just imagine what a user does when `pip install NeedThisPackage` fails: *Wait*? Also company wide PyPI mirrors are quite common acting as proxies for otherwise unrouteable networks. Finally not to forget the wonderful multi version checking enabled through virtualenv and friends. These all are IMO legitimate and potentially wonderful uses of packages ... In the end, you never know what an agent *really* does with a downloaded package: Have N users really use it or just overwrite it next time ... and after all, IMHO package authors should care more for **number and nature of uses**, than the pure *number of potential users* ;-) --- Refs: The guestimated numbers are from <https://pypi.python.org/pypi> (29303 packages) and <http://pypi-ranking.info/week> (for the weekly numbers, requested 2013-03-23).
Hypothesis: CI tools like Travis CI and Appveyor also contribute quite a bit. It might mean that each commit/push leads to a build of a package and the installation of everything in requirements.txt
9,653,926
I have a directory ``` D:\SVN_HOME\EclipseWorkspace\MF_CENTER_INFO ``` `SVN_HOME` - is a root svn working folder `MF_CENTER_INFO` - the folder which I want to be commited to another svn repository The default repository for `D:\SVN_HOME\` is `svn://10.101.101.101/svn/ee/trunk` but `MF_CENTER_INFO` has to be commit to `svn://10.101.101.101/svn/mf-center-vp/` (**IPs are same**) so, what I did: right mouse click on `D:\SVN_HOME\EclipseWorkspace\` added property ![enter image description here](https://i.stack.imgur.com/kexO3.png) but when I choose commit or view properties for `D:\SVN_HOME\EclipseWorkspace\MF_CENTER_INFO` it shows default rep, now the external one ![enter image description here](https://i.stack.imgur.com/tk9h7.png) what's wrong?
2012/03/11
[ "https://Stackoverflow.com/questions/9653926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/272869/" ]
I had the same problem when I upgraded to Google App Engine 1.6.0 from 1.5.5 . I solved the problem by installing `python-memcached`: ``` pip install python-memcached ```
For gentoo users it's recommended: `emerge -av dev-python/python-memcached`
9,653,926
I have a directory ``` D:\SVN_HOME\EclipseWorkspace\MF_CENTER_INFO ``` `SVN_HOME` - is a root svn working folder `MF_CENTER_INFO` - the folder which I want to be commited to another svn repository The default repository for `D:\SVN_HOME\` is `svn://10.101.101.101/svn/ee/trunk` but `MF_CENTER_INFO` has to be commit to `svn://10.101.101.101/svn/mf-center-vp/` (**IPs are same**) so, what I did: right mouse click on `D:\SVN_HOME\EclipseWorkspace\` added property ![enter image description here](https://i.stack.imgur.com/kexO3.png) but when I choose commit or view properties for `D:\SVN_HOME\EclipseWorkspace\MF_CENTER_INFO` it shows default rep, now the external one ![enter image description here](https://i.stack.imgur.com/tk9h7.png) what's wrong?
2012/03/11
[ "https://Stackoverflow.com/questions/9653926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/272869/" ]
I had the same problem when I upgraded to Google App Engine 1.6.0 from 1.5.5 . I solved the problem by installing `python-memcached`: ``` pip install python-memcached ```
I alse do like this: ``` sudo pip install python-memcached ``` then restart the django, it works.
61,205,622
Can Anyone Please Convert the following Arduino Code to Embedded c code? I am very thankful to the one who converts this to an embedded c code. (this code is for Arduino lcd interfacing with Ultrasonic sensor) ``` #include <LiquidCrystal.h> int inches = 0; int cm = 0; // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. pinMode(7, INPUT); } void loop() { lcd.clear(); cm = 0.01723 * readUltrasonicDistance(7); inches = (cm / 2.54); if (cm<40){ lcd.setCursor(0, 0); // print the number of seconds since reset: lcd.print("Caution: "); lcd.setCursor(0,1); lcd.print("Objects Nearby"); delay(1000); } } long readUltrasonicDistance(int pin) { pinMode(pin, OUTPUT); // Clear the trigger digitalWrite(pin, LOW); delayMicroseconds(2); // Sets the pin on HIGH state for 10 micro seconds digitalWrite(pin, HIGH); delayMicroseconds(10); digitalWrite(pin, LOW); pinMode(pin, INPUT); // Reads the pin, and returns the sound wave travel time in microseconds return pulseIn(pin, HIGH); } ```
2020/04/14
[ "https://Stackoverflow.com/questions/61205622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Accepted answer is not an accessible solution. ---------------------------------------------- I have made some corrections and some observations here. Do not use the accepted answer in production if you stumble across this question in the future. It is an awful experience with a keyboard. The answer below fixes some of the CSS issues to make it more accessible. However **I would recommend you reconsider the no JavaScript requirement.** I can understand having a good fall-back (which the example I give below with the fixes is) but there is no way you can make a fully accessible set of CSS only tabs. Firstly you should use WAI-ARIA to complement your HTML to make things even more clear for screen readers. See the [tabs examples on W3C](http://%20https://www.w3.org/TR/wai-aria-practices/examples/tabs/tabs-1/tabs.html) to see what WAI-ARIA roles you should be using. This is NOT possible without JavaScript as states need to change (`aria-hidden` for example should change). Secondly, you should be able to use certain shortcut keys. Press the `home` key for example in order to return to the first tab, something you can only do with a little JS help. With that being said here are a few things I fixed with the accepted answer to at least give you a good starting point as your 'no JavaScript **fallback**'. ### Problem 1 - `tabindex` on the label. By adding this you are creating a focusable element that cannot be activated via keyboard (you cannot press `space` or `Enter` on the label to change selection, unless you use JavaScript). In order to fix this I simply removed the `tabindex` from the labels. ### Problem 2 - no focus indicators when navigating via keyboard. In the example the tabs only work when you are focused on the radio buttons (which are hidden). However at this point there is no focus indicator as the styling is applying styling to the checkbox when it is focused and not to its label. In order to fix this I adjusted the CSS with the following ``` /*make it so when the checkbox is focused we add a focus indicator to the label.*/ .tabs__input:focus + label { outline: 2px solid #333; } ``` Problem 3 - using the same state for `:hover` and `:focus` states. ------------------------------------------------------------------ This is another bad practice that needs to go away, always have a different way of showing hover and focus states. Some screen reader and screen magnifier users will use their mouse to check they have the correct item focused and orientate themselves on a page. Without a separate hover state it is difficult to check you are hovered over a focused item. ``` /*use a different colour background on hover, you should not use the same styling for hover and focus states*/ .tabs__label:hover{ background-color: #ccc; } ``` Example ------- In the example I have added a hyperlink at the top so you can see where your focus indicator is when using a keyboard. When your focus indicator is on one of the two tabs you can press the arrow keys to change tab (which is expected behaviour) and the focus indicator will adjust accordingly to make it clear which tab was selected. ```css .tabs { background-color: #eee; min-height: 400px; } .tabs__list { border-bottom: 1px solid black; display: flex; flex-direction: row; list-style: none; margin: 0; padding: 0; position: relative; } .tabs__tab { padding: 0.5rem; } .tabs__content { display: none; left: 0; padding: 0.5rem; position: absolute; top: 100%; } .tabs__input { position: fixed; top:-100px; } .tabs__input+label { cursor: pointer; } .tabs__label:hover{ background-color: #ccc; } .tabs__input:focus + label { outline: 2px solid #333; } .tabs__input:checked+label { color: red; } .tabs__input:checked~.tabs__content { display: block; } ``` ```html <a href="#">A link so you can see where your focus indicator is</a> <div class="tabs"> <ul class="tabs__list"> <li class="tabs__tab"> <input class="tabs__input" type="radio" id="tab-0" name="tab-group" checked> <label for="tab-0" class="tabs__label" role="button">Tab 0</label> <div class="tabs__content"> Tab 0 content </div> </li> <li class="tabs__tab"> <input class="tabs__input" type="radio" id="tab-1" name="tab-group"> <label for="tab-1" class="tabs__label" role="button">Tab 1</label> <div class="tabs__content"> Tab 1 content </div> </li> </ul> </div> ```
It is just radio buttons... Keyboard can be used to navigate through them using tab and space bar to check them. I'd use `:focus` to highlight the chosen tab and the `tabindex` property to make it work as I wanted. Please provide more dept if you have problem with a SPECIFIC problem related to it, and provide a basic code example here, no linking. Since hidden inputs cannot be selected through keyboard, make them visible... ```css .tabs { background-color: #eee; min-height: 400px; } .tabs__list { border-bottom: 1px solid black; display: flex; flex-direction: row; list-style: none; margin: 0; padding: 0; position: relative; } .tabs__tab { padding: 0.5rem; } .tabs__content { display: none; left: 0; padding: 0.5rem; position: absolute; top: 100%; } .tabs__input { position: fixed; top:-100px; } .tabs__input+label { cursor: pointer; } .tabs__input:focus .tabs__input:hover { color: red; } .tabs__input:checked+label { color: red; } .tabs__input:checked~.tabs__content { display: block; } ``` ```html <div class="tabs"> <ul class="tabs__list"> <li class="tabs__tab"> <input class="tabs__input" type="radio" id="tab-0" name="tab-group" checked> <label for="tab-0" class="tabs__label" tabindex="0" role="button">Tab 0</label> <div class="tabs__content"> Tab 0 content </div> </li> <li class="tabs__tab"> <input class="tabs__input" type="radio" id="tab-1" name="tab-group"> <label for="tab-1" class="tabs__label" tabindex="0" role="button">Tab 1</label> <div class="tabs__content"> Tab 1 content </div> </li> </ul> </div> ```
53,949,061
I have various formats of dates, in strings, all in ColumnA. Here is a small example. ``` -rw-r--r-- 35 30067 10224 <-- 2018-09 -rw-r--r-- 36 30067 10224 <-- 2018-09 -rw-r--r-- 65 30067 10224 <-- 2018-10-24 ``` Is there a way I can interpret any date from any given string?
2018/12/27
[ "https://Stackoverflow.com/questions/53949061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5212614/" ]
Try ``` Sub test() Dim rngDB As Range Dim vDB As Variant, vR() As Variant Dim vS As Variant Dim i As Long, j As Integer, c As Integer Dim s As String Set rngDB = Range("a1", Range("a" & Rows.Count).End(xlUp)) vDB = rngDB r = UBound(vDB, 1) ReDim vR(1 To r, 1 To 1) For i = 1 To r s = vDB(i, 1) vS = Split(s, ".") If IsNumeric(vS(1)) Then s = vS(1) s = Right(s, 6) s = Left(s, 2) & " " & Mid(s, 3, 2) & " " & Right(s, 2) vR(i, 1) = DateValue(s) Else s = vS(0) s = Right(s, 6) If IsNumeric(s) Then s = Left(s, 2) & " " & Mid(s, 3, 2) & " " & Right(s, 2) vR(i, 1) = DateValue(s) Else s = Right(s, 4) If IsNumeric(s) Then s = Left(s, 2) & " " & Mid(s, 3, 2) & " " & 1 vR(i, 1) = DateValue(s) Else s = vS(0) s = Right(s, 7) s = Left(s, 2) & " " & Mid(s, 3, 3) & " " & Right(s, 2) vR(i, 1) = DateValue(s) End If End If End If Next i Range("b1").Resize(r) = vR End Sub ```
Without any fixed pattern it will be complicated. The better way in your case on a logical way would by to associate date pattern to files like * 1 => \*.BUS -> YYMM * 2 => \*.IDE -> YYMMDD * 3 => TTN\* -> YYYYMMDD And on the same logic get a mapping table with position of date string in the file name * 1 => Last 4 characters of file name * 2 => Last 6 characters of file name * 3 => Extension In a macro function or a SWITCH function.
53,949,061
I have various formats of dates, in strings, all in ColumnA. Here is a small example. ``` -rw-r--r-- 35 30067 10224 <-- 2018-09 -rw-r--r-- 36 30067 10224 <-- 2018-09 -rw-r--r-- 65 30067 10224 <-- 2018-10-24 ``` Is there a way I can interpret any date from any given string?
2018/12/27
[ "https://Stackoverflow.com/questions/53949061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5212614/" ]
I tried to get date with regular expression. As far as I see, the date is either in the end of the string or there's a dot after it (followed by extension). The regex takes into account the length of the year: either 4 or 2. Also it manages the case when month is expressed in text. *Important!* When the day is absent, I set it as first day. ``` Function GetDate(strString$) Dim sYear$, sMonth$, sDay$ With CreateObject("VBScript.RegExp") .IgnoreCase = True: .Pattern = "(\d{2})([a-z]{3}|\d{2})(\d{2})?(?=\.|$)" With .Execute(strString) If .Count > 0 Then With .Item(0) sYear = .SubMatches(0) sMonth = .SubMatches(1) sDay = .SubMatches(2) sYear = "20" & sYear If Not IsNumeric(sMonth) Then sMonth = GetMonthIndex(sMonth) End If If Len(sDay) = 0 Then sDay = "01" GetDate = DateSerial(CInt(sYear), CInt(sMonth), CInt(sDay)) End With End If End With End With End Function Private Function GetMonthIndex$(strMonth$) Select Case strMonth Case "Jan": GetMonthIndex = "01" Case "Feb": GetMonthIndex = "02" Case "Mar": GetMonthIndex = "03" Case "Apr": GetMonthIndex = "04" Case "May": GetMonthIndex = "05" Case "Jun": GetMonthIndex = "06" Case "Jul": GetMonthIndex = "07" Case "Aug": GetMonthIndex = "08" Case "Sep": GetMonthIndex = "09" Case "Nov": GetMonthIndex = "10" Case "Oct": GetMonthIndex = "11" Case "Dec": GetMonthIndex = "12" End Select End Function ```
Without any fixed pattern it will be complicated. The better way in your case on a logical way would by to associate date pattern to files like * 1 => \*.BUS -> YYMM * 2 => \*.IDE -> YYMMDD * 3 => TTN\* -> YYYYMMDD And on the same logic get a mapping table with position of date string in the file name * 1 => Last 4 characters of file name * 2 => Last 6 characters of file name * 3 => Extension In a macro function or a SWITCH function.
53,949,061
I have various formats of dates, in strings, all in ColumnA. Here is a small example. ``` -rw-r--r-- 35 30067 10224 <-- 2018-09 -rw-r--r-- 36 30067 10224 <-- 2018-09 -rw-r--r-- 65 30067 10224 <-- 2018-10-24 ``` Is there a way I can interpret any date from any given string?
2018/12/27
[ "https://Stackoverflow.com/questions/53949061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5212614/" ]
I tried to get date with regular expression. As far as I see, the date is either in the end of the string or there's a dot after it (followed by extension). The regex takes into account the length of the year: either 4 or 2. Also it manages the case when month is expressed in text. *Important!* When the day is absent, I set it as first day. ``` Function GetDate(strString$) Dim sYear$, sMonth$, sDay$ With CreateObject("VBScript.RegExp") .IgnoreCase = True: .Pattern = "(\d{2})([a-z]{3}|\d{2})(\d{2})?(?=\.|$)" With .Execute(strString) If .Count > 0 Then With .Item(0) sYear = .SubMatches(0) sMonth = .SubMatches(1) sDay = .SubMatches(2) sYear = "20" & sYear If Not IsNumeric(sMonth) Then sMonth = GetMonthIndex(sMonth) End If If Len(sDay) = 0 Then sDay = "01" GetDate = DateSerial(CInt(sYear), CInt(sMonth), CInt(sDay)) End With End If End With End With End Function Private Function GetMonthIndex$(strMonth$) Select Case strMonth Case "Jan": GetMonthIndex = "01" Case "Feb": GetMonthIndex = "02" Case "Mar": GetMonthIndex = "03" Case "Apr": GetMonthIndex = "04" Case "May": GetMonthIndex = "05" Case "Jun": GetMonthIndex = "06" Case "Jul": GetMonthIndex = "07" Case "Aug": GetMonthIndex = "08" Case "Sep": GetMonthIndex = "09" Case "Nov": GetMonthIndex = "10" Case "Oct": GetMonthIndex = "11" Case "Dec": GetMonthIndex = "12" End Select End Function ```
Try ``` Sub test() Dim rngDB As Range Dim vDB As Variant, vR() As Variant Dim vS As Variant Dim i As Long, j As Integer, c As Integer Dim s As String Set rngDB = Range("a1", Range("a" & Rows.Count).End(xlUp)) vDB = rngDB r = UBound(vDB, 1) ReDim vR(1 To r, 1 To 1) For i = 1 To r s = vDB(i, 1) vS = Split(s, ".") If IsNumeric(vS(1)) Then s = vS(1) s = Right(s, 6) s = Left(s, 2) & " " & Mid(s, 3, 2) & " " & Right(s, 2) vR(i, 1) = DateValue(s) Else s = vS(0) s = Right(s, 6) If IsNumeric(s) Then s = Left(s, 2) & " " & Mid(s, 3, 2) & " " & Right(s, 2) vR(i, 1) = DateValue(s) Else s = Right(s, 4) If IsNumeric(s) Then s = Left(s, 2) & " " & Mid(s, 3, 2) & " " & 1 vR(i, 1) = DateValue(s) Else s = vS(0) s = Right(s, 7) s = Left(s, 2) & " " & Mid(s, 3, 3) & " " & Right(s, 2) vR(i, 1) = DateValue(s) End If End If End If Next i Range("b1").Resize(r) = vR End Sub ```
66,234,556
I have a file path which I access like this ``` string[] pathDirs = { Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\")), "config", "file.txt" }; string pathToFile = Path.Combine(pathDirs); ``` When I run the build from within visual studio it gets the `config` directory from the root directory of the project but when I publish the build and run the program from the published build I get the error ``` System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\<user>\AppData\Local\Apps\2.0\GA3VWRPE.G83\KDK3Q6QC.VP1\sv20..tion_333839f4362dc717_0001.0000_958d209d94853f42\config\file.txt'. ``` I'm unsure how to access this directory and file in the published build. How would I do this?
2021/02/17
[ "https://Stackoverflow.com/questions/66234556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3531792/" ]
You should specify what column(s) contain(s) duplicates: ``` removeDuplicates = data.drop_duplicates(subset=['COUNTY']) ```
You need to specify not to keep any duplicates with the keyword argument `keep`: ``` removeDuplicates = data.drop_duplicates(keep=False) ``` From the [`pandas.DataFrame.drop_duplicates()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.drop_duplicates.html) documentation: `keep`: Determines which duplicates (if any) to keep. * `"first"` : Drop duplicates except for the first occurrence. * `"last"` : Drop duplicates except for the last occurrence. * `False` : Drop all duplicates. Note: the above only works on the rows that are completely duplicates of other rows, which in your dataframe, you have no complete duplicates. If you only want to determine a duplicate by one or more specific columns, you can use the `subset` keyword argument: ``` removeDuplicates = data.drop_duplicates(subset=["COOUNTRY"], keep=False) ``` Also from the above linked documentation: `subset`: Only consider certain columns for identifying duplicates, by default use all of the columns. So, you get: ``` import pandas as pd df = {"COUNTRY": ["Country 1", "Country 1", "Country 2", "Country 8"], "NAME": ["Kia", "John", "Peter", "Bob"], "AGE": [34, 39, 78, 30], "YEARS": [18, 6, 5, 2], "PREV_STATE": ["FL", "GA", "IN", "NY"]} df = pd.DataFrame(df) print(df.drop_duplicates(subset=["COUNTRY"], keep=False)) ``` Output: ``` COUNTRY NAME AGE YEARS PREV_STATE 2 Country 2 Peter 78 5 IN 3 Country 8 Bob 30 2 NY ```
25,789,664
I have a spreadsheet with roughly 750 part numbers and costs on it. I need to add $2 to each cost (not total the whole column). The range would be something like D1:D628 and I've tried using =SUM but either I'm doing it wrong or it isn't possible. I initially tried `=SUM(D1:D628+2)` and got a circular reference warning, I've tried variations of the formula and keep getting errors even after removing the circular reference. I also tried the following VBA module insert: ``` Sub Add2Formula() ' Add 2 For Each c In Selection c.Activate ActiveCell.FormulaR1C1 = "= " & ActiveCell.Formula & "+2" Next c End Sub ```
2014/09/11
[ "https://Stackoverflow.com/questions/25789664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1139955/" ]
If you just want to add 2 to a range of numbers (not formulas) then enter the number 2 in a blank cell somewhere copy it Select the cells you want to add 2 to, and then select paste special, choose ADD as the operation option.
The following formula should work `{=SUM(D1:D628+2)}` Leave out the curly braces but press `CTRL`+`SHIFT`+`ENTER` to enter the function (rather than just `ENTER`) EDIT: explanation by pressing `CTRL`+`SHIFT`+`ENTER` excel treats the formula as an array, and loops through each cell individually adding 2 and then summing
52,952,279
Write the number of days in months program so that the program prompts the user for the file name and reads the dates from the file. The dates in the file are written in the format dd.mm.yyyy. The program looks for the month in each line (hint: use split) and prints out the number of days in that month. Rewrite the function so that it does not contain conditional (if) statements for returning the number of days. The function should do it using a list. Do not add the check for a leap year (let’s say that there are 28 days in February). I have this code: ``` dates = {} file = input("Enter file name:") file = open("dates.txt", "r") for line in file: month = line.split(".") dates = month[1] print (dates) ``` But it only reads the month from the text file. How do I add another formula to read the months and state the days instead, within this code without using "IF"?
2018/10/23
[ "https://Stackoverflow.com/questions/52952279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
**Yes**. I could make it work by adding this at the end of the pubspec.yaml: ``` module: androidPackage: com.teste.embeded iosBundleIdentifier: com.teste.embeded ``` Add this and then call a *packages get*. This will create 2 hidden folders in your project structure: .android and .ios. **Becareful with the identation!** This settings must be inside the `flutter:` tag, like this: ``` flutter: uses-material-design: true assets: - images/a_dot_burr.jpeg - images/a_dot_ham.jpeg module: androidPackage: com.test.embeded iosBundleIdentifier: com.test.embeded ``` After doing this, follow the documentation for the Android/iOS sides (skip the module creating parts). <https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps>
You can do that in tow ways: 1- Convert your project to Flutter module and then put that along side the native project and call your FlutterActivity from native 2- Convert your project to Flutter module and make an AAR from it ant import in the native project Read this Flutter documentation: <https://flutter.dev/docs/development/add-to-app/android/project-setup>
712,463
In C, is there a nice way to track the number of elements in an enum? I've seen ``` enum blah { FIRST, SECOND, THIRD, LAST }; ``` But this only works if the items are sequential and start at zero.
2009/04/03
[ "https://Stackoverflow.com/questions/712463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66349/" ]
I don't believe there is. But what would you do with such a number if they are not sequential, and you don't already have a list of them somewhere? And if they are sequential but start at a different number, you could always do: ``` enum blah { FIRST = 128, SECOND, THIRD, END }; const int blah_count = END - FIRST; ```
Well, since enums can't change at run-time, the best thing you can do is: ``` enum blah { FIRST = 7, SECOND = 15, THIRD = 9, LAST = 12 }; #define blahcount 4 /* counted manually, keep these in sync */ ``` But I find it difficult to envisage a situation where that information would come in handy. What exactly are you trying to do?
712,463
In C, is there a nice way to track the number of elements in an enum? I've seen ``` enum blah { FIRST, SECOND, THIRD, LAST }; ``` But this only works if the items are sequential and start at zero.
2009/04/03
[ "https://Stackoverflow.com/questions/712463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66349/" ]
I don't believe there is. But what would you do with such a number if they are not sequential, and you don't already have a list of them somewhere? And if they are sequential but start at a different number, you could always do: ``` enum blah { FIRST = 128, SECOND, THIRD, END }; const int blah_count = END - FIRST; ```
``` int enaumVals[] = { FIRST, SECOND, THIRD, LAST }; #define NUM_ENUMS sizeof(enaumVals) / sizeof ( int ); ```
712,463
In C, is there a nice way to track the number of elements in an enum? I've seen ``` enum blah { FIRST, SECOND, THIRD, LAST }; ``` But this only works if the items are sequential and start at zero.
2009/04/03
[ "https://Stackoverflow.com/questions/712463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66349/" ]
I know this is a very old question, but as the accepted answer is wrong, I feel compelled to post my own. I'll reuse the accepted answer's example, slightly modified. (Making the assumption that enums are sequential.) ``` // Incorrect code, do not use! enum blah { FIRST = 0, SECOND, // 1 THIRD, // 2 END // 3 }; const int blah_count = END - FIRST; // And this above would be 3 - 0 = 3, although there actually are 4 items. ``` Any developer knows the reason: `count = last - first + 1`. And this works with any combination of signs (both ends negative, both positive, or only first end negative). You can try. ``` // Now, the correct version. enum blah { FIRST = 0, SECOND, // 1 THIRD, // 2 END // 3 }; const int blah_count = END - FIRST + 1; // 4 ``` Edit: reading the text again, I got a doubt. Is that `END` meant not to be part of the offered items? That looks weird to me, but well, I guess it could make sense...
``` int enaumVals[] = { FIRST, SECOND, THIRD, LAST }; #define NUM_ENUMS sizeof(enaumVals) / sizeof ( int ); ```
712,463
In C, is there a nice way to track the number of elements in an enum? I've seen ``` enum blah { FIRST, SECOND, THIRD, LAST }; ``` But this only works if the items are sequential and start at zero.
2009/04/03
[ "https://Stackoverflow.com/questions/712463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66349/" ]
Unfortunately, no. There is not.
``` #include <stdio.h> // M_CONC and M_CONC_ come from https://stackoverflow.com/a/14804003/7067195 #define M_CONC(A, B) M_CONC_(A, B) #define M_CONC_(A, B) A##B #define enum_count_suffix _count #define count(tag) M_CONC(tag, enum_count_suffix) #define countable_enum(tag, ...) \ enum tag {__VA_ARGS__}; \ const size_t count(tag) = sizeof((int []) {__VA_ARGS__}) / sizeof(int) // The following declares an enum with tag `color` and 3 constants: `red`, // `green`, and `blue`. countable_enum(color, red, green, blue); int main(int argc, char **argv) { // The following prints 3, as expected. printf("number of elements in enum: %d\n", count(color)); } ```
712,463
In C, is there a nice way to track the number of elements in an enum? I've seen ``` enum blah { FIRST, SECOND, THIRD, LAST }; ``` But this only works if the items are sequential and start at zero.
2009/04/03
[ "https://Stackoverflow.com/questions/712463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66349/" ]
``` int enaumVals[] = { FIRST, SECOND, THIRD, LAST }; #define NUM_ENUMS sizeof(enaumVals) / sizeof ( int ); ```
``` #include <stdio.h> // M_CONC and M_CONC_ come from https://stackoverflow.com/a/14804003/7067195 #define M_CONC(A, B) M_CONC_(A, B) #define M_CONC_(A, B) A##B #define enum_count_suffix _count #define count(tag) M_CONC(tag, enum_count_suffix) #define countable_enum(tag, ...) \ enum tag {__VA_ARGS__}; \ const size_t count(tag) = sizeof((int []) {__VA_ARGS__}) / sizeof(int) // The following declares an enum with tag `color` and 3 constants: `red`, // `green`, and `blue`. countable_enum(color, red, green, blue); int main(int argc, char **argv) { // The following prints 3, as expected. printf("number of elements in enum: %d\n", count(color)); } ```
712,463
In C, is there a nice way to track the number of elements in an enum? I've seen ``` enum blah { FIRST, SECOND, THIRD, LAST }; ``` But this only works if the items are sequential and start at zero.
2009/04/03
[ "https://Stackoverflow.com/questions/712463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66349/" ]
I know this is a very old question, but as the accepted answer is wrong, I feel compelled to post my own. I'll reuse the accepted answer's example, slightly modified. (Making the assumption that enums are sequential.) ``` // Incorrect code, do not use! enum blah { FIRST = 0, SECOND, // 1 THIRD, // 2 END // 3 }; const int blah_count = END - FIRST; // And this above would be 3 - 0 = 3, although there actually are 4 items. ``` Any developer knows the reason: `count = last - first + 1`. And this works with any combination of signs (both ends negative, both positive, or only first end negative). You can try. ``` // Now, the correct version. enum blah { FIRST = 0, SECOND, // 1 THIRD, // 2 END // 3 }; const int blah_count = END - FIRST + 1; // 4 ``` Edit: reading the text again, I got a doubt. Is that `END` meant not to be part of the offered items? That looks weird to me, but well, I guess it could make sense...
Well, since enums can't change at run-time, the best thing you can do is: ``` enum blah { FIRST = 7, SECOND = 15, THIRD = 9, LAST = 12 }; #define blahcount 4 /* counted manually, keep these in sync */ ``` But I find it difficult to envisage a situation where that information would come in handy. What exactly are you trying to do?
712,463
In C, is there a nice way to track the number of elements in an enum? I've seen ``` enum blah { FIRST, SECOND, THIRD, LAST }; ``` But this only works if the items are sequential and start at zero.
2009/04/03
[ "https://Stackoverflow.com/questions/712463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66349/" ]
I don't believe there is. But what would you do with such a number if they are not sequential, and you don't already have a list of them somewhere? And if they are sequential but start at a different number, you could always do: ``` enum blah { FIRST = 128, SECOND, THIRD, END }; const int blah_count = END - FIRST; ```
Unfortunately, no. There is not.
712,463
In C, is there a nice way to track the number of elements in an enum? I've seen ``` enum blah { FIRST, SECOND, THIRD, LAST }; ``` But this only works if the items are sequential and start at zero.
2009/04/03
[ "https://Stackoverflow.com/questions/712463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66349/" ]
Unfortunately, no. There is not.
I know this is a very old question, but as the accepted answer is wrong, I feel compelled to post my own. I'll reuse the accepted answer's example, slightly modified. (Making the assumption that enums are sequential.) ``` // Incorrect code, do not use! enum blah { FIRST = 0, SECOND, // 1 THIRD, // 2 END // 3 }; const int blah_count = END - FIRST; // And this above would be 3 - 0 = 3, although there actually are 4 items. ``` Any developer knows the reason: `count = last - first + 1`. And this works with any combination of signs (both ends negative, both positive, or only first end negative). You can try. ``` // Now, the correct version. enum blah { FIRST = 0, SECOND, // 1 THIRD, // 2 END // 3 }; const int blah_count = END - FIRST + 1; // 4 ``` Edit: reading the text again, I got a doubt. Is that `END` meant not to be part of the offered items? That looks weird to me, but well, I guess it could make sense...
712,463
In C, is there a nice way to track the number of elements in an enum? I've seen ``` enum blah { FIRST, SECOND, THIRD, LAST }; ``` But this only works if the items are sequential and start at zero.
2009/04/03
[ "https://Stackoverflow.com/questions/712463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66349/" ]
If you don't assign your enums you can do somethings like this: ``` enum MyType { Type1, Type2, Type3, NumberOfTypes } ``` NumberOfTypes will evaluate to 3 which is the number of real types.
``` int enaumVals[] = { FIRST, SECOND, THIRD, LAST }; #define NUM_ENUMS sizeof(enaumVals) / sizeof ( int ); ```
712,463
In C, is there a nice way to track the number of elements in an enum? I've seen ``` enum blah { FIRST, SECOND, THIRD, LAST }; ``` But this only works if the items are sequential and start at zero.
2009/04/03
[ "https://Stackoverflow.com/questions/712463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66349/" ]
I don't believe there is. But what would you do with such a number if they are not sequential, and you don't already have a list of them somewhere? And if they are sequential but start at a different number, you could always do: ``` enum blah { FIRST = 128, SECOND, THIRD, END }; const int blah_count = END - FIRST; ```
``` #include <stdio.h> // M_CONC and M_CONC_ come from https://stackoverflow.com/a/14804003/7067195 #define M_CONC(A, B) M_CONC_(A, B) #define M_CONC_(A, B) A##B #define enum_count_suffix _count #define count(tag) M_CONC(tag, enum_count_suffix) #define countable_enum(tag, ...) \ enum tag {__VA_ARGS__}; \ const size_t count(tag) = sizeof((int []) {__VA_ARGS__}) / sizeof(int) // The following declares an enum with tag `color` and 3 constants: `red`, // `green`, and `blue`. countable_enum(color, red, green, blue); int main(int argc, char **argv) { // The following prints 3, as expected. printf("number of elements in enum: %d\n", count(color)); } ```
187,922
I have a need to support multiple websites on a single IIS 7 server. One of these websites needs to be able to support wildcard subdomains. I was hoping to use host headers for this approach but am thinking this is not possible. The site that requires wildcard subdomains won't let me use \*.site.com in the host header and therefore won't respond to subdomain requests unless i set it to listen blindly on port 80. If I have that site listen blindly on port 80, it seems my other sites will not work. It's completely plausible I'm missing a step. Any help is greatly appreciated!
2009/10/23
[ "https://serverfault.com/questions/187922", "https://serverfault.com", "https://serverfault.com/users/46124/" ]
Give each separate website its own IP address and configure IIS to listen based on IP address rather than `Host` header. Then, any single website with multiple or wildcard subdomains but at a separate IP will work with IIS listening to all incoming requests on that IP.
Just use site.com not \*.site.com
187,922
I have a need to support multiple websites on a single IIS 7 server. One of these websites needs to be able to support wildcard subdomains. I was hoping to use host headers for this approach but am thinking this is not possible. The site that requires wildcard subdomains won't let me use \*.site.com in the host header and therefore won't respond to subdomain requests unless i set it to listen blindly on port 80. If I have that site listen blindly on port 80, it seems my other sites will not work. It's completely plausible I'm missing a step. Any help is greatly appreciated!
2009/10/23
[ "https://serverfault.com/questions/187922", "https://serverfault.com", "https://serverfault.com/users/46124/" ]
Give each separate website its own IP address and configure IIS to listen based on IP address rather than `Host` header. Then, any single website with multiple or wildcard subdomains but at a separate IP will work with IIS listening to all incoming requests on that IP.
My understanding is IIS doesnt support this. Im assuming the next best option is to use URL rewriting and set a rewrite in the global rules (not per site). I've been using IIRF with good results, and it is free. Version 2.x now has a server-level global re-write rules, then each site has its own per-site rewrite rules. I'd set something to redirect (or maybe even rewrite) \*.domain.com to a fixed sub, like www.domain.com. Or even get creative and pass it as a folder like domain.com/subdomain . Not optimal solutions, but should work. I'm really surprised we cant get iis to do regular wildcards on hostheaders. Seems pretty basic fucntionality.
23,443,464
I am new to bootstrap, and I am trying to align a logo and navbar to in the same line. Actually, in the image you see below. I want the menus, logo and navbar to start from the same point. ![enter image description here](https://i.stack.imgur.com/pvxWJ.jpg) I know how the 12 grid-system works. But how do we make classes nested inside the rows to indent properly. This is my HTML. ``` <section class="header-container jumbotron"> <nav class="col-md-12 col-md-offset-2"> <ul class="menu"> <li> <a href="/"> HOME </a> </li> <li> <a href="pages/about"> ABOUT </a></li> <li> <a href="pages/register"> SUBMIT YOUR BUSINESS! </a></li> <li> <a href="pages/login"> LOGIN </a> </li> <li> <a href="pages/contact"> CONTACT US </a> </li> </ul> </nav> <div class="col-md-4 col-md-offset-2 logo"> {{ HTML::image('img/logo.png', 'ethio360', array("height"=>44, "width"=>157))}} </div> <div class="container"> <div class="search-bar col-md-12"> {{ Form::open(['url'=>'/']) }} <div> {{ Form::label('title', 'Title')}} {{ Form::text('title') }} </div> <div> {{ Form::label('body', 'Body') }} {{ Form::text('body') }} </div> <div> {{ Form::submit('Create Text')}} </div> {{ Form::close() }} </div> </div> </section> ``` The only thing I need is for the menu to appear first, then the logo and finally the searchbar. But they should all start from the same place from left. and this is my css. ``` .jumbotron{ background: red; padding: 0; margin: 0; } .header-container{ min-height: 325px; background: #ffd106; background: url(../img/city.jpg); border-top:1px solid #252525; } .menu{ list-style-type: none; } .menu li a{ color:#252525; float:left; font-size:11px; padding:1px 10px; } .logo{ padding:10px; } .search-bar{ width:80%; background: none repeat scroll 0% 0% #252525; border-radius: 3px; box-shadow: 1px 1px 1px #545454; padding:5px 4px; color:#efefef; font-weight: normal; } .search-bar div{ float:left; margin-left: 10px; } .search-bar div input{ border:1px solid #CCC; padding:4px; margin-left:10px; } ```
2014/05/03
[ "https://Stackoverflow.com/questions/23443464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2520374/" ]
``` #include <iostream> int addNumber(int x, int y) { int answer = x + y; return answer; } int main() { int x,y; std::cin >> x >> y; std::cout << addNumber(x,y) << std::endl; return 0; } ```
``` #include <iostream> using namespace std; int addNumber(int x, int y) { int answer = x + y; return answer; } int main() { int x,y; cout<<"Enter first number"<<endl; cin>>x; cout<<"Enter second number"<<endl; cin>>y; cout<<addNumber(x,y)<<endl; return 0; } ```
12,883,490
If I load a customer in the following way: ``` $customer = Mage::getModel('customer/customer') ->load($customer_id); ``` Whats the difference between: ``` $customer -> getDefaultShippingAddress(); ``` and ``` $customer -> getPrimaryShippingAddress(); ``` Thanks in advance!
2012/10/14
[ "https://Stackoverflow.com/questions/12883490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1259801/" ]
They return the same result See /app/code/core/Mage/Customer/Model/Customer.php ``` /* * @return Mage_Customer_Model_Address */ public function getPrimaryBillingAddress() { return $this->getPrimaryAddress('default_billing'); } /** * Get customer default billing address * * @return Mage_Customer_Model_Address */ public function getDefaultBillingAddress() { return $this->getPrimaryBillingAddress(); } ```
Nothing because getDefaultShippingAddress() calls internally getPrimaryShippingAddress(). You can check the code yourself in /app/code/local/Mage/Customer/Model/Customer.php ``` /** * Get default customer shipping address * * @return Mage_Customer_Model_Address */ public function getPrimaryShippingAddress() { return $this->getPrimaryAddress('default_shipping'); } /** * Get default customer shipping address * * @return Mage_Customer_Model_Address */ public function getDefaultShippingAddress() { return $this->getPrimaryShippingAddress(); } ```
6,523,653
Prior to Rails 3, I used this code to observe a field dynamically and pass the data in that field to a controller: ``` <%= observe_field :transaction_borrower_netid, :url => { :controller => :live_validations, :action => :validate_borrower_netid }, :frequency => 0.5, :update => :borrower_netid_message, :with => "borrower_netid" %> ``` I'm trying to update that code to work with Jquery and Rails 3, but I can't get it to work. I updated my **routes.rb** to include ``` match "/live_validations/validate_borrower_netid" => "live_validations#validate_borrower_netid", :as => "validate_borrower" ``` and I'm trying to observe the field and make the necessary calls with: ``` jQuery(function($) { // when the #transaction_borrower_netid field changes $("#transaction_borrower_netid").change(function() { // make a POST call and update the borrower_netid_message with borrower_netid $.post(<%= validate_borrower_path %>, this.value, function(html) { $("#borrower_netid_message").html(html); }); }); }) ``` but it's not working. My Javascript and Jquery skills are severely lacking, so any help anyone could provide would be much appreciated. Thanks!
2011/06/29
[ "https://Stackoverflow.com/questions/6523653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/751114/" ]
You are able to do this, but it's not very clean, in terms of the proper `$_GET` variable values. The solution automatically type casts the values to integers: ``` sscanf($_GET['id'], '%d,%d', $id, $lang); // $id = int(5) // $lang = int(1) ```
``` $id = $id . ',' . $lang; <a href="?<?php echo $id; ?>"> ```
6,523,653
Prior to Rails 3, I used this code to observe a field dynamically and pass the data in that field to a controller: ``` <%= observe_field :transaction_borrower_netid, :url => { :controller => :live_validations, :action => :validate_borrower_netid }, :frequency => 0.5, :update => :borrower_netid_message, :with => "borrower_netid" %> ``` I'm trying to update that code to work with Jquery and Rails 3, but I can't get it to work. I updated my **routes.rb** to include ``` match "/live_validations/validate_borrower_netid" => "live_validations#validate_borrower_netid", :as => "validate_borrower" ``` and I'm trying to observe the field and make the necessary calls with: ``` jQuery(function($) { // when the #transaction_borrower_netid field changes $("#transaction_borrower_netid").change(function() { // make a POST call and update the borrower_netid_message with borrower_netid $.post(<%= validate_borrower_path %>, this.value, function(html) { $("#borrower_netid_message").html(html); }); }); }) ``` but it's not working. My Javascript and Jquery skills are severely lacking, so any help anyone could provide would be much appreciated. Thanks!
2011/06/29
[ "https://Stackoverflow.com/questions/6523653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/751114/" ]
You can use `mod_rewrite` to rewrite `?id=5,1` to `?id=5&lang=1` internally. Otherwise, the value of `id` will be `5,1`. Your application would then need to know that `id` contains more than the `id`. It could then parse out the language from the id. However, this will become confusing when you introduce more parameters.
``` $id = $id . ',' . $lang; <a href="?<?php echo $id; ?>"> ```
6,523,653
Prior to Rails 3, I used this code to observe a field dynamically and pass the data in that field to a controller: ``` <%= observe_field :transaction_borrower_netid, :url => { :controller => :live_validations, :action => :validate_borrower_netid }, :frequency => 0.5, :update => :borrower_netid_message, :with => "borrower_netid" %> ``` I'm trying to update that code to work with Jquery and Rails 3, but I can't get it to work. I updated my **routes.rb** to include ``` match "/live_validations/validate_borrower_netid" => "live_validations#validate_borrower_netid", :as => "validate_borrower" ``` and I'm trying to observe the field and make the necessary calls with: ``` jQuery(function($) { // when the #transaction_borrower_netid field changes $("#transaction_borrower_netid").change(function() { // make a POST call and update the borrower_netid_message with borrower_netid $.post(<%= validate_borrower_path %>, this.value, function(html) { $("#borrower_netid_message").html(html); }); }); }) ``` but it's not working. My Javascript and Jquery skills are severely lacking, so any help anyone could provide would be much appreciated. Thanks!
2011/06/29
[ "https://Stackoverflow.com/questions/6523653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/751114/" ]
Assuming you have already built the URL in the way you have specified, you can break the id field based on the comma and extract the real id and lang field ``` $urlPieces = explode(",", $_GET['id']); $id = $urlPieces[0]; $lang = $urlPieces[1]; ```
``` $id = $id . ',' . $lang; <a href="?<?php echo $id; ?>"> ```
6,523,653
Prior to Rails 3, I used this code to observe a field dynamically and pass the data in that field to a controller: ``` <%= observe_field :transaction_borrower_netid, :url => { :controller => :live_validations, :action => :validate_borrower_netid }, :frequency => 0.5, :update => :borrower_netid_message, :with => "borrower_netid" %> ``` I'm trying to update that code to work with Jquery and Rails 3, but I can't get it to work. I updated my **routes.rb** to include ``` match "/live_validations/validate_borrower_netid" => "live_validations#validate_borrower_netid", :as => "validate_borrower" ``` and I'm trying to observe the field and make the necessary calls with: ``` jQuery(function($) { // when the #transaction_borrower_netid field changes $("#transaction_borrower_netid").change(function() { // make a POST call and update the borrower_netid_message with borrower_netid $.post(<%= validate_borrower_path %>, this.value, function(html) { $("#borrower_netid_message").html(html); }); }); }) ``` but it's not working. My Javascript and Jquery skills are severely lacking, so any help anyone could provide would be much appreciated. Thanks!
2011/06/29
[ "https://Stackoverflow.com/questions/6523653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/751114/" ]
Two solutions: Firstly, you could simply reformat the parameters when they arrive in your PHP program. With `?id=5,1`, you'll get a PHP `$_GET` array with `id` `'5,1'`. This you can simply split using the `explode()` function to get the two values you want. The second solution is to use the Apache `mod_rewrite` feature, to modify the URL arguments before they arrive at PHP. For this, you'll need to understand regular expressions (regex), as mod\_rewrite uses this for it's work. You should google 'mod\_rewrite' and 'regex' to find out more. However mod\_rewrite is typically used to get rid of GET arguments entirely. For example the URLs of the questions on this site do not have any get arguments, but the server translates the arguments between the slashes into GET arguments. This is considered better practice than simply than changing how the arguments look, as it is more user-friendly and SEO friendly. Hope that helps.
``` $id = $id . ',' . $lang; <a href="?<?php echo $id; ?>"> ```
6,523,653
Prior to Rails 3, I used this code to observe a field dynamically and pass the data in that field to a controller: ``` <%= observe_field :transaction_borrower_netid, :url => { :controller => :live_validations, :action => :validate_borrower_netid }, :frequency => 0.5, :update => :borrower_netid_message, :with => "borrower_netid" %> ``` I'm trying to update that code to work with Jquery and Rails 3, but I can't get it to work. I updated my **routes.rb** to include ``` match "/live_validations/validate_borrower_netid" => "live_validations#validate_borrower_netid", :as => "validate_borrower" ``` and I'm trying to observe the field and make the necessary calls with: ``` jQuery(function($) { // when the #transaction_borrower_netid field changes $("#transaction_borrower_netid").change(function() { // make a POST call and update the borrower_netid_message with borrower_netid $.post(<%= validate_borrower_path %>, this.value, function(html) { $("#borrower_netid_message").html(html); }); }); }) ``` but it's not working. My Javascript and Jquery skills are severely lacking, so any help anyone could provide would be much appreciated. Thanks!
2011/06/29
[ "https://Stackoverflow.com/questions/6523653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/751114/" ]
You are able to do this, but it's not very clean, in terms of the proper `$_GET` variable values. The solution automatically type casts the values to integers: ``` sscanf($_GET['id'], '%d,%d', $id, $lang); // $id = int(5) // $lang = int(1) ```
Two solutions: Firstly, you could simply reformat the parameters when they arrive in your PHP program. With `?id=5,1`, you'll get a PHP `$_GET` array with `id` `'5,1'`. This you can simply split using the `explode()` function to get the two values you want. The second solution is to use the Apache `mod_rewrite` feature, to modify the URL arguments before they arrive at PHP. For this, you'll need to understand regular expressions (regex), as mod\_rewrite uses this for it's work. You should google 'mod\_rewrite' and 'regex' to find out more. However mod\_rewrite is typically used to get rid of GET arguments entirely. For example the URLs of the questions on this site do not have any get arguments, but the server translates the arguments between the slashes into GET arguments. This is considered better practice than simply than changing how the arguments look, as it is more user-friendly and SEO friendly. Hope that helps.
6,523,653
Prior to Rails 3, I used this code to observe a field dynamically and pass the data in that field to a controller: ``` <%= observe_field :transaction_borrower_netid, :url => { :controller => :live_validations, :action => :validate_borrower_netid }, :frequency => 0.5, :update => :borrower_netid_message, :with => "borrower_netid" %> ``` I'm trying to update that code to work with Jquery and Rails 3, but I can't get it to work. I updated my **routes.rb** to include ``` match "/live_validations/validate_borrower_netid" => "live_validations#validate_borrower_netid", :as => "validate_borrower" ``` and I'm trying to observe the field and make the necessary calls with: ``` jQuery(function($) { // when the #transaction_borrower_netid field changes $("#transaction_borrower_netid").change(function() { // make a POST call and update the borrower_netid_message with borrower_netid $.post(<%= validate_borrower_path %>, this.value, function(html) { $("#borrower_netid_message").html(html); }); }); }) ``` but it's not working. My Javascript and Jquery skills are severely lacking, so any help anyone could provide would be much appreciated. Thanks!
2011/06/29
[ "https://Stackoverflow.com/questions/6523653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/751114/" ]
You can use `mod_rewrite` to rewrite `?id=5,1` to `?id=5&lang=1` internally. Otherwise, the value of `id` will be `5,1`. Your application would then need to know that `id` contains more than the `id`. It could then parse out the language from the id. However, this will become confusing when you introduce more parameters.
Two solutions: Firstly, you could simply reformat the parameters when they arrive in your PHP program. With `?id=5,1`, you'll get a PHP `$_GET` array with `id` `'5,1'`. This you can simply split using the `explode()` function to get the two values you want. The second solution is to use the Apache `mod_rewrite` feature, to modify the URL arguments before they arrive at PHP. For this, you'll need to understand regular expressions (regex), as mod\_rewrite uses this for it's work. You should google 'mod\_rewrite' and 'regex' to find out more. However mod\_rewrite is typically used to get rid of GET arguments entirely. For example the URLs of the questions on this site do not have any get arguments, but the server translates the arguments between the slashes into GET arguments. This is considered better practice than simply than changing how the arguments look, as it is more user-friendly and SEO friendly. Hope that helps.
6,523,653
Prior to Rails 3, I used this code to observe a field dynamically and pass the data in that field to a controller: ``` <%= observe_field :transaction_borrower_netid, :url => { :controller => :live_validations, :action => :validate_borrower_netid }, :frequency => 0.5, :update => :borrower_netid_message, :with => "borrower_netid" %> ``` I'm trying to update that code to work with Jquery and Rails 3, but I can't get it to work. I updated my **routes.rb** to include ``` match "/live_validations/validate_borrower_netid" => "live_validations#validate_borrower_netid", :as => "validate_borrower" ``` and I'm trying to observe the field and make the necessary calls with: ``` jQuery(function($) { // when the #transaction_borrower_netid field changes $("#transaction_borrower_netid").change(function() { // make a POST call and update the borrower_netid_message with borrower_netid $.post(<%= validate_borrower_path %>, this.value, function(html) { $("#borrower_netid_message").html(html); }); }); }) ``` but it's not working. My Javascript and Jquery skills are severely lacking, so any help anyone could provide would be much appreciated. Thanks!
2011/06/29
[ "https://Stackoverflow.com/questions/6523653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/751114/" ]
Assuming you have already built the URL in the way you have specified, you can break the id field based on the comma and extract the real id and lang field ``` $urlPieces = explode(",", $_GET['id']); $id = $urlPieces[0]; $lang = $urlPieces[1]; ```
Two solutions: Firstly, you could simply reformat the parameters when they arrive in your PHP program. With `?id=5,1`, you'll get a PHP `$_GET` array with `id` `'5,1'`. This you can simply split using the `explode()` function to get the two values you want. The second solution is to use the Apache `mod_rewrite` feature, to modify the URL arguments before they arrive at PHP. For this, you'll need to understand regular expressions (regex), as mod\_rewrite uses this for it's work. You should google 'mod\_rewrite' and 'regex' to find out more. However mod\_rewrite is typically used to get rid of GET arguments entirely. For example the URLs of the questions on this site do not have any get arguments, but the server translates the arguments between the slashes into GET arguments. This is considered better practice than simply than changing how the arguments look, as it is more user-friendly and SEO friendly. Hope that helps.
8,751,082
Trying to put the Dark colored Like Box on my website, everything seems to function properly but the color looks like its the light scheme, what's the problem? Here's the code I used: ``` <iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fplatform&amp;width=360&amp;height=258&amp;colorscheme=dark&amp;show_faces=true&amp;border_color&amp;stream=false&amp;header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:360px; height:258px;" allowTransparency="true"></iframe> ``` I tried both the iframe and html5 codes. Another problem is sometimes only a couple faces show in the box and other times it displays max faces.
2012/01/05
[ "https://Stackoverflow.com/questions/8751082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1133216/" ]
The dark color scheme is rendering properly, but by design it doesn't have a background (it's transparent). Put it in front of a `div` with the background you want, as [demonstrated here](http://jsfiddle.net/R85V4/).
The developer button wizard wasn't working for me (using Chrome). Not sure why, but I found the data element that changes the colorscheme from light to dark. You can manually add the following and it will work just fine. **data-colorscheme="dark"** Example: ``` <div class="fb-like" data-href="http://www.nike.com" data-send="false" data-colorscheme="dark" data-width="450" data-show-faces="false"></div> ```
8,751,082
Trying to put the Dark colored Like Box on my website, everything seems to function properly but the color looks like its the light scheme, what's the problem? Here's the code I used: ``` <iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fplatform&amp;width=360&amp;height=258&amp;colorscheme=dark&amp;show_faces=true&amp;border_color&amp;stream=false&amp;header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:360px; height:258px;" allowTransparency="true"></iframe> ``` I tried both the iframe and html5 codes. Another problem is sometimes only a couple faces show in the box and other times it displays max faces.
2012/01/05
[ "https://Stackoverflow.com/questions/8751082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1133216/" ]
The dark color scheme is rendering properly, but by design it doesn't have a background (it's transparent). Put it in front of a `div` with the background you want, as [demonstrated here](http://jsfiddle.net/R85V4/).
I seem to get a similar error.. I'm using the 'like' and the 'login' plugin.. when I'm logged everything is fine.. when I'm not, my 'like' button is light... issue: [187studio.ch](http://187studio.ch) (top of the page)
8,751,082
Trying to put the Dark colored Like Box on my website, everything seems to function properly but the color looks like its the light scheme, what's the problem? Here's the code I used: ``` <iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fplatform&amp;width=360&amp;height=258&amp;colorscheme=dark&amp;show_faces=true&amp;border_color&amp;stream=false&amp;header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:360px; height:258px;" allowTransparency="true"></iframe> ``` I tried both the iframe and html5 codes. Another problem is sometimes only a couple faces show in the box and other times it displays max faces.
2012/01/05
[ "https://Stackoverflow.com/questions/8751082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1133216/" ]
The dark color scheme is rendering properly, but by design it doesn't have a background (it's transparent). Put it in front of a `div` with the background you want, as [demonstrated here](http://jsfiddle.net/R85V4/).
I know I'm late to this thread, but at the present time the dark color scheme appears broken so perhaps others might end up here looking for a solution. Jimmy Sawczuk's example above still works but that is because he isn't showing the 'stream'. If you set the 'stream' property to true you can see a big problem or two. ``` <div> <iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fplatform&amp;width=360&amp;height=258&amp;colorscheme=dark&amp;show_faces=true&amp;border_color&amp;stream=true&amp;header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:360px; height:258px;" allowTransparency="true"></iframe> </div> ``` [Link to demonstration](http://jsfiddle.net/gavula/R85V4/531/) 1. The posts themselves are all backed in white... so much for a dark color scheme 2. The account name next to the avatar is white text on a white background... So invisible. Since the markup is in the iframe and I've run out of properties to customize I'm wondering what can be done?
8,751,082
Trying to put the Dark colored Like Box on my website, everything seems to function properly but the color looks like its the light scheme, what's the problem? Here's the code I used: ``` <iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fplatform&amp;width=360&amp;height=258&amp;colorscheme=dark&amp;show_faces=true&amp;border_color&amp;stream=false&amp;header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:360px; height:258px;" allowTransparency="true"></iframe> ``` I tried both the iframe and html5 codes. Another problem is sometimes only a couple faces show in the box and other times it displays max faces.
2012/01/05
[ "https://Stackoverflow.com/questions/8751082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1133216/" ]
The developer button wizard wasn't working for me (using Chrome). Not sure why, but I found the data element that changes the colorscheme from light to dark. You can manually add the following and it will work just fine. **data-colorscheme="dark"** Example: ``` <div class="fb-like" data-href="http://www.nike.com" data-send="false" data-colorscheme="dark" data-width="450" data-show-faces="false"></div> ```
I seem to get a similar error.. I'm using the 'like' and the 'login' plugin.. when I'm logged everything is fine.. when I'm not, my 'like' button is light... issue: [187studio.ch](http://187studio.ch) (top of the page)
8,751,082
Trying to put the Dark colored Like Box on my website, everything seems to function properly but the color looks like its the light scheme, what's the problem? Here's the code I used: ``` <iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fplatform&amp;width=360&amp;height=258&amp;colorscheme=dark&amp;show_faces=true&amp;border_color&amp;stream=false&amp;header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:360px; height:258px;" allowTransparency="true"></iframe> ``` I tried both the iframe and html5 codes. Another problem is sometimes only a couple faces show in the box and other times it displays max faces.
2012/01/05
[ "https://Stackoverflow.com/questions/8751082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1133216/" ]
The developer button wizard wasn't working for me (using Chrome). Not sure why, but I found the data element that changes the colorscheme from light to dark. You can manually add the following and it will work just fine. **data-colorscheme="dark"** Example: ``` <div class="fb-like" data-href="http://www.nike.com" data-send="false" data-colorscheme="dark" data-width="450" data-show-faces="false"></div> ```
I know I'm late to this thread, but at the present time the dark color scheme appears broken so perhaps others might end up here looking for a solution. Jimmy Sawczuk's example above still works but that is because he isn't showing the 'stream'. If you set the 'stream' property to true you can see a big problem or two. ``` <div> <iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fplatform&amp;width=360&amp;height=258&amp;colorscheme=dark&amp;show_faces=true&amp;border_color&amp;stream=true&amp;header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:360px; height:258px;" allowTransparency="true"></iframe> </div> ``` [Link to demonstration](http://jsfiddle.net/gavula/R85V4/531/) 1. The posts themselves are all backed in white... so much for a dark color scheme 2. The account name next to the avatar is white text on a white background... So invisible. Since the markup is in the iframe and I've run out of properties to customize I'm wondering what can be done?
29,310,998
I can not set the name of the selected object in "BarraNome" how can I do? ``` public class MainActivity2Activity extends Activity { String[] lista1 = { "JAN", "FEB", "MAR", "APR", "MAY", "JUNE", "JULY","AUG", "SEPT", "OCT", "NOV", "DEC" }; Button BarraNome; private ListView lista; private ArrayAdapter arrayAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_activity2); lista = (ListView) findViewById(R.id.listacompleta); arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, lista1); lista.setAdapter(arrayAdapter); lista.setOnItemClickListener(new AdapterView.OnItemClickListener(){ @Override public void onItemClick(AdapterView<?> av, View v, int pos,long id){ ``` Look this part of code! ``` //This code works// Toast.makeText(getApplicationContext(),""+ lista1[pos], Toast.LENGTH_LONG).show(); //Don't works, why?// BarraNome.setText(""+ lista1[pos]); }});}} ``` Please help me
2015/03/27
[ "https://Stackoverflow.com/questions/29310998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4671207/" ]
You may need to call out to `expr`, depending on your mystery shell: ``` d1="2015-03-31" d2="2015-04-01" if [ "$d1" = "$d2" ]; then echo "same day" elif expr "$d1" "<" "$d2" >/dev/null; then echo "d1 is earlier than d2" else echo "d1 is later than d2" fi ``` ``` d1 is earlier than d2 ``` --- The `test` command (or it's alias `[`) only implements string equality and inequality operators. When you give the (non-bash) shell this command: ``` [ "$d1" > "$d2" ] ``` the `> "$d2"` part is treated as stdout redirection. A zero-length file named (in this case) "2015-04-01" is created, and the conditional command becomes ``` [ "$d1" ] ``` and as the variable is non-empty, that evaluates to a success status. The file is zero size because the `[` command generates no standard output.
You can use `date +%s -d your_date` to get the number of seconds since a fixed instance (1970-01-01, 00:00 UTC) called "epoch". Once you get that it's really easy to do almost anything with dates. And there are a couple of options to convert a number back to date too.
18,243,921
I'm very new to Objective-C so sorry if this is extremely obvious to many of you, but I'm trying to work out how the following piece of code is actually working: ``` - (IBAction)chooseColour:(UIButton *)sender { sender.selected = !sender.isSelected; } ``` Now it obviously toggles between the selected and unselected states of the button sending the action, but what is the code 'sender.selected = !sender.isSelected' actually saying? Is it just 'set the sender selected property to the opposite (i.e. ! not) of the getter'? So if the getter is 'getting' the current selected value as true then it sets the selected property as !true i.e false. Or is this a piece of convenience code that I'm not yet privy to? Because it also seems that '!sender.isSelected' simply means not selected as in ``` if (!sender.isSelected){ statement } ``` i.e. do statement if the sender is not selected. This is no doubt really obvious, just I'm a bit confused with it at the moment. Thanks!
2013/08/14
[ "https://Stackoverflow.com/questions/18243921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2658664/" ]
You are entirely correct, it's calling the getter to obtain the value and calling the setter with the NOT (`!`) of the value. It isn't Objective-C, it's plain C syntax.
> > Is it just 'set the sender selected property to the opposite (i.e. ! not) of the getter'? > > > Exactly. That. > > Or is this a piece of convenience code that I'm not yet privy to? > > > No, the only piece of syntactic sugar is the dot notation for getters/setters, but you are already aware of it.
18,243,921
I'm very new to Objective-C so sorry if this is extremely obvious to many of you, but I'm trying to work out how the following piece of code is actually working: ``` - (IBAction)chooseColour:(UIButton *)sender { sender.selected = !sender.isSelected; } ``` Now it obviously toggles between the selected and unselected states of the button sending the action, but what is the code 'sender.selected = !sender.isSelected' actually saying? Is it just 'set the sender selected property to the opposite (i.e. ! not) of the getter'? So if the getter is 'getting' the current selected value as true then it sets the selected property as !true i.e false. Or is this a piece of convenience code that I'm not yet privy to? Because it also seems that '!sender.isSelected' simply means not selected as in ``` if (!sender.isSelected){ statement } ``` i.e. do statement if the sender is not selected. This is no doubt really obvious, just I'm a bit confused with it at the moment. Thanks!
2013/08/14
[ "https://Stackoverflow.com/questions/18243921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2658664/" ]
You are entirely correct, it's calling the getter to obtain the value and calling the setter with the NOT (`!`) of the value. It isn't Objective-C, it's plain C syntax.
The portion of the code: ``` sender.selected = !sender.isSelected; ``` Basically inverts the selection. It asks the question `Is this false?` so true evaluates false, and false evaluates to true. So it's a toggle.
18,243,921
I'm very new to Objective-C so sorry if this is extremely obvious to many of you, but I'm trying to work out how the following piece of code is actually working: ``` - (IBAction)chooseColour:(UIButton *)sender { sender.selected = !sender.isSelected; } ``` Now it obviously toggles between the selected and unselected states of the button sending the action, but what is the code 'sender.selected = !sender.isSelected' actually saying? Is it just 'set the sender selected property to the opposite (i.e. ! not) of the getter'? So if the getter is 'getting' the current selected value as true then it sets the selected property as !true i.e false. Or is this a piece of convenience code that I'm not yet privy to? Because it also seems that '!sender.isSelected' simply means not selected as in ``` if (!sender.isSelected){ statement } ``` i.e. do statement if the sender is not selected. This is no doubt really obvious, just I'm a bit confused with it at the moment. Thanks!
2013/08/14
[ "https://Stackoverflow.com/questions/18243921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2658664/" ]
You are entirely correct, it's calling the getter to obtain the value and calling the setter with the NOT (`!`) of the value. It isn't Objective-C, it's plain C syntax.
from documentation : ``` @property(nonatomic,getter=isSelected) BOOL selected; // default is NO may be used by some subclasses or by application ``` //explanation if you use ![sender isSelected] value in property isn't changed. then if you use setter sender.selected = ![sender isSelected] - new value is set to the sender (selected property). then run getter sender isSelected return new value, uff i hope it helps
18,243,921
I'm very new to Objective-C so sorry if this is extremely obvious to many of you, but I'm trying to work out how the following piece of code is actually working: ``` - (IBAction)chooseColour:(UIButton *)sender { sender.selected = !sender.isSelected; } ``` Now it obviously toggles between the selected and unselected states of the button sending the action, but what is the code 'sender.selected = !sender.isSelected' actually saying? Is it just 'set the sender selected property to the opposite (i.e. ! not) of the getter'? So if the getter is 'getting' the current selected value as true then it sets the selected property as !true i.e false. Or is this a piece of convenience code that I'm not yet privy to? Because it also seems that '!sender.isSelected' simply means not selected as in ``` if (!sender.isSelected){ statement } ``` i.e. do statement if the sender is not selected. This is no doubt really obvious, just I'm a bit confused with it at the moment. Thanks!
2013/08/14
[ "https://Stackoverflow.com/questions/18243921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2658664/" ]
> > Is it just 'set the sender selected property to the opposite (i.e. ! not) of the getter'? > > > Exactly. That. > > Or is this a piece of convenience code that I'm not yet privy to? > > > No, the only piece of syntactic sugar is the dot notation for getters/setters, but you are already aware of it.
The portion of the code: ``` sender.selected = !sender.isSelected; ``` Basically inverts the selection. It asks the question `Is this false?` so true evaluates false, and false evaluates to true. So it's a toggle.
18,243,921
I'm very new to Objective-C so sorry if this is extremely obvious to many of you, but I'm trying to work out how the following piece of code is actually working: ``` - (IBAction)chooseColour:(UIButton *)sender { sender.selected = !sender.isSelected; } ``` Now it obviously toggles between the selected and unselected states of the button sending the action, but what is the code 'sender.selected = !sender.isSelected' actually saying? Is it just 'set the sender selected property to the opposite (i.e. ! not) of the getter'? So if the getter is 'getting' the current selected value as true then it sets the selected property as !true i.e false. Or is this a piece of convenience code that I'm not yet privy to? Because it also seems that '!sender.isSelected' simply means not selected as in ``` if (!sender.isSelected){ statement } ``` i.e. do statement if the sender is not selected. This is no doubt really obvious, just I'm a bit confused with it at the moment. Thanks!
2013/08/14
[ "https://Stackoverflow.com/questions/18243921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2658664/" ]
> > Is it just 'set the sender selected property to the opposite (i.e. ! not) of the getter'? > > > Exactly. That. > > Or is this a piece of convenience code that I'm not yet privy to? > > > No, the only piece of syntactic sugar is the dot notation for getters/setters, but you are already aware of it.
from documentation : ``` @property(nonatomic,getter=isSelected) BOOL selected; // default is NO may be used by some subclasses or by application ``` //explanation if you use ![sender isSelected] value in property isn't changed. then if you use setter sender.selected = ![sender isSelected] - new value is set to the sender (selected property). then run getter sender isSelected return new value, uff i hope it helps
24,056,020
Here is HTML: ``` <div class="vl-article-title"> <h3> <span style="font-size: 24px;"> <a href="http://www.15min.lt/naujiena/sportas/fifa-2014/desimt-pasaul…onato-debiutantu-kurie-atkreips-jusu-demesi-813-430673?cf=vl"></a> </span> </h3> </div> ``` I need to get only links (a) but I don't know how. Is it possible to do something like this: ``` h3 = soup.select('div.vl-article-title > h3 > a') ``` ?
2014/06/05
[ "https://Stackoverflow.com/questions/24056020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2788600/" ]
The > sign is the direct descendant selector. It will not match the A element because there's a span in between. You should be able to do this: ``` h3 = soup.select('div.vl-article-title > h3 > span > a') ``` Or, if it's OK to be a little less specific with the selector: ``` h3 = soup.select('div.vl-article-title a') ``` That matches all a elements which are undir the div with the class vl-article-title. **EDIT:** Sorry, been a while since I used beautiful soup, I mistakenly thought it worked with CSS selectors, but it does not. One way to do this is: ``` a = soup.find("div", attrs={"class": "vl-article-title"}).find("h3").find("span").find("a") ```
If that's the entire HTML, then you can simply do the following: ``` soup = BeautifulSoup(html) link = soup.find("a").attrs["href"] # this gives you the link as a string ``` If there are multiple `<a>` tags in the page, you can replace the `find("a")` with `find_all("a")`, which returns an iterator. **EDIT** per request, `<a>` tags being located within `<h3>` tag: `link = soup.find("h3").find("a").attrs["href"]`
124,576
On the Account page, I have a lookup for Secondary Contact. I also have two formula fields: Secondary Contact Email and Secondary Contact Phone. If you choose someone in the Secondary Contact field, it should populate the Secondary Contact Email and Secondary Contact Phone fields. And this is mostly happening. I have three email fields on the contact record: Preferred Email, Work Email, and Alternate Email. I can get Preferred and Work to populate the formula in accounts but Alternate will not come into accounts. I am lost....What am I doing wrong? ``` IF(NOT(ISBLANK(Secondary_Contact__r.npe01__HomeEmail__c)), Secondary_Contact__r.npe01__HomeEmail__c, IF(ISBLANK(Secondary_Contact__r.npe01__HomeEmail__c), Secondary_Contact__r.npe01__WorkEmail__c, IF( AND( ISBLANK(Secondary_Contact__r.npe01__HomeEmail__c), ISBLANK(Secondary_Contact__r.npe01__WorkEmail__c)), Secondary_Contact__r.npe01__AlternateEmail__c, null ) ) ) ```
2016/06/03
[ "https://salesforce.stackexchange.com/questions/124576", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/32133/" ]
Something like this should work ``` IF(NOT(ISBLANK(Secondary_Contact__r.npe01__HomeEmail__c)) ,Secondary_Contact__r.npe01__HomeEmail__c, (IF(NOT(ISBLANK(Secondary_Contact__r.npe01__WorkEmail__c))),Secondary_Contact__r.npe01__WorkEmail__c, Secondary_Contact__r.npe01__AlternateEmail__c)) ``` Your version is overcomplicated because you are rechecking things in the "else" part. If you are in the "else" of `NOT(ISBLANK(Secondary_Contact__r.npe01__HomeEmail__c))` then you do not need to check again `ISBLANK(Secondary_Contact__r.npe01__HomeEmail__c))`
You can try `BLANKVALUE`: ``` BLANKVALUE(Secondary_Contact__r.npe01__HomeEmail__c, BLANKVALUE( Secondary_Contact__r.npe01__WorkEmail__c, Secondary_Contact__r.npe01__AlternateEmail__c ) ) ``` What this formula says is basically: 1. If the `Home Email` is not blank, use that value. 2. Else if `Work Email` is not blank, use that value. 3. Else use `Alternate Email`.
32,311
I'm interested in \*coin, but I'm afraid of sinking money into something out of idle curiosity and then losing that money to value fluctuations. Would it be a good idea to have several different \*coin (lite, doge, idk what else there is) so that the fluctuations balance each other? Have different \*coin in the past gained and lost value in 'lockstep', or totally independent or inversely? I'm aware that I would also loose the chance to gain money from course fluctuations, but I don't that's [something to loose sleep over](http://blockchain.info/de/charts/market-price).
2014/11/04
[ "https://bitcoin.stackexchange.com/questions/32311", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/13856/" ]
I don't see how different coins would protect against volatility, as Bitcoin is by far the leading cryptocurrency, and the others (even all of them combined) are really totally insignificant in terms of market cap and trading volume. If you want to protect against volatility (given that you measure volatility in terms of value expressed in fiat currency), there's two options: * use [Coinapult Locks](https://coinapult.com/locks/info) * keep part of your money in fiat Simple as that. Seriously, just not investing part of your money in something is the best and easiest way to suppress its volatility.
You should see \*coin as a **very high risk** asset. The strategy "diversify your investment" only works on regular stocks since people generally see the markets rising over large amounts of time on established companies. (The fluctuations average in accordance to the *law of large numbers*) It is much more risky to invest in something completely new no-one has genuine, long-term experience with. Stating that, the *law of large numbers* cannot be applied since chances are equally high for rates to explode or crash. tl;dr **Diversifying does not really work on \*coins by now**
32,311
I'm interested in \*coin, but I'm afraid of sinking money into something out of idle curiosity and then losing that money to value fluctuations. Would it be a good idea to have several different \*coin (lite, doge, idk what else there is) so that the fluctuations balance each other? Have different \*coin in the past gained and lost value in 'lockstep', or totally independent or inversely? I'm aware that I would also loose the chance to gain money from course fluctuations, but I don't that's [something to loose sleep over](http://blockchain.info/de/charts/market-price).
2014/11/04
[ "https://bitcoin.stackexchange.com/questions/32311", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/13856/" ]
I don't see how different coins would protect against volatility, as Bitcoin is by far the leading cryptocurrency, and the others (even all of them combined) are really totally insignificant in terms of market cap and trading volume. If you want to protect against volatility (given that you measure volatility in terms of value expressed in fiat currency), there's two options: * use [Coinapult Locks](https://coinapult.com/locks/info) * keep part of your money in fiat Simple as that. Seriously, just not investing part of your money in something is the best and easiest way to suppress its volatility.
There are services emerging to combat the volatility of Bitcoin. Bitreserve is one. But to be honest if you are worried about the volatility, just keep your funds in your native currency and buy bitcoin when you need bitcoin since there are plenty of places you can buy bitcoin almost instantly.
29,220,881
I am working with VPN on iOS using the NetworkExtension framework. I am able to install the config and make connection. My question is if there's a way to detect if the VPN config is still installed or detect if user has un-installed the config? I am not necessarily looking for a notification or anything in the background but what I am looking for is some method/workaround that I do when the application is brought to foreground? I'm using certificate authentication with a certificate issued by an intermediate CA and have tried 'evaluating trust' method from here: [Check if a configuration profile is installed on iOS](http://blog.markhorgan.com/?p=701) This did not work for me. I always comes to be trusted. I have also tried this: ``` if([NEVPNManager sharedManager].protocol){ //installed }else{ //not installed } ``` But this also does not work. After uninstallation the protocol remains valid. If I quit and relaunch the app then the protocol is invalid. Any suggestions are appreciated.
2015/03/23
[ "https://Stackoverflow.com/questions/29220881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2060112/" ]
You can try following ``` if ([[[NEVPNManager sharedManager] connection] status] == NEVPNStatusInvalid) { //... } ```
Might be a little late. But i've encountered the same problem. However, your approach got me in the right direction. You should load it within the completion handler of: `loadFromPreferencesWithCompletionHandler` The propper use, in my opinion, of checking if there is a profile installed: ``` manager = [NEVPNManager sharedManager]; [manager loadFromPreferencesWithCompletionHandler:^(NSError *error) { if (manager.protocol == nil) { NSLog(@"Profile is not installed, you might want to install a profile"); } else { NSLog(@"Profile is installed. It looks like this: %@",manager.protocol); } }]; ```
1,019,267
Consider 3 baskets. Basket A contains 3 white and 5 red marbles. Basket B contains 8 white and 3 red marbles. Basket C contains 4 white and 4 red marbles. An experiment consists of selecting one marble from each basket at random. What is the probability that the marble selected from basket A was white, given that exactly 2 white marbles were selected in this process. I know P(AB) = 33/176 and I understand how to get there. However I'm not sure why P(B) = 73/176. Here is the answer, but can you explain why?
2014/11/12
[ "https://math.stackexchange.com/questions/1019267", "https://math.stackexchange.com", "https://math.stackexchange.com/users/177356/" ]
By Bayes rule, the required probability is equal to $$P(A\_w|W=2)=\frac{P(W=2|A\_w)P(A\_w)}{P(W=2)}=\frac{\frac{1}{2}\frac{3}{8}}{\frac{73}{176}}=\frac{33}{73}$$ since $$P(W=2|A\_w)=P(B\_w)P(C\_r)+P(B\_r)(C\_w)=\frac{1}{2}$$ and $$\begin{align\*}P(W=2)&=P(A\_w)P(B\_w)P(C\_r)+P(A\_w)P(B\_r)P(C\_w)+P(A\_r)P(B\_w)P(C\_w)\\\\&=\frac{3}{8}\frac{8}{11}\frac{1}{2}+\frac{3}{8}\frac{3}{11}\frac{1}{2}+\frac{5}{8}\frac{8}{11}\frac{1}{2}=\frac{73}{176}\end{align\*}$$
Let $A,B,C$ be the event of selecting a white marble from the relevant container. $$\mathsf P(A) = 3/8, \mathsf P(B) = 8/11, \mathsf P(C) = 1/2$$ We want: $$\require{cancel} \begin{align} \mathsf P(A\mid ABC^c\cup AB^cC\cup A^cBC) & = \frac{\mathsf P(ABC^c\cup AB^cC)}{\mathsf P(ABC^c\cup AB^cC\cup A^cBC)} \\[1ex] & =\frac{\mathsf P(A)\Big(\mathsf P(B)\mathsf P(C^c)+\mathsf P(B^c)\mathsf P(C)\Big)}{\mathsf P(A)\Big(\mathsf P(B)\mathsf P(C^c)+\mathsf P(B^c)\mathsf P(C)\Big)+\mathsf P(A^c)\mathsf P(B)\mathsf P(C)} \\[1ex] & = \frac{\frac 3 8\big(\frac 8 {11}\frac{1}{2}+\frac{3}{11}\frac 1 2\big)}{\frac 3 8\big(\frac 8 {11}\frac 12+\frac 3 {11}\frac 1 2\big)+ \frac 5 8\frac 8 {11}\frac 1 2} \\[1ex] & = \frac{33\cancel{/176}}{73\cancel{/176}} \end{align}$$
14,841,746
I have a JS app that saves to localStorage. No big deal. However, what's being stored are fairly large JSONs. 10MB vanishes quickly. What I'd like to do is, if storage is full, delete the oldest record. Is there a way to reliably find the oldest record in localStorage?
2013/02/12
[ "https://Stackoverflow.com/questions/14841746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/435175/" ]
In order to make your LayerSlider display at 100% height and width, leave the "Slider height" attribute in "Slider Settings" blank, and then use a script like the following to set the height: ``` <script type="text/javascript"> function resize() { var heights = window.innerHeight; document.getElementById("layerslider_1").style.height = heights + "px"; } resize(); window.onresize = function() { resize(); }; </script> ``` Insert the script into your footer.php file before the closing body tag. If your slider ID isn't number 1, then change "layerslider\_1" to the correct ID.
you can add style to the div element ``` <div style="background: url(images/xyz.jpg) no-repeat center center fixed;">...</div> ``` I just took the css from your sample page and copy/pasted!
36,287,160
DataBase has table with saved Tweets. There is controller: ``` <?php namespace app\controllers; use yii\rest\ActiveController; class TweetController extends ActiveController { public $modelClass = 'app\models\Tweet'; } ``` Corresponding model `app\model\Tweet` created by `gii`. In `app\web\config` added: ``` .............. 'components' => [ 'urlManager' => [ 'enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => [ ['class' => 'yii\rest\UrlRule', 'controller' => 'tweet'], ], ], 'request' => [ 'parsers' =>['application/json' => 'yii\web\JsonParser', ], ], ............... ``` In `app\web` added `.htaccess` according <http://www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html> In `apache` DocumentRoot as `app\web` According yii2 docs: `curl -i -H "Accept:application/json" "http://localhost/tweets"` must return paged model data. Instead of this: ``` HTTP/1.1 404 Not Found Date: Tue, 29 Mar 2016 14:04:05 GMT Server: Apache/2.4.7 (Ubuntu) Content-Length: 278 Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /tweets was not found on this server.</p> <hr> <address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address> </body></html> ``` Also tryed - urlManager `'controller' => ['tw' => 'tweet']` whit according url. why there is 404? Guided by <http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html> added: well... url should be `http://localhost/index.php/tweets` but it`s not obviously for me.
2016/03/29
[ "https://Stackoverflow.com/questions/36287160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5923447/" ]
The path should be ``` http:://localhost/yii2/tweets ``` or ``` http:://localhost/yii2/index.php/tweets ``` (depending by the correct configuration of urlManager) try also ``` http:://localhost/yii2/tweets/index ``` or ``` http:://localhost/yii2/index.php/tweets/index ``` could be you can find useful this tutorial <http://budiirawan.com/setup-restful-api-yii2/>
add followings lines to your controller: ``` protected function verbs() { $verbs = parent::verbs(); $verbs = [ 'index' => ['GET', 'POST', 'HEAD'], 'view' => ['GET', 'HEAD'], 'create' => ['POST'], 'update' => ['PUT', 'PATCH'] ]; return $verbs; } ```
36,287,160
DataBase has table with saved Tweets. There is controller: ``` <?php namespace app\controllers; use yii\rest\ActiveController; class TweetController extends ActiveController { public $modelClass = 'app\models\Tweet'; } ``` Corresponding model `app\model\Tweet` created by `gii`. In `app\web\config` added: ``` .............. 'components' => [ 'urlManager' => [ 'enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => [ ['class' => 'yii\rest\UrlRule', 'controller' => 'tweet'], ], ], 'request' => [ 'parsers' =>['application/json' => 'yii\web\JsonParser', ], ], ............... ``` In `app\web` added `.htaccess` according <http://www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html> In `apache` DocumentRoot as `app\web` According yii2 docs: `curl -i -H "Accept:application/json" "http://localhost/tweets"` must return paged model data. Instead of this: ``` HTTP/1.1 404 Not Found Date: Tue, 29 Mar 2016 14:04:05 GMT Server: Apache/2.4.7 (Ubuntu) Content-Length: 278 Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /tweets was not found on this server.</p> <hr> <address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address> </body></html> ``` Also tryed - urlManager `'controller' => ['tw' => 'tweet']` whit according url. why there is 404? Guided by <http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html> added: well... url should be `http://localhost/index.php/tweets` but it`s not obviously for me.
2016/03/29
[ "https://Stackoverflow.com/questions/36287160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5923447/" ]
The path should be ``` http:://localhost/yii2/tweets ``` or ``` http:://localhost/yii2/index.php/tweets ``` (depending by the correct configuration of urlManager) try also ``` http:://localhost/yii2/tweets/index ``` or ``` http:://localhost/yii2/index.php/tweets/index ``` could be you can find useful this tutorial <http://budiirawan.com/setup-restful-api-yii2/>
I just encountered this issue and spent some time tracing through the code to find that you must have an alias defined for your project. Without that, it cannot load your controllers. I am working in a Yii2 advanced template setup where I have this structure: ``` /common /mainApp /api ``` In `/common/config/bootstrap.php`, I had to add: ```php Yii::setAlias('@api', dirname(dirname(__DIR__)) . '/api'); ``` This allows the controller find and load/create process in the Yii 2 framework to work correctly. Without it, the class\_exists check in `yii2\base\Module.php` on line 637 will fail and cause the request to result in a 404. Hope this helps someone! ~Cheers :)
36,287,160
DataBase has table with saved Tweets. There is controller: ``` <?php namespace app\controllers; use yii\rest\ActiveController; class TweetController extends ActiveController { public $modelClass = 'app\models\Tweet'; } ``` Corresponding model `app\model\Tweet` created by `gii`. In `app\web\config` added: ``` .............. 'components' => [ 'urlManager' => [ 'enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => [ ['class' => 'yii\rest\UrlRule', 'controller' => 'tweet'], ], ], 'request' => [ 'parsers' =>['application/json' => 'yii\web\JsonParser', ], ], ............... ``` In `app\web` added `.htaccess` according <http://www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html> In `apache` DocumentRoot as `app\web` According yii2 docs: `curl -i -H "Accept:application/json" "http://localhost/tweets"` must return paged model data. Instead of this: ``` HTTP/1.1 404 Not Found Date: Tue, 29 Mar 2016 14:04:05 GMT Server: Apache/2.4.7 (Ubuntu) Content-Length: 278 Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /tweets was not found on this server.</p> <hr> <address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address> </body></html> ``` Also tryed - urlManager `'controller' => ['tw' => 'tweet']` whit according url. why there is 404? Guided by <http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html> added: well... url should be `http://localhost/index.php/tweets` but it`s not obviously for me.
2016/03/29
[ "https://Stackoverflow.com/questions/36287160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5923447/" ]
I also got the same problem.This is my solution,which worked well for me(Apache 2.2). \*\*Editing the apache2.conf file and changing the AllowOverride from None to All. Then restart Apache Service \*\*
add followings lines to your controller: ``` protected function verbs() { $verbs = parent::verbs(); $verbs = [ 'index' => ['GET', 'POST', 'HEAD'], 'view' => ['GET', 'HEAD'], 'create' => ['POST'], 'update' => ['PUT', 'PATCH'] ]; return $verbs; } ```
36,287,160
DataBase has table with saved Tweets. There is controller: ``` <?php namespace app\controllers; use yii\rest\ActiveController; class TweetController extends ActiveController { public $modelClass = 'app\models\Tweet'; } ``` Corresponding model `app\model\Tweet` created by `gii`. In `app\web\config` added: ``` .............. 'components' => [ 'urlManager' => [ 'enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => [ ['class' => 'yii\rest\UrlRule', 'controller' => 'tweet'], ], ], 'request' => [ 'parsers' =>['application/json' => 'yii\web\JsonParser', ], ], ............... ``` In `app\web` added `.htaccess` according <http://www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html> In `apache` DocumentRoot as `app\web` According yii2 docs: `curl -i -H "Accept:application/json" "http://localhost/tweets"` must return paged model data. Instead of this: ``` HTTP/1.1 404 Not Found Date: Tue, 29 Mar 2016 14:04:05 GMT Server: Apache/2.4.7 (Ubuntu) Content-Length: 278 Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /tweets was not found on this server.</p> <hr> <address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address> </body></html> ``` Also tryed - urlManager `'controller' => ['tw' => 'tweet']` whit according url. why there is 404? Guided by <http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html> added: well... url should be `http://localhost/index.php/tweets` but it`s not obviously for me.
2016/03/29
[ "https://Stackoverflow.com/questions/36287160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5923447/" ]
I also got the same problem.This is my solution,which worked well for me(Apache 2.2). \*\*Editing the apache2.conf file and changing the AllowOverride from None to All. Then restart Apache Service \*\*
I just encountered this issue and spent some time tracing through the code to find that you must have an alias defined for your project. Without that, it cannot load your controllers. I am working in a Yii2 advanced template setup where I have this structure: ``` /common /mainApp /api ``` In `/common/config/bootstrap.php`, I had to add: ```php Yii::setAlias('@api', dirname(dirname(__DIR__)) . '/api'); ``` This allows the controller find and load/create process in the Yii 2 framework to work correctly. Without it, the class\_exists check in `yii2\base\Module.php` on line 637 will fail and cause the request to result in a 404. Hope this helps someone! ~Cheers :)
36,287,160
DataBase has table with saved Tweets. There is controller: ``` <?php namespace app\controllers; use yii\rest\ActiveController; class TweetController extends ActiveController { public $modelClass = 'app\models\Tweet'; } ``` Corresponding model `app\model\Tweet` created by `gii`. In `app\web\config` added: ``` .............. 'components' => [ 'urlManager' => [ 'enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => [ ['class' => 'yii\rest\UrlRule', 'controller' => 'tweet'], ], ], 'request' => [ 'parsers' =>['application/json' => 'yii\web\JsonParser', ], ], ............... ``` In `app\web` added `.htaccess` according <http://www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html> In `apache` DocumentRoot as `app\web` According yii2 docs: `curl -i -H "Accept:application/json" "http://localhost/tweets"` must return paged model data. Instead of this: ``` HTTP/1.1 404 Not Found Date: Tue, 29 Mar 2016 14:04:05 GMT Server: Apache/2.4.7 (Ubuntu) Content-Length: 278 Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /tweets was not found on this server.</p> <hr> <address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address> </body></html> ``` Also tryed - urlManager `'controller' => ['tw' => 'tweet']` whit according url. why there is 404? Guided by <http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html> added: well... url should be `http://localhost/index.php/tweets` but it`s not obviously for me.
2016/03/29
[ "https://Stackoverflow.com/questions/36287160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5923447/" ]
I had the same problem, I set `'enableStrictParsing' => false` and it worked for me.
add followings lines to your controller: ``` protected function verbs() { $verbs = parent::verbs(); $verbs = [ 'index' => ['GET', 'POST', 'HEAD'], 'view' => ['GET', 'HEAD'], 'create' => ['POST'], 'update' => ['PUT', 'PATCH'] ]; return $verbs; } ```
36,287,160
DataBase has table with saved Tweets. There is controller: ``` <?php namespace app\controllers; use yii\rest\ActiveController; class TweetController extends ActiveController { public $modelClass = 'app\models\Tweet'; } ``` Corresponding model `app\model\Tweet` created by `gii`. In `app\web\config` added: ``` .............. 'components' => [ 'urlManager' => [ 'enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => [ ['class' => 'yii\rest\UrlRule', 'controller' => 'tweet'], ], ], 'request' => [ 'parsers' =>['application/json' => 'yii\web\JsonParser', ], ], ............... ``` In `app\web` added `.htaccess` according <http://www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html> In `apache` DocumentRoot as `app\web` According yii2 docs: `curl -i -H "Accept:application/json" "http://localhost/tweets"` must return paged model data. Instead of this: ``` HTTP/1.1 404 Not Found Date: Tue, 29 Mar 2016 14:04:05 GMT Server: Apache/2.4.7 (Ubuntu) Content-Length: 278 Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /tweets was not found on this server.</p> <hr> <address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address> </body></html> ``` Also tryed - urlManager `'controller' => ['tw' => 'tweet']` whit according url. why there is 404? Guided by <http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html> added: well... url should be `http://localhost/index.php/tweets` but it`s not obviously for me.
2016/03/29
[ "https://Stackoverflow.com/questions/36287160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5923447/" ]
I had the same problem, I set `'enableStrictParsing' => false` and it worked for me.
I just encountered this issue and spent some time tracing through the code to find that you must have an alias defined for your project. Without that, it cannot load your controllers. I am working in a Yii2 advanced template setup where I have this structure: ``` /common /mainApp /api ``` In `/common/config/bootstrap.php`, I had to add: ```php Yii::setAlias('@api', dirname(dirname(__DIR__)) . '/api'); ``` This allows the controller find and load/create process in the Yii 2 framework to work correctly. Without it, the class\_exists check in `yii2\base\Module.php` on line 637 will fail and cause the request to result in a 404. Hope this helps someone! ~Cheers :)
69,679,870
Is there a simple solution (lint rule perhaps?) which can help enforce clean code imports through index files? I'd like to prevent importing code from "cousin" files, except if it is made available through an index file. Ex: ``` - app + dogs | + index.ts | + breeds | | + retriever.ts | | + schnauzer.ts | + activities | + playing.ts | + walking.ts + cats + index.ts + breeds | + siamese.ts | + persion.ts + activities + sleeping.ts + hunting.ts ``` Importing from the perspective of `cats/activities/hunting.ts`: ``` import { sleeping } from './sleeping' // VALID - inside same folder import { siamese } from '../breeds/siamese' // VALID - inside cats module import { playing } from '../../dogs' // VALID - importing from an index import { retriever} from '../../dogs/activities/breeds' // INVALID - cousin file outside module possibly not exported from index ```
2021/10/22
[ "https://Stackoverflow.com/questions/69679870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2908576/" ]
You can use eslint's [`import/no-internal-modules` rule](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-internal-modules.md) and configure separate `.eslintrc` rules per "root" module. In your `dogs` folder, create a new `.eslintrc` file with this contents: ``` { "rules": { "import/no-internal-modules": [ "error", { "allow": [ "app/dogs/**", "app/*" ], } ] } } ``` This means any js/ts file within the dogs folder (or any sub folder of dogs) may import files from its own package *OR* any package like `/cats` Do the same for your `cats` and any other "root" module.
The eslint [`no-restricted-imports`](https://eslint.org/docs/rules/no-restricted-imports) rule can be used to provide custom rules for import patterns. This pattern prevents anything 2+ levels up and then 2+ levels down, which prevents cousin imports. ```json "no-restricted-imports": [ "warn", { "patterns": [ { "group": ["**/../../[a-zA-Z]*/[a-zA-Z]*/**"], "message": "File not exposed from the module. Consider exporting it from an index" } ] } ] ```
46,250
I'm using an API which returns text in the following format: ``` #start #p 09060 20131010 #p 09180 AK #p 01001 19110212982 #end #start #p 09060 20131110 #p 09180 AB #p 01001 12110212982 #end ``` I'm converting this to a list of objects: ``` var result = data.match(/#start[\s\S]+?#end/ig).map(function(v){ var lines = v.split('\n'), ret = {}; $.each(lines, function(_, v2){ var split = v2.split(' '); if(split[1] && split[2]) ret[split[1]] = split[2]; }); return ret; }); ``` My concern is that the API returns quite a lot of data, therefore I would like some feedback regarding on how to improve the performance. For instance, is there any way to reduce the mapping complexity from O(N2) to O(N)? Also, please suggest regex improvements :)
2014/04/04
[ "https://codereview.stackexchange.com/questions/46250", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/26558/" ]
I totally agree with Uri and have some further comments: > > the class has no idea what the set will contain, it does however know there maybe a IDescriptor that is meant for video.. > > > I'm sorry, but I have to ask: If you're not sure about exactly what the Set contains, why are you storing it in a set in the first place? Consider instead something like `Map<KEY_TYPE, List<? extends IDescriptor>> descriptors;` where `KEY_TYPE` can be a `Class<? extends IDescriptor>`, a `String`, or something else that can tell you what type it is. When adding items to this map you could use: ``` List<? extends IDescriptor> list = descriptors.get(descriptor.getClass()); if (list == null) { list = new ArrayList<>(); descriptors.put(descriptor.getClass(), list); } list.add(descriptor); ``` And then all you would need to do is to use `descriptors.get(VideoDescriptor.class)` (assuming `VideoDescriptor` is not subclassed, otherwise you could loop through the supertypes as well when adding to the list). --- Another thought is that you can use a `enum` to describe what kind of `IDescriptor` it is, and the `IDescriptor` type can have a `getDescriptorType` method. Then you could check `if (fragmentDescriptor.getDescriptorType() == DescriptorType.VIDEO)` As I only see a portion of your code and not the big picture, I can't really tell what would be best for you.
Are you asking if you can find the first element in a list of a certain type without asking for its type? That's a strange question... What's wrong with `instanceof`? As for the code, being code-review, I've got some observations: This code actually finds the *last* instance of type `VideoDescriptor` in `mDescriptor`. It is also very inefficient, since it iterates over the collection **at least three times** to find it * It wrap it in an `ArrayList`, * It finds *all* items of the right type (no stop condition here - so it iterates over the whole array) * For each item of the correct type, it iterates over the array *again* using `indexOf` (perhaps you are asking about `indexOf` and not `instanceOf`?) A better way would be to simply iterate once over the collection, keeping the current position, returning upon reaching the correct type: ``` private int getPosition() { int position = -1; for (IDescriptor fragmentDescriptor : mDesciptors) { position++; if (fragmentDescriptor instanceof VideoDescriptor) { return position; } } return -1; } ``` if the collection has random access, you can use a classic `for` loop: ``` private int getPosition() { for (int i = 0; i < mDescriptors.size(); i++) { if (mDescriptors.get(i) instanceof VideoDescriptor) { return i; } } return -1; } ```
30,336,337
I'm a bit confused about the different between **Events** and **Listeners**. I understood how you can create your events under `Events` then register them and implement the Handlers in `Handlers\Events`. So here I have events and the handling of events. They work after I define them in `Providers\EventServiceProvider.php` ``` protected $listen = [ UserHasSignedUp::class => [ SendWelcomeEmail::class, SendAdminEmail::class ] ]; ``` So what are **Listeners**? To me they seem exactly the same thing as **Event Handlers**?
2015/05/19
[ "https://Stackoverflow.com/questions/30336337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/391986/" ]
In your example `UserHasSignedUp` is an `Event`. `SendWelcomeEmail` and `SendAdminEmail` are two listeners "waiting" for the event UserHasSignedUp to be fired and they should implement the required business logic at `handle` method of each one. Super simple example: Somewhere in UserController ``` Event::fire(new UserHasSignedUp($user)); //UserHasSignedUp is the event being fired ``` SendWelcomeEmail class ``` class SendWelcomeEmail //this is the listener class { public function handle(UserHasSignedUp $event) //this is the "handler method" { //send an email } } ``` As you can see, each event can have multiple listeners, but a listener can't listen to more than a single event. If you want a class listening to many events, you should take a look to [Event Subscribers](http://laravel.com/docs/5.0/events#event-subscribers) Hope it helps.
There's not too much information on this out there, so this might just be speculation. I took a look at [this video](https://www.youtube.com/watch?v=WNYb1r4eMio) and saw that you can use handlers with commands. I think if you're using commands, that makes sense to have all your handlers in one spot. However if you're not, then having a `App\Handlers\Events\Whatever` might not be as desirable as `App\Listeners\Whatever`.
30,336,337
I'm a bit confused about the different between **Events** and **Listeners**. I understood how you can create your events under `Events` then register them and implement the Handlers in `Handlers\Events`. So here I have events and the handling of events. They work after I define them in `Providers\EventServiceProvider.php` ``` protected $listen = [ UserHasSignedUp::class => [ SendWelcomeEmail::class, SendAdminEmail::class ] ]; ``` So what are **Listeners**? To me they seem exactly the same thing as **Event Handlers**?
2015/05/19
[ "https://Stackoverflow.com/questions/30336337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/391986/" ]
In your example `UserHasSignedUp` is an `Event`. `SendWelcomeEmail` and `SendAdminEmail` are two listeners "waiting" for the event UserHasSignedUp to be fired and they should implement the required business logic at `handle` method of each one. Super simple example: Somewhere in UserController ``` Event::fire(new UserHasSignedUp($user)); //UserHasSignedUp is the event being fired ``` SendWelcomeEmail class ``` class SendWelcomeEmail //this is the listener class { public function handle(UserHasSignedUp $event) //this is the "handler method" { //send an email } } ``` As you can see, each event can have multiple listeners, but a listener can't listen to more than a single event. If you want a class listening to many events, you should take a look to [Event Subscribers](http://laravel.com/docs/5.0/events#event-subscribers) Hope it helps.
Listeners vs. Handlers : A listener `listen` for a specific event to be fired. xxxxCreatedListener will only listen for xxxx A handler can handle multiple events to be fired. For exemple, let's say you use performing CRUD operations, your handler could wait for the xxxxCreatedEvent, xxxxDeletedEvent, xxxxUpdatedEvent.
30,336,337
I'm a bit confused about the different between **Events** and **Listeners**. I understood how you can create your events under `Events` then register them and implement the Handlers in `Handlers\Events`. So here I have events and the handling of events. They work after I define them in `Providers\EventServiceProvider.php` ``` protected $listen = [ UserHasSignedUp::class => [ SendWelcomeEmail::class, SendAdminEmail::class ] ]; ``` So what are **Listeners**? To me they seem exactly the same thing as **Event Handlers**?
2015/05/19
[ "https://Stackoverflow.com/questions/30336337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/391986/" ]
In your example `UserHasSignedUp` is an `Event`. `SendWelcomeEmail` and `SendAdminEmail` are two listeners "waiting" for the event UserHasSignedUp to be fired and they should implement the required business logic at `handle` method of each one. Super simple example: Somewhere in UserController ``` Event::fire(new UserHasSignedUp($user)); //UserHasSignedUp is the event being fired ``` SendWelcomeEmail class ``` class SendWelcomeEmail //this is the listener class { public function handle(UserHasSignedUp $event) //this is the "handler method" { //send an email } } ``` As you can see, each event can have multiple listeners, but a listener can't listen to more than a single event. If you want a class listening to many events, you should take a look to [Event Subscribers](http://laravel.com/docs/5.0/events#event-subscribers) Hope it helps.
The only difference between them seems to be is, `handler:event` is from Laravel 5.0's folder structure, and `make:listener` is the **new & current** folder structure. **Functionally, they are the same**! - [Upgrade Guide to Laravel 5.1](https://laravel.com/docs/5.1/upgrade#upgrade-5.1.0) > > **Commands & Handlers** > > > The app/Commands directory has been renamed to > app/Jobs. However, you are not required to move all of your commands > to the new location, and you may continue using the make:command and > handler:command Artisan commands to generate your classes. > > > Likewise, ***the app/Handlers directory has been renamed to app/Listeners*** > and now only contains event listeners. However, you are not required > to move or rename your existing command and event handlers, and you > may continue to use the handler:event command to generate event > handlers. > > > By providing backwards compatibility for the Laravel 5.0 folder > structure, you may upgrade your applications to Laravel 5.1 and slowly > upgrade your events and commands to their new locations when it is > convenient for you or your team. > > > It's just the backward compatibility provided in Laravel 5.1. In other words, earlier, Jobs/Commands/Listeners were **not self-handling**, now **they are**. **Note that**, `handler:event` is not available **after Laravel 5.1**.