qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
13,301,936 | I have a website (madmonkeygunboats.com) and I am trying to fix a small problem where the page width is wider than the content.
If you go to the website and hold middle mouse button + move the mouse around, the toolbar and logo slide to the left and right.
I am really new to website development, and I was wondering ... | 2012/11/09 | [
"https://Stackoverflow.com/questions/13301936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1811157/"
] | Try this way
1st [Download that project file](https://github.com/SimonVT/android-numberpicker/archive/master.zip)
2nd Open the archive and you will see one folder with name **android-numberpicker-master** extract it to your hard driver
3rd In eclipse goto File -> Import and under Android tab select **Existing Code into... | The resources object (R.java) isn't being generated because of an error. Your `targetSdkVersion` should be set to at least 15 in your manifest, and you should also have `theme.xml` from the library's `res/values` folder copied to the same location in your own project. |
13,301,936 | I have a website (madmonkeygunboats.com) and I am trying to fix a small problem where the page width is wider than the content.
If you go to the website and hold middle mouse button + move the mouse around, the toolbar and logo slide to the left and right.
I am really new to website development, and I was wondering ... | 2012/11/09 | [
"https://Stackoverflow.com/questions/13301936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1811157/"
] | Try this way
1st [Download that project file](https://github.com/SimonVT/android-numberpicker/archive/master.zip)
2nd Open the archive and you will see one folder with name **android-numberpicker-master** extract it to your hard driver
3rd In eclipse goto File -> Import and under Android tab select **Existing Code into... | First check out the sample application provided by the developer.
1. Right Click in your package explorer. Select Import. Select "Import existing Android Code into Workspace".
2. Browse to samples directory and import.
3. Similarly import Library and make it is marked as Library and other project is referencing it cor... |
46,994,266 | In Matlab, one can evaluate an arbitrary string as code using the `eval` function. E.g.
```
s = '{1, 2, ''hello''}' % char
c = eval(s) % cell
```
Is there any way to do the inverse operation; getting the literal string representation of an arbitrary variable? That is, recover `s` from `c`?
Something l... | 2017/10/28 | [
"https://Stackoverflow.com/questions/46994266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4056181/"
] | The closest there is in Matlab is [`mat2str`](https://es.mathworks.com/help/matlab/ref/mat2str.html), which works for **numeric, character or logical 2D arrays** (including vectors). (It doesn't work for ND arrays, cell arrays, struct arrays, or tables).
Examples:
```
>> a = [1 2; 3 4]; ar = mat2str(a), isequal(eval(... | OK, I see your pain.
My advice would still be to provide a function of the sort of `toString` leveraging on `fprintf`, `sprint`, and friends, but I understand that it may be tedious if you do not know the type of the data and also requires several subcases.
For a quick fix you can use [`evalc`](https://uk.mathworks.... |
46,994,266 | In Matlab, one can evaluate an arbitrary string as code using the `eval` function. E.g.
```
s = '{1, 2, ''hello''}' % char
c = eval(s) % cell
```
Is there any way to do the inverse operation; getting the literal string representation of an arbitrary variable? That is, recover `s` from `c`?
Something l... | 2017/10/28 | [
"https://Stackoverflow.com/questions/46994266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4056181/"
] | Depending on exactly why you want to do this, your use case may be resolved with matlab.io.saveVariablesToScript
[Here](https://www.mathworks.com/help/matlab/ref/matlab.io.savevariablestoscript.html) is the doc for it.
Hope that helps! | OK, I see your pain.
My advice would still be to provide a function of the sort of `toString` leveraging on `fprintf`, `sprint`, and friends, but I understand that it may be tedious if you do not know the type of the data and also requires several subcases.
For a quick fix you can use [`evalc`](https://uk.mathworks.... |
42,048 | I was surprised to learn (in the background for the recent
[protests](https://en.wikipedia.org/wiki/2019_Hong_Kong_anti-extradition_bill_protests)) that a Hong Kong resident can murder someone in Taiwan
and go back to Hong Kong with no consequences
(by the way, the murderer is actually imprisoned now in Hong Kong for a... | 2019/06/13 | [
"https://law.stackexchange.com/questions/42048",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/13139/"
] | The default is that countries are not required to repatriate alleged criminals
------------------------------------------------------------------------------
It is one of the cardinal provisions of sovereignty that one country cannot "reach into" another country's territory for any reason. However, countries can *volu... | That case with Hong Kong and Taiwan is extremely specific to the relationship among China, Hong Kong and Taiwan.
And neither Hong Kong nor Taiwan really is free to act as a full country on the world stage. Hong Kong is a "special region" of China, desperate to hold on to what remains of their independent legal system;... |
17,064,796 | I have a database table in which i am saving created users along with username now what i want to get string value from my database if username exists in database and then i will show error message "UserName Exists or Choose new one etc etc"
here is my stored procedure
```
ALTER PROCEDURE [dbo].[p_SaveUpdate_AdminUse... | 2013/06/12 | [
"https://Stackoverflow.com/questions/17064796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2189385/"
] | Your stored procedure returns -1 if username exists so i suggest you to return int rather than string in your Data Access Layer.
here is some modifications in your code
```
public int SaveAdminUserAccountInformation(AdminAccountProperties oAdminUser)
{
try
{
SqlParamete... | Instead Selecting the New row in Stored Procedure. Use an OUT Parameter of the Stored Procedure. Like the Code Below :
```
try
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "USP_IUD_FAC_SUBJECT";
cmd.Parameters.AddWithVal... |
17,064,796 | I have a database table in which i am saving created users along with username now what i want to get string value from my database if username exists in database and then i will show error message "UserName Exists or Choose new one etc etc"
here is my stored procedure
```
ALTER PROCEDURE [dbo].[p_SaveUpdate_AdminUse... | 2013/06/12 | [
"https://Stackoverflow.com/questions/17064796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2189385/"
] | Your stored procedure returns -1 if username exists so i suggest you to return int rather than string in your Data Access Layer.
here is some modifications in your code
```
public int SaveAdminUserAccountInformation(AdminAccountProperties oAdminUser)
{
try
{
SqlParamete... | SQL
---
```
ALTER PROCEDURE [dbo].[p_SaveUpdate_AdminUserAccount]
@Id_User int,
@nm_UserName varchar(50),
@nm_UserPassword varchar(50),
@nm_UserRole int,
@id int OUTPUT
AS
```
C#
--
```
SqlConnection db = DataConn.SqlConnection();
SqlCommand sqlComm = new SqlCommand(
"p_SaveUpdate... |
108,734 | The משנה in בבא קמא ([9:4](https://www.sefaria.org/Mishnah_Bava_Kamma.9?lang=bi&p2=Bartenura_on_Mishnah_Bava_Kamma.9.4&lang2=bi), as explained by the רע״ב and קהתי) says that if I give wool to a dyer to dye red, and he dyes it black instead, then he must return the black wool to me, and I must pay him whichever of the... | 2019/10/02 | [
"https://judaism.stackexchange.com/questions/108734",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/170/"
] | I understand that this Halacha reflects the economic realities of the Mishna, where pretty much everyone was producing small handicraft and traded them. It could reasonably be assumed that you could sell the black wool as easily as raw wool or red wool, so it has a definite increase in value. While you may not have any... | *This seems to my lowly intellect as totally unreasonable: I, the owner of the wool, now must find a buyer for black wool! Who knows when I ever will?*
The Mishna before this already discusses that if a craftsman causes irrevocable damage then he has to pay for the damages. Here the Mishna is discussing something that... |
34,555,420 | I have websites folders in my **/home directory** of **centos 7**. i want to copy robot.txt and favicon.ico file in all websites directories.
Websites directory structure are as following:
```
/home/domain.com/public_html
/home/domain2.com/public_html
```
I want command which copy robot.txt and favicon in all websi... | 2016/01/01 | [
"https://Stackoverflow.com/questions/34555420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5735734/"
] | You can use `find` too.
```
find /home -type d -name public_html -exec cp /root/robots.txt /root/favicon.ico {} \;
``` | Just use a simple `for` loop that processes each directory.
```
for dest in /home/domain*.com/public_html
do
cp /root/robots.txt /root/favicon.ico $dest
done
``` |
494,562 | How can I send a file attachment from Windows 8 mail? I don't see any button anywhere. | 2012/10/28 | [
"https://superuser.com/questions/494562",
"https://superuser.com",
"https://superuser.com/users/39616/"
] | Right-click anywhere on the screen to bring up the [**App Bar**](https://web.archive.org/web/20160304103641/http://blogs.msdn.com/b/windowsappdev/archive/2012/09/06/embracing-ui-on-demand-with-the-app-bar.aspx).
You will then see an `Attachments` button in the lower-left corner.

You can also use the Windows 8 Share Charm to share Content as Email Attachments. To do so, while using a Modern UI app (not all apps support Sharing though!)
1... |
16,396,767 | I've tried to run my tests with Selenium 2 and Firefox 19. One of this tests causes an error "ERROR: Command execution failure. The error message is: can't access dead object".
I'm reading about it, it seems like a bug in newest Firefox's versions. Lot of people have the same issue, but I've not found anything really ... | 2013/05/06 | [
"https://Stackoverflow.com/questions/16396767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1728678/"
] | I was desperate about the same Problem and didn't find any solution although many people seemed to have the same problem.
I solved it by calling
```
webDriver.switchTo().defaultContent();
```
before calling any findElement method
(using Java) | I finally made a "cheat" to the browser.
I got the fail when Selenium clicked on a link and try to open the new page. What I've made is just simulate the click, doing a selenium.open("URL") which replace selenium.click("link=ButtonWhichOpenTheURL").
It seems to work by the moment |
16,396,767 | I've tried to run my tests with Selenium 2 and Firefox 19. One of this tests causes an error "ERROR: Command execution failure. The error message is: can't access dead object".
I'm reading about it, it seems like a bug in newest Firefox's versions. Lot of people have the same issue, but I've not found anything really ... | 2013/05/06 | [
"https://Stackoverflow.com/questions/16396767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1728678/"
] | This error generally comes when you do no switch back from frame and trying to access web elements directly.
Use `driver.switchTo().defaultContent();` and then try to access the elements | I finally made a "cheat" to the browser.
I got the fail when Selenium clicked on a link and try to open the new page. What I've made is just simulate the click, doing a selenium.open("URL") which replace selenium.click("link=ButtonWhichOpenTheURL").
It seems to work by the moment |
16,396,767 | I've tried to run my tests with Selenium 2 and Firefox 19. One of this tests causes an error "ERROR: Command execution failure. The error message is: can't access dead object".
I'm reading about it, it seems like a bug in newest Firefox's versions. Lot of people have the same issue, but I've not found anything really ... | 2013/05/06 | [
"https://Stackoverflow.com/questions/16396767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1728678/"
] | I was desperate about the same Problem and didn't find any solution although many people seemed to have the same problem.
I solved it by calling
```
webDriver.switchTo().defaultContent();
```
before calling any findElement method
(using Java) | I am facing the same error on Firefox 23 while reopening a pop up browser window. The only workaround I did is closing the current selenium session and relaunching it again. It worked fine for me. |
16,396,767 | I've tried to run my tests with Selenium 2 and Firefox 19. One of this tests causes an error "ERROR: Command execution failure. The error message is: can't access dead object".
I'm reading about it, it seems like a bug in newest Firefox's versions. Lot of people have the same issue, but I've not found anything really ... | 2013/05/06 | [
"https://Stackoverflow.com/questions/16396767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1728678/"
] | This error generally comes when you do no switch back from frame and trying to access web elements directly.
Use `driver.switchTo().defaultContent();` and then try to access the elements | I am facing the same error on Firefox 23 while reopening a pop up browser window. The only workaround I did is closing the current selenium session and relaunching it again. It worked fine for me. |
16,396,767 | I've tried to run my tests with Selenium 2 and Firefox 19. One of this tests causes an error "ERROR: Command execution failure. The error message is: can't access dead object".
I'm reading about it, it seems like a bug in newest Firefox's versions. Lot of people have the same issue, but I've not found anything really ... | 2013/05/06 | [
"https://Stackoverflow.com/questions/16396767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1728678/"
] | I was desperate about the same Problem and didn't find any solution although many people seemed to have the same problem.
I solved it by calling
```
webDriver.switchTo().defaultContent();
```
before calling any findElement method
(using Java) | This error generally comes when you do no switch back from frame and trying to access web elements directly.
Use `driver.switchTo().defaultContent();` and then try to access the elements |
32,708,102 | In my html I have included my directive like this.
```
<login ng-show="!authService.authenticated"></login>
```
**Directive**
```
angular.module('XXXXX').directive("login", function () {
return {
restrict: "E",
scope: {
authenticated: '='
},
transclude: true,
... | 2015/09/22 | [
"https://Stackoverflow.com/questions/32708102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1822859/"
] | Here is a scenario where I check for empty attribute and assign value before saving. Note [owner](http://www.yiiframework.com/doc-2.0/yii-base-behavior.html#$owner-detail) returns the Model so that you can access model attributes and functions that are public. Let me know if I can explain anything further
```
public f... | You could simply use a getter/setter, e.g. :
```
public function getRealPrice()
{
return $this->price/100;
}
public function setRealPrice($value)
{
$this->price = $value*100;
}
```
And don't forget to :
* add `realPrice` in your model's rules,
* use `realPrice` in your form (instead of `price`). |
56,285,425 | Cant Run SUM this code not working on table How To FIX ?
PHP MYSQL, JAVASCRIPT
```
<td contenteditable="true" class="price"> </td>
<td contenteditable="true" class="price"> </td>
<td contenteditable="true" class="price"> </td>
<td contenteditable="true" class="price"> </td>
<td contenteditable="true" class="price"> <... | 2019/05/24 | [
"https://Stackoverflow.com/questions/56285425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11547703/"
] | setTimeout queues your request to be handled at the first opportunity after the specified delay. Once the delay has elapsed *and the call stack is empty* your request is handled. This means there can be slight variations in the timing depending on what else the browser’s engine has going on. | The difference arises because of code differences between the two browsers.
1. If you reverse the order of starting the interval and timeout timers, Chrome behaves the same as Firefox:
```js
"use strict";
var start = Date.now()
setTimeout(function timeout() { // start the timeout first
clearInterval(id)
... |
56,285,425 | Cant Run SUM this code not working on table How To FIX ?
PHP MYSQL, JAVASCRIPT
```
<td contenteditable="true" class="price"> </td>
<td contenteditable="true" class="price"> </td>
<td contenteditable="true" class="price"> </td>
<td contenteditable="true" class="price"> </td>
<td contenteditable="true" class="price"> <... | 2019/05/24 | [
"https://Stackoverflow.com/questions/56285425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11547703/"
] | That's because [Chrome's implementation of `setInterval`](https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/Timer.cpp?rcl=e6d900fb6ed08dbd3a048899f38962ee75f4d8d0&l=162) does correct the drift between each call.
So instead of blindly calling again `setTimeout(fn, 250)` at the end of the interval'... | The difference arises because of code differences between the two browsers.
1. If you reverse the order of starting the interval and timeout timers, Chrome behaves the same as Firefox:
```js
"use strict";
var start = Date.now()
setTimeout(function timeout() { // start the timeout first
clearInterval(id)
... |
22,764,445 | first, I hope I provide enough information to make things clear, if not please ask for more.
I have a working WCF communication using Duplex Channel and OneWay method calls. The ServiceHost is located inside a managed WPF application using NetPipeBinding, the client lives in a AppDomain inside that application. Everyt... | 2014/03/31 | [
"https://Stackoverflow.com/questions/22764445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3481346/"
] | If this is a completely internal service, you can switch to using the `NetDataContractSerializer`, which solves this problem by including full type and assembly information (**note** this serializer completely breaks interoperability and contract versioning - so never use it for externally-exposed services). No `KnownT... | I also failed in using unknown types so I went the ugly path: for types unknown at compile time I serialize them manually and transfer the byte stream via WCF.
Edit: After looking into the DataContractResolver, it looks pretty much the same:
<http://msdn.microsoft.com/de-de/library/dd807504(v=vs.110).aspx> |
4,861,399 | I'm very new to url redirect so I'm probably going to ask something very dumb. Sorry in advance, I rather ask you than put myself in a ridiculous situation at school ;)
I'm accesing my web using this url:
<http://subdomain.myserver.com/folder/index.php>
Now I've been asked the following:
if a user writes in the a... | 2011/02/01 | [
"https://Stackoverflow.com/questions/4861399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541684/"
] | Hey if you just redirect to the other page it will show the URL which you redirect to. You simply need to add an DNS record to the domain with the IP of the subdomain.myserver.com/folder/index.php server.
Hope this helps :) | You can do this using frame based forwarding, which some hosting providers will offer. If not, create a single index.html in the whatever.com host as follows (edit src url).
```
<html>
<head><title>Insert Title Here</title></head>
<frameset rows="0" frameborder="NO" border="0" framespacing="0">
<frame name="mainfram... |
4,861,399 | I'm very new to url redirect so I'm probably going to ask something very dumb. Sorry in advance, I rather ask you than put myself in a ridiculous situation at school ;)
I'm accesing my web using this url:
<http://subdomain.myserver.com/folder/index.php>
Now I've been asked the following:
if a user writes in the a... | 2011/02/01 | [
"https://Stackoverflow.com/questions/4861399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541684/"
] | Hey if you just redirect to the other page it will show the URL which you redirect to. You simply need to add an DNS record to the domain with the IP of the subdomain.myserver.com/folder/index.php server.
Hope this helps :) | You need to change your server to route requests for www.whatever.com to the right website (I'm assuming from your use of sub-domains the server is hosting more than one website)
Then you need to change the DNS of www.whatever.com to point to your server.
Exactly how you do this depends on the systems you are using. |
4,861,399 | I'm very new to url redirect so I'm probably going to ask something very dumb. Sorry in advance, I rather ask you than put myself in a ridiculous situation at school ;)
I'm accesing my web using this url:
<http://subdomain.myserver.com/folder/index.php>
Now I've been asked the following:
if a user writes in the a... | 2011/02/01 | [
"https://Stackoverflow.com/questions/4861399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541684/"
] | You can do this using frame based forwarding, which some hosting providers will offer. If not, create a single index.html in the whatever.com host as follows (edit src url).
```
<html>
<head><title>Insert Title Here</title></head>
<frameset rows="0" frameborder="NO" border="0" framespacing="0">
<frame name="mainfram... | You need to change your server to route requests for www.whatever.com to the right website (I'm assuming from your use of sub-domains the server is hosting more than one website)
Then you need to change the DNS of www.whatever.com to point to your server.
Exactly how you do this depends on the systems you are using. |
60,394 | Any ideas? How can I tell fedora to use 700GB, and do I have reformat to do this?
```
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_computer-lv_root
124G 3.9G 114G 4% /
/dev/sda1 194M 23M 162M 12% /boot
tmpfs 995M 320K 994M 1% /dev/s... | 2009/08/29 | [
"https://serverfault.com/questions/60394",
"https://serverfault.com",
"https://serverfault.com/users/3260/"
] | Your disk is a Dynamically expanding disk right?
There is a limit of 127G for this type of disk. More details [here](http://www.virtualizationadmin.com/articles-tutorials/general-virtualization-articles/chapter-2-hyper-v-overview.html) | Hyper V 2008 R2 addresses this issue to use 48-bit LBA making max size of hard drive 2 TB. Unfortunately some Linux distro's are not seeing it. The Linux Integrated Components may help but I am not sure. I am interested in proceeding in the direction you have by using LVM with a bunch of drives (maybe even using the SC... |
47,156,877 | I have just now started learning Higher Order Function in Scala, I cannot understand how the output is coming over here, where according to the Documentation <https://docs.scala-lang.org/tour/higher-order-functions.html> Higher order function is a function that either takes a function as argument or returns a function.... | 2017/11/07 | [
"https://Stackoverflow.com/questions/47156877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8641022/"
] | To understand the above code flow, lets move step by step with each method.
It is like you have defined functions, where functionExample is a higher order function as it accepts a function as an argument.
```
scala> def functionExample(a:Int, f:Int=>Any):Unit = //Line 3
| {
| println(f(a)) ... | The result is normal,
First your a=25, then you apply f(a) in `println(f(a))`, so you print 25 and then you return a\*2 = 50. then you `println(f(a))` ie 50, and finaly you print a = 25 with has never changed because when you call multiplyBy2, It do not change the value of the parameter.
For the second question, It i... |
47,156,877 | I have just now started learning Higher Order Function in Scala, I cannot understand how the output is coming over here, where according to the Documentation <https://docs.scala-lang.org/tour/higher-order-functions.html> Higher order function is a function that either takes a function as argument or returns a function.... | 2017/11/07 | [
"https://Stackoverflow.com/questions/47156877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8641022/"
] | The result is normal,
First your a=25, then you apply f(a) in `println(f(a))`, so you print 25 and then you return a\*2 = 50. then you `println(f(a))` ie 50, and finaly you print a = 25 with has never changed because when you call multiplyBy2, It do not change the value of the parameter.
For the second question, It i... | You can substitute a function with its implementation to reason about it:
Step 1:
```
object HigherOrderFunction
{
def main(args: Array[String]):Unit =
{
println(multiplyBy2(25)) //Line 1
println(25) //Line 2
}
def multiplyBy2(b:Int):Int =
... |
47,156,877 | I have just now started learning Higher Order Function in Scala, I cannot understand how the output is coming over here, where according to the Documentation <https://docs.scala-lang.org/tour/higher-order-functions.html> Higher order function is a function that either takes a function as argument or returns a function.... | 2017/11/07 | [
"https://Stackoverflow.com/questions/47156877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8641022/"
] | Here You Will get some steps to follow. It will be easy to get out from your confusion.
Steps in the Comment Lines
```
package function
object HigherOrderFunction
{
def main(args: Array[String]):Unit =
{
functionExample(25, multiplyBy2) // Passing a function as parameter
}
def functi... | The result is normal,
First your a=25, then you apply f(a) in `println(f(a))`, so you print 25 and then you return a\*2 = 50. then you `println(f(a))` ie 50, and finaly you print a = 25 with has never changed because when you call multiplyBy2, It do not change the value of the parameter.
For the second question, It i... |
47,156,877 | I have just now started learning Higher Order Function in Scala, I cannot understand how the output is coming over here, where according to the Documentation <https://docs.scala-lang.org/tour/higher-order-functions.html> Higher order function is a function that either takes a function as argument or returns a function.... | 2017/11/07 | [
"https://Stackoverflow.com/questions/47156877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8641022/"
] | To understand the above code flow, lets move step by step with each method.
It is like you have defined functions, where functionExample is a higher order function as it accepts a function as an argument.
```
scala> def functionExample(a:Int, f:Int=>Any):Unit = //Line 3
| {
| println(f(a)) ... | You can substitute a function with its implementation to reason about it:
Step 1:
```
object HigherOrderFunction
{
def main(args: Array[String]):Unit =
{
println(multiplyBy2(25)) //Line 1
println(25) //Line 2
}
def multiplyBy2(b:Int):Int =
... |
47,156,877 | I have just now started learning Higher Order Function in Scala, I cannot understand how the output is coming over here, where according to the Documentation <https://docs.scala-lang.org/tour/higher-order-functions.html> Higher order function is a function that either takes a function as argument or returns a function.... | 2017/11/07 | [
"https://Stackoverflow.com/questions/47156877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8641022/"
] | Here You Will get some steps to follow. It will be easy to get out from your confusion.
Steps in the Comment Lines
```
package function
object HigherOrderFunction
{
def main(args: Array[String]):Unit =
{
functionExample(25, multiplyBy2) // Passing a function as parameter
}
def functi... | To understand the above code flow, lets move step by step with each method.
It is like you have defined functions, where functionExample is a higher order function as it accepts a function as an argument.
```
scala> def functionExample(a:Int, f:Int=>Any):Unit = //Line 3
| {
| println(f(a)) ... |
47,156,877 | I have just now started learning Higher Order Function in Scala, I cannot understand how the output is coming over here, where according to the Documentation <https://docs.scala-lang.org/tour/higher-order-functions.html> Higher order function is a function that either takes a function as argument or returns a function.... | 2017/11/07 | [
"https://Stackoverflow.com/questions/47156877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8641022/"
] | Here You Will get some steps to follow. It will be easy to get out from your confusion.
Steps in the Comment Lines
```
package function
object HigherOrderFunction
{
def main(args: Array[String]):Unit =
{
functionExample(25, multiplyBy2) // Passing a function as parameter
}
def functi... | You can substitute a function with its implementation to reason about it:
Step 1:
```
object HigherOrderFunction
{
def main(args: Array[String]):Unit =
{
println(multiplyBy2(25)) //Line 1
println(25) //Line 2
}
def multiplyBy2(b:Int):Int =
... |
16,056,065 | We are trying to access Google Maps over HTTPS.
We modified the script on the JSP to
```
script src="https://maps.googleapis.com/maps/api/js?client=<xxxx>&sensor=false" type="text/javascript"
```
This seems to work properly in Chrome and IE8. But in Firefox(V 19.0.2 and 11), there are some issues.
Specifically, ... | 2013/04/17 | [
"https://Stackoverflow.com/questions/16056065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2289898/"
] | Damn.. Its an issue with my company's internet proxy!! I had to add an exception to all the URLs used by my application(including google map apis) and it works fine. | Add all urls of google map api over https in Location input bar for certificate exceptions.
for example:
<https://maps.googleapis.com>
<https://maps.gstatic.com>
'Get Certificate' then 'Confirm Security Exception'
Tools > Advanced > Certificates > View Certificates > 'Servers' Tab > 'Add Exception...' |
33,878,433 | What are the common practices to write Avro files with Spark (using Scala API) in a flow like this:
1. parse some logs files from HDFS
2. for each log file apply some business logic and generate Avro file (or maybe merge multiple files)
3. write Avro files to HDFS
I tried to use spark-avro, but it doesn't help much.
... | 2015/11/23 | [
"https://Stackoverflow.com/questions/33878433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/200305/"
] | Databricks provided library spark-avro, which helps us in reading and writing Avro data.
```
dataframe.write.format("com.databricks.spark.avro").save(outputPath)
``` | You need to start spark shell to include avro package..recommended for lower versions
>
> $SPARK\_HOME/bin/spark-shell --packages com.databricks:spark-avro\_2.11:4.0.0
>
>
>
Then use to df to write as avro file-
```
dataframe.write.format("com.databricks.spark.avro").save(outputPath)
```
And write as avro tabl... |
33,878,433 | What are the common practices to write Avro files with Spark (using Scala API) in a flow like this:
1. parse some logs files from HDFS
2. for each log file apply some business logic and generate Avro file (or maybe merge multiple files)
3. write Avro files to HDFS
I tried to use spark-avro, but it doesn't help much.
... | 2015/11/23 | [
"https://Stackoverflow.com/questions/33878433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/200305/"
] | Databricks provided library spark-avro, which helps us in reading and writing Avro data.
```
dataframe.write.format("com.databricks.spark.avro").save(outputPath)
``` | **Spark 2 and Scala 2.11**
```
import com.databricks.spark.avro._
import org.apache.spark.sql.SparkSession
val spark = SparkSession.builder().master("local").getOrCreate()
// Do all your operations and save it on your Dataframe say (dataFrame)
dataFrame.write.avro("/tmp/output")
```
**Maven dependency**
```
<dep... |
2,623,405 | Let $ \ \Bbb R[x]\_{<4} \ $ denote the space of polynomials in $ \ \Bbb R \ $ of degree less or equal to $ \ 3 \ $.
Can we find a basis $ \ \{p\_1, \ p\_2, \ p\_3 , \ p\_4 \} \ $ of $ \ \Bbb R[x]\_{<4} \ $ such that none of $ \ p\_i \ $ has degree $ \ 1 \ $.
**Answer:**
Since $ \ \Bbb R[x]\_{<4} \ $ denote the space... | 2018/01/27 | [
"https://math.stackexchange.com/questions/2623405",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/417353/"
] | Sure. For instance, just add $x^3$ to each element of the standard basis: $$\{1+x^3,x+x^3,x^2+x^3,2x^3\}.$$ | You may consider the following basis
$$\{1, x+x^2, x^2, x^3\}$$
Any element has degree different than one. Of course you may obtain $x$ as $(x+x^2)-x^2$. |
11,793,594 | I need to click on a document to call some function, but the problem is that when I click on some element that want it doesnt react, so the code:
```
<body>
<div class="some_element">
some element
</div>
</body>
```
and js:
```
$(document).click(function(){
//something to happen
})
```
and now if I click o... | 2012/08/03 | [
"https://Stackoverflow.com/questions/11793594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1490601/"
] | All this `stopPropagation` stuff is right, though this'll cause your script to throw errors on older versions of a certain browser. Guess which one? a cross-browser way:
```
$('#elem').click(function(e)
{
e = e || window.event;//IE doesn't pass the event object as standard to the handler
//event would normally... | One way to do it is to check for the `event`'s `target`.
```
$('html').click(function(event){
if (event.target != this){
}else{
//do stuff
}
});
```
Here's a working [fiddle](http://jsfiddle.net/ZamqE/2/) |
11,793,594 | I need to click on a document to call some function, but the problem is that when I click on some element that want it doesnt react, so the code:
```
<body>
<div class="some_element">
some element
</div>
</body>
```
and js:
```
$(document).click(function(){
//something to happen
})
```
and now if I click o... | 2012/08/03 | [
"https://Stackoverflow.com/questions/11793594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1490601/"
] | One way to do it is to check for the `event`'s `target`.
```
$('html').click(function(event){
if (event.target != this){
}else{
//do stuff
}
});
```
Here's a working [fiddle](http://jsfiddle.net/ZamqE/2/) | Elements on the document are part of the document, so if you click "some\_element" in the document, it is obvious that event registered on document will be fired/triggered. If you dont want to execute code which was for "document" then first get the element OR "event source" which originates this event, and check if it... |
11,793,594 | I need to click on a document to call some function, but the problem is that when I click on some element that want it doesnt react, so the code:
```
<body>
<div class="some_element">
some element
</div>
</body>
```
and js:
```
$(document).click(function(){
//something to happen
})
```
and now if I click o... | 2012/08/03 | [
"https://Stackoverflow.com/questions/11793594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1490601/"
] | All this `stopPropagation` stuff is right, though this'll cause your script to throw errors on older versions of a certain browser. Guess which one? a cross-browser way:
```
$('#elem').click(function(e)
{
e = e || window.event;//IE doesn't pass the event object as standard to the handler
//event would normally... | Elements on the document are part of the document, so if you click "some\_element" in the document, it is obvious that event registered on document will be fired/triggered. If you dont want to execute code which was for "document" then first get the element OR "event source" which originates this event, and check if it... |
7,158,427 | I am not quite sure how to write this query of it it can be done in one query.
Here is the case:
I need to select a list of tag names and for each tag get the most recently tagged albums information. Meaning that if a user creates an album called "Pamela Anderson" and tags that album as "Blondes" then that album is ... | 2011/08/23 | [
"https://Stackoverflow.com/questions/7158427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/453495/"
] | ```
SELECT t.tagId, t.tagName, o.objectTagCreateDate, a.albumName, a.albumPath
FROM ObjectTag AS o
INNER JOIN (
SELECT tagId, MAX(objectTagCreateDate) As MaxDate
FROM ObjectTag
WHERE ObjectTag.objectType = 3
GROUP BY tagId
) AS t1
ON t1.tagId = o.tagId AND t1.... | Something like this should do it but I haven´t tested it myself;
```
SELECT T.tagId, T.tagName, MAX(OT.objectTagCreateDate) AS LatestObjectTagCreateDate, A.albumName, A.albumPath
FROM ObjectTag OT
JOIN Tag T ON (T.tagId = OT.tagId)
JOIN Album A ON (A.albumId = OT.objectId AND OT.objectType = 3)
GROUP BY T.tagId
ORDER ... |
65,737,296 | Hi I am trying to create a scatterplot where each X,Y variable combination is of a particular category, so within the scatterplot I would like to have each category with a different color.
I was able to achieve that as per the code below. However the colorbar that I see on the plot would make more sense if it had the ... | 2021/01/15 | [
"https://Stackoverflow.com/questions/65737296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11994711/"
] | Unfortunately, PowerApps connects to SharePoint using the context of the end user. You have to give them contribute rights to the list, at a minimum. You can create a custom permission that gives users the ability to create but not edit (I haven't done this and don't know exactly what would happen).
Here's an option y... | You should be able to do this directly from SharePoint by creating your own permission group and assigning permission levels to it, on the Document Library (where the list is). On your document library, you can click on the ⚙️ (top right) > site permissions > Advanced permission settings > Create Group.
Once you have ... |
54,542,318 | I'm trying to create a guaranteed lookup for a given enum. As in, there should be exactly one value in the lookup for every key of the enum. I want to guarantee this through the type system so that I won't forget to update the lookup if the enum expands. I tried this:
```
type EnumDictionary<T, U> = {
[K in keyof ... | 2019/02/05 | [
"https://Stackoverflow.com/questions/54542318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371184/"
] | You can do it as follows:
```
type EnumDictionary<T extends string | symbol | number, U> = {
[K in T]: U;
};
enum Direction {
Up,
Down,
}
const a: EnumDictionary<Direction, number> = {
[Direction.Up]: 1,
[Direction.Down]: -1
};
```
I found it surprising until I realised that enums can be though... | As of [**TypeScript 2.9**](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html), you can use the syntax `{ [P in K]: XXX }`
So for the following enum
```
enum Direction {
Up,
Down,
}
```
If you want all of your Enum values to be required do this:
```
const directionDictAll: { [ke... |
54,542,318 | I'm trying to create a guaranteed lookup for a given enum. As in, there should be exactly one value in the lookup for every key of the enum. I want to guarantee this through the type system so that I won't forget to update the lookup if the enum expands. I tried this:
```
type EnumDictionary<T, U> = {
[K in keyof ... | 2019/02/05 | [
"https://Stackoverflow.com/questions/54542318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371184/"
] | You can do it as follows:
```
type EnumDictionary<T extends string | symbol | number, U> = {
[K in T]: U;
};
enum Direction {
Up,
Down,
}
const a: EnumDictionary<Direction, number> = {
[Direction.Up]: 1,
[Direction.Down]: -1
};
```
I found it surprising until I realised that enums can be though... | Given your use case I'm sharing a strategy I often use to solve this kind of problem although it's not strictly an Enum approach.
First I create a Readonly `as const` data structure - often an array is enough...
```
const SIMPLES = [
"Love",
"Hate",
"Indifference",
"JellyBabies"
] as const;
```
..... |
54,542,318 | I'm trying to create a guaranteed lookup for a given enum. As in, there should be exactly one value in the lookup for every key of the enum. I want to guarantee this through the type system so that I won't forget to update the lookup if the enum expands. I tried this:
```
type EnumDictionary<T, U> = {
[K in keyof ... | 2019/02/05 | [
"https://Stackoverflow.com/questions/54542318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371184/"
] | You can do it as follows:
```
type EnumDictionary<T extends string | symbol | number, U> = {
[K in T]: U;
};
enum Direction {
Up,
Down,
}
const a: EnumDictionary<Direction, number> = {
[Direction.Up]: 1,
[Direction.Down]: -1
};
```
I found it surprising until I realised that enums can be though... | With newer Typescript you can go with
```
Partial<Record<keyof typeof Direction, number>>
```
If you want all the keys to be required go with
```
Record<keyof typeof Direction, number>
``` |
54,542,318 | I'm trying to create a guaranteed lookup for a given enum. As in, there should be exactly one value in the lookup for every key of the enum. I want to guarantee this through the type system so that I won't forget to update the lookup if the enum expands. I tried this:
```
type EnumDictionary<T, U> = {
[K in keyof ... | 2019/02/05 | [
"https://Stackoverflow.com/questions/54542318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371184/"
] | As of [**TypeScript 2.9**](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html), you can use the syntax `{ [P in K]: XXX }`
So for the following enum
```
enum Direction {
Up,
Down,
}
```
If you want all of your Enum values to be required do this:
```
const directionDictAll: { [ke... | Given your use case I'm sharing a strategy I often use to solve this kind of problem although it's not strictly an Enum approach.
First I create a Readonly `as const` data structure - often an array is enough...
```
const SIMPLES = [
"Love",
"Hate",
"Indifference",
"JellyBabies"
] as const;
```
..... |
54,542,318 | I'm trying to create a guaranteed lookup for a given enum. As in, there should be exactly one value in the lookup for every key of the enum. I want to guarantee this through the type system so that I won't forget to update the lookup if the enum expands. I tried this:
```
type EnumDictionary<T, U> = {
[K in keyof ... | 2019/02/05 | [
"https://Stackoverflow.com/questions/54542318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371184/"
] | As of [**TypeScript 2.9**](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html), you can use the syntax `{ [P in K]: XXX }`
So for the following enum
```
enum Direction {
Up,
Down,
}
```
If you want all of your Enum values to be required do this:
```
const directionDictAll: { [ke... | With newer Typescript you can go with
```
Partial<Record<keyof typeof Direction, number>>
```
If you want all the keys to be required go with
```
Record<keyof typeof Direction, number>
``` |
54,542,318 | I'm trying to create a guaranteed lookup for a given enum. As in, there should be exactly one value in the lookup for every key of the enum. I want to guarantee this through the type system so that I won't forget to update the lookup if the enum expands. I tried this:
```
type EnumDictionary<T, U> = {
[K in keyof ... | 2019/02/05 | [
"https://Stackoverflow.com/questions/54542318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371184/"
] | Given your use case I'm sharing a strategy I often use to solve this kind of problem although it's not strictly an Enum approach.
First I create a Readonly `as const` data structure - often an array is enough...
```
const SIMPLES = [
"Love",
"Hate",
"Indifference",
"JellyBabies"
] as const;
```
..... | With newer Typescript you can go with
```
Partial<Record<keyof typeof Direction, number>>
```
If you want all the keys to be required go with
```
Record<keyof typeof Direction, number>
``` |
54,515,220 | I have a checkbox and under the checkbox a div area, where i wanna show a dropdown and another checkboxes. This area i wanna just show when the first checkbox is checked.
I already try it with style.display and it works half. I can display the second area when i check the checkbox, but if i uncheck it doesn´t hide aga... | 2019/02/04 | [
"https://Stackoverflow.com/questions/54515220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10628708/"
] | try like this with JQuery `Toggle`
```js
$('.initialOne').change(function() {
$('#doing').slideToggle();
})
```
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="form-check form-check-inline" style="font-size:20px">
<input class="form-check-input big... | Use the `toggle` method provided by the jQuery API
```js
$('#hide').on('click', function(e) {
$('#post').toggle();
});
```
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<label for="hide">Hide</label>
<input id="hide" type="checkbox" checked/>
<p id="post">N... |
54,515,220 | I have a checkbox and under the checkbox a div area, where i wanna show a dropdown and another checkboxes. This area i wanna just show when the first checkbox is checked.
I already try it with style.display and it works half. I can display the second area when i check the checkbox, but if i uncheck it doesn´t hide aga... | 2019/02/04 | [
"https://Stackoverflow.com/questions/54515220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10628708/"
] | Use the `toggle` method provided by the jQuery API
```js
$('#hide').on('click', function(e) {
$('#post').toggle();
});
```
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<label for="hide">Hide</label>
<input id="hide" type="checkbox" checked/>
<p id="post">N... | please check below code to toggle(show/hide) dive when click on check box.
```
<div id="autoUpdate" class="autoUpdate">
content
</div>
<script>
$(document).ready(function(){
$('#checkbox1').change(function(){
$('#autoUpdate').toggle()
});
});
``` |
54,515,220 | I have a checkbox and under the checkbox a div area, where i wanna show a dropdown and another checkboxes. This area i wanna just show when the first checkbox is checked.
I already try it with style.display and it works half. I can display the second area when i check the checkbox, but if i uncheck it doesn´t hide aga... | 2019/02/04 | [
"https://Stackoverflow.com/questions/54515220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10628708/"
] | Use the `toggle` method provided by the jQuery API
```js
$('#hide').on('click', function(e) {
$('#post').toggle();
});
```
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<label for="hide">Hide</label>
<input id="hide" type="checkbox" checked/>
<p id="post">N... | I have just tried your code and it seems to work fine:
<https://jsfiddle.net/h8nfx4g2/>
```
<div class="form-check form-check-inline" style="font-size:20px">
<input class="form-check-input big-checkbox" type="checkbox" id="tpe" value="tpe" onchange="functpe()">
<label class="form-check-label" for="tpe">tpe</label... |
54,515,220 | I have a checkbox and under the checkbox a div area, where i wanna show a dropdown and another checkboxes. This area i wanna just show when the first checkbox is checked.
I already try it with style.display and it works half. I can display the second area when i check the checkbox, but if i uncheck it doesn´t hide aga... | 2019/02/04 | [
"https://Stackoverflow.com/questions/54515220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10628708/"
] | You can do it with only CSS. You just need to tweak a little bit order to make `#doing` a sibling of checkbox ;)
[Here's an example](https://codepen.io/Rafi-R/pen/omwMqW)
```css
.doing {
display: none;
}
input[type=checkbox]:checked ~ .doing {
display: block;
}
``` | Use the `toggle` method provided by the jQuery API
```js
$('#hide').on('click', function(e) {
$('#post').toggle();
});
```
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<label for="hide">Hide</label>
<input id="hide" type="checkbox" checked/>
<p id="post">N... |
54,515,220 | I have a checkbox and under the checkbox a div area, where i wanna show a dropdown and another checkboxes. This area i wanna just show when the first checkbox is checked.
I already try it with style.display and it works half. I can display the second area when i check the checkbox, but if i uncheck it doesn´t hide aga... | 2019/02/04 | [
"https://Stackoverflow.com/questions/54515220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10628708/"
] | try like this with JQuery `Toggle`
```js
$('.initialOne').change(function() {
$('#doing').slideToggle();
})
```
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="form-check form-check-inline" style="font-size:20px">
<input class="form-check-input big... | please check below code to toggle(show/hide) dive when click on check box.
```
<div id="autoUpdate" class="autoUpdate">
content
</div>
<script>
$(document).ready(function(){
$('#checkbox1').change(function(){
$('#autoUpdate').toggle()
});
});
``` |
54,515,220 | I have a checkbox and under the checkbox a div area, where i wanna show a dropdown and another checkboxes. This area i wanna just show when the first checkbox is checked.
I already try it with style.display and it works half. I can display the second area when i check the checkbox, but if i uncheck it doesn´t hide aga... | 2019/02/04 | [
"https://Stackoverflow.com/questions/54515220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10628708/"
] | try like this with JQuery `Toggle`
```js
$('.initialOne').change(function() {
$('#doing').slideToggle();
})
```
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="form-check form-check-inline" style="font-size:20px">
<input class="form-check-input big... | I have just tried your code and it seems to work fine:
<https://jsfiddle.net/h8nfx4g2/>
```
<div class="form-check form-check-inline" style="font-size:20px">
<input class="form-check-input big-checkbox" type="checkbox" id="tpe" value="tpe" onchange="functpe()">
<label class="form-check-label" for="tpe">tpe</label... |
54,515,220 | I have a checkbox and under the checkbox a div area, where i wanna show a dropdown and another checkboxes. This area i wanna just show when the first checkbox is checked.
I already try it with style.display and it works half. I can display the second area when i check the checkbox, but if i uncheck it doesn´t hide aga... | 2019/02/04 | [
"https://Stackoverflow.com/questions/54515220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10628708/"
] | You can do it with only CSS. You just need to tweak a little bit order to make `#doing` a sibling of checkbox ;)
[Here's an example](https://codepen.io/Rafi-R/pen/omwMqW)
```css
.doing {
display: none;
}
input[type=checkbox]:checked ~ .doing {
display: block;
}
``` | please check below code to toggle(show/hide) dive when click on check box.
```
<div id="autoUpdate" class="autoUpdate">
content
</div>
<script>
$(document).ready(function(){
$('#checkbox1').change(function(){
$('#autoUpdate').toggle()
});
});
``` |
54,515,220 | I have a checkbox and under the checkbox a div area, where i wanna show a dropdown and another checkboxes. This area i wanna just show when the first checkbox is checked.
I already try it with style.display and it works half. I can display the second area when i check the checkbox, but if i uncheck it doesn´t hide aga... | 2019/02/04 | [
"https://Stackoverflow.com/questions/54515220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10628708/"
] | You can do it with only CSS. You just need to tweak a little bit order to make `#doing` a sibling of checkbox ;)
[Here's an example](https://codepen.io/Rafi-R/pen/omwMqW)
```css
.doing {
display: none;
}
input[type=checkbox]:checked ~ .doing {
display: block;
}
``` | I have just tried your code and it seems to work fine:
<https://jsfiddle.net/h8nfx4g2/>
```
<div class="form-check form-check-inline" style="font-size:20px">
<input class="form-check-input big-checkbox" type="checkbox" id="tpe" value="tpe" onchange="functpe()">
<label class="form-check-label" for="tpe">tpe</label... |
72,472,979 | [Routing of the app](https://i.stack.imgur.com/UhOhr.png)
[Json package](https://i.stack.imgur.com/Y3igH.png)
i can't figure out why it's not rendering anything and shows 404 page if i manually navigate to other page | 2022/06/02 | [
"https://Stackoverflow.com/questions/72472979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14009899/"
] | Move the condition `qty_type = 'a'` inside the subquery and use `COALESCE()` in the main query so that you get 0 for items that do not match the join:
```
SELECT i.*,
COALESCE(s.current_stock, 0) AS stock
FROM item i
LEFT JOIN (
SELECT item_id, SUM(qty) AS current_stock
FROM stock
WHERE qty_type = 'a... | Please try this:
```
SELECT i.item_id
, i.item_name
, i.item_code
, i.sku
, i.min_qty
, i.max_qty
, current_stock as stock
FROM item i
LEFT JOIN
(
SELECT item_id, SUM(qty) AS current_stock
FROM stock
WHERE qty_type = 'a'
GROUP BY item_id
) s... |
2,163,490 | Suppose a application level protocol is implemented via UDP. Client timeout is required, thus server need to keep state of each client it talks to.
Also suppose `select` is used.
1. Is it always the best to implement multi-threading server? I figure a link-list will do the same, where server timeout `time=Earliest Ti... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2163490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/217549/"
] | Linked-Lists will not scale.
Using linked lists on the server-side to check the clients one-by-one and address their needs is all well and good for 5 to 10 clients. But what happens when you have 100? 1000? What happens if one clients request takes a very long time to handle?
Threads don't just provide a way of main... | Multi-threading is definitely not a must as you have already come up with an alternative. We can't really use absolutes like *always* or *never* as each case has unique requirements and constraints.
Yes, adding a new thread/socket for each connection will consume more resources. It sounds like you need to get a good d... |
2,163,490 | Suppose a application level protocol is implemented via UDP. Client timeout is required, thus server need to keep state of each client it talks to.
Also suppose `select` is used.
1. Is it always the best to implement multi-threading server? I figure a link-list will do the same, where server timeout `time=Earliest Ti... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2163490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/217549/"
] | In my experience, threading makes it very easy for your code to look logical and clean, when horrible synchronization issues are lurking, waiting for some events to occur in just the right sequence that the application blows up. Threading is a very useful tool - you need to think with threads if your application is goi... | Multi-threading is definitely not a must as you have already come up with an alternative. We can't really use absolutes like *always* or *never* as each case has unique requirements and constraints.
Yes, adding a new thread/socket for each connection will consume more resources. It sounds like you need to get a good d... |
2,163,490 | Suppose a application level protocol is implemented via UDP. Client timeout is required, thus server need to keep state of each client it talks to.
Also suppose `select` is used.
1. Is it always the best to implement multi-threading server? I figure a link-list will do the same, where server timeout `time=Earliest Ti... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2163490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/217549/"
] | I'm not going to suggest anything new that isn't in the answer by Aidan Cully, however, take a look at the theory behind Apache's Multi Processing Modules: <http://www.linuxquestions.org/linux/answers/Networking/Multi_Processing_Module_in_Apache>
In essence, the server is split into multiple modules and threads/proce... | Multi-threading is definitely not a must as you have already come up with an alternative. We can't really use absolutes like *always* or *never* as each case has unique requirements and constraints.
Yes, adding a new thread/socket for each connection will consume more resources. It sounds like you need to get a good d... |
2,163,490 | Suppose a application level protocol is implemented via UDP. Client timeout is required, thus server need to keep state of each client it talks to.
Also suppose `select` is used.
1. Is it always the best to implement multi-threading server? I figure a link-list will do the same, where server timeout `time=Earliest Ti... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2163490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/217549/"
] | In my experience, threading makes it very easy for your code to look logical and clean, when horrible synchronization issues are lurking, waiting for some events to occur in just the right sequence that the application blows up. Threading is a very useful tool - you need to think with threads if your application is goi... | Linked-Lists will not scale.
Using linked lists on the server-side to check the clients one-by-one and address their needs is all well and good for 5 to 10 clients. But what happens when you have 100? 1000? What happens if one clients request takes a very long time to handle?
Threads don't just provide a way of main... |
2,163,490 | Suppose a application level protocol is implemented via UDP. Client timeout is required, thus server need to keep state of each client it talks to.
Also suppose `select` is used.
1. Is it always the best to implement multi-threading server? I figure a link-list will do the same, where server timeout `time=Earliest Ti... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2163490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/217549/"
] | I'm not going to suggest anything new that isn't in the answer by Aidan Cully, however, take a look at the theory behind Apache's Multi Processing Modules: <http://www.linuxquestions.org/linux/answers/Networking/Multi_Processing_Module_in_Apache>
In essence, the server is split into multiple modules and threads/proce... | Linked-Lists will not scale.
Using linked lists on the server-side to check the clients one-by-one and address their needs is all well and good for 5 to 10 clients. But what happens when you have 100? 1000? What happens if one clients request takes a very long time to handle?
Threads don't just provide a way of main... |
47,330,850 | I am trying to create a login form wherein if the username is blank, it throws an error.
```
from flask import Flask, render_template
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField
from wtforms.validators import InputRequired, Email, length, ValidationError
app = Flask(_... | 2017/11/16 | [
"https://Stackoverflow.com/questions/47330850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Assuming that your form will be sent with POST method you have to validate the form data if they have been submitted. With flask-wtf it is really simple:
```
@app.route('/form', methods=['GET','POST'])
def check_form():
form = LoginForm()
if form.validate_on_submit():
# do something
return # s... | You are not validating the form at all in the `form` function. Edit the function and add a validation line. It is after validation that the errors are found. Otherwise, the `form` variable in your template will not have errors attributes. The following should do:
```
@app.route('/form', methods=['GET','POST'])
def for... |
36,783 | One that we looked at in the past is AeroText, but that does not look like it exists as its own project anymore. I would think that it could be written in any language since we are interested in the output (the annotated entities), although it certainly would be a plus if it had a Java API that could be interfaced with... | 2016/10/11 | [
"https://softwarerecs.stackexchange.com/questions/36783",
"https://softwarerecs.stackexchange.com",
"https://softwarerecs.stackexchange.com/users/129/"
] | [Formotus](http://www.formotus.com/) may be a possible answer. Whilst it is not free, sorry, but there is a good solution with a free trial.
There is a pricing matrix available [here](http://www.formotus.com/product/pricing).
Formotus is optimized for offline data collection forms in mobile apps for iOS and Android ... | You can use Clappia (<https://clappia.com>)
You can create a form that can be accessed on the mobile by your users. This form is accessible offline as well. You just need to open your particular app inside Clappia once and they will be loaded even if there is no internet. They can submit data to this and the submitted... |
36,783 | One that we looked at in the past is AeroText, but that does not look like it exists as its own project anymore. I would think that it could be written in any language since we are interested in the output (the annotated entities), although it certainly would be a plus if it had a Java API that could be interfaced with... | 2016/10/11 | [
"https://softwarerecs.stackexchange.com/questions/36783",
"https://softwarerecs.stackexchange.com",
"https://softwarerecs.stackexchange.com/users/129/"
] | [Formotus](http://www.formotus.com/) may be a possible answer. Whilst it is not free, sorry, but there is a good solution with a free trial.
There is a pricing matrix available [here](http://www.formotus.com/product/pricing).
Formotus is optimized for offline data collection forms in mobile apps for iOS and Android ... | Unfortunately, as far as I know there is no free offline alternative to google forms.
We received similar requests from our clients (utility company managing technicians in remote areas with limited network, HVAC installers, etc.), so we decided to build a solution for this : Fieldeo (<https://fieldeo.com/>). Here how... |
36,783 | One that we looked at in the past is AeroText, but that does not look like it exists as its own project anymore. I would think that it could be written in any language since we are interested in the output (the annotated entities), although it certainly would be a plus if it had a Java API that could be interfaced with... | 2016/10/11 | [
"https://softwarerecs.stackexchange.com/questions/36783",
"https://softwarerecs.stackexchange.com",
"https://softwarerecs.stackexchange.com/users/129/"
] | You can use Clappia (<https://clappia.com>)
You can create a form that can be accessed on the mobile by your users. This form is accessible offline as well. You just need to open your particular app inside Clappia once and they will be loaded even if there is no internet. They can submit data to this and the submitted... | Unfortunately, as far as I know there is no free offline alternative to google forms.
We received similar requests from our clients (utility company managing technicians in remote areas with limited network, HVAC installers, etc.), so we decided to build a solution for this : Fieldeo (<https://fieldeo.com/>). Here how... |
305,838 | I started learning AngularJS and ASP.NET MVC, but am not sure why to use them both together in the same project?
Aren't they both MVC frameworks? Should I be using them both in the same application? Isn't it one or the other? | 2015/12/25 | [
"https://softwareengineering.stackexchange.com/questions/305838",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/208578/"
] | If you're building a [single page application (SPA)](https://en.wikipedia.org/wiki/Single-page_application), then you probably don't need the "MVC" in [ASP.NET MVC](http://www.asp.net/mvc). Views, especially dynamic views, are likely delivered/manipulated client-side. Angular handles that just fine.
But maybe you don'... | ASP.NET MVC is a server-side framework; it doesn't care what JavaScript libraries do you use. AngularJS is a client-side library, which doesn't care what server-side technology powers the website—it can be Python, ASP.NET MVC, or even the plain old bunch of static HTML files stored directly on disk.
ASP.NET MVC and An... |
305,838 | I started learning AngularJS and ASP.NET MVC, but am not sure why to use them both together in the same project?
Aren't they both MVC frameworks? Should I be using them both in the same application? Isn't it one or the other? | 2015/12/25 | [
"https://softwareengineering.stackexchange.com/questions/305838",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/208578/"
] | ASP.NET MVC is a server-side framework; it doesn't care what JavaScript libraries do you use. AngularJS is a client-side library, which doesn't care what server-side technology powers the website—it can be Python, ASP.NET MVC, or even the plain old bunch of static HTML files stored directly on disk.
ASP.NET MVC and An... | If you are using visual studio there is a new 'single page app' MVC website template which includes angular and MVC Web Api controllers.
This works well because your MVC server-side code provides json endpoints for the angular client side code to call.
Additionally you can use the MVC controllers to serve the basic h... |
305,838 | I started learning AngularJS and ASP.NET MVC, but am not sure why to use them both together in the same project?
Aren't they both MVC frameworks? Should I be using them both in the same application? Isn't it one or the other? | 2015/12/25 | [
"https://softwareengineering.stackexchange.com/questions/305838",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/208578/"
] | ASP.NET MVC is a server-side framework; it doesn't care what JavaScript libraries do you use. AngularJS is a client-side library, which doesn't care what server-side technology powers the website—it can be Python, ASP.NET MVC, or even the plain old bunch of static HTML files stored directly on disk.
ASP.NET MVC and An... | 3 years later, use ASP.NET Web API to serve up your data and Angular (js or newer) to structure your app on the client side. If you're making a static site then just use ASP.NET MVC. |
305,838 | I started learning AngularJS and ASP.NET MVC, but am not sure why to use them both together in the same project?
Aren't they both MVC frameworks? Should I be using them both in the same application? Isn't it one or the other? | 2015/12/25 | [
"https://softwareengineering.stackexchange.com/questions/305838",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/208578/"
] | If you're building a [single page application (SPA)](https://en.wikipedia.org/wiki/Single-page_application), then you probably don't need the "MVC" in [ASP.NET MVC](http://www.asp.net/mvc). Views, especially dynamic views, are likely delivered/manipulated client-side. Angular handles that just fine.
But maybe you don'... | If you are using visual studio there is a new 'single page app' MVC website template which includes angular and MVC Web Api controllers.
This works well because your MVC server-side code provides json endpoints for the angular client side code to call.
Additionally you can use the MVC controllers to serve the basic h... |
305,838 | I started learning AngularJS and ASP.NET MVC, but am not sure why to use them both together in the same project?
Aren't they both MVC frameworks? Should I be using them both in the same application? Isn't it one or the other? | 2015/12/25 | [
"https://softwareengineering.stackexchange.com/questions/305838",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/208578/"
] | If you're building a [single page application (SPA)](https://en.wikipedia.org/wiki/Single-page_application), then you probably don't need the "MVC" in [ASP.NET MVC](http://www.asp.net/mvc). Views, especially dynamic views, are likely delivered/manipulated client-side. Angular handles that just fine.
But maybe you don'... | 3 years later, use ASP.NET Web API to serve up your data and Angular (js or newer) to structure your app on the client side. If you're making a static site then just use ASP.NET MVC. |
305,838 | I started learning AngularJS and ASP.NET MVC, but am not sure why to use them both together in the same project?
Aren't they both MVC frameworks? Should I be using them both in the same application? Isn't it one or the other? | 2015/12/25 | [
"https://softwareengineering.stackexchange.com/questions/305838",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/208578/"
] | If you are using visual studio there is a new 'single page app' MVC website template which includes angular and MVC Web Api controllers.
This works well because your MVC server-side code provides json endpoints for the angular client side code to call.
Additionally you can use the MVC controllers to serve the basic h... | 3 years later, use ASP.NET Web API to serve up your data and Angular (js or newer) to structure your app on the client side. If you're making a static site then just use ASP.NET MVC. |
867,354 | I have a list of filenames inside a file called `list_of_files.txt`.
I want to copy the contents of each file in that list into another file called `all_compounds.sdf`.
How should I do this from the command line? | 2017/01/03 | [
"https://askubuntu.com/questions/867354",
"https://askubuntu.com",
"https://askubuntu.com/users/637711/"
] | Quick and dirty way...
```sh
cat $(cat list_of_files.txt) >> all_compounds.sdf
```
**Please note:** this only works if the filenames in your list are very well behaved - things will go wrong if they have spaces, newlines, or any characters that have special meaning to the shell - use [this answer instead](https://as... | While GNU `awk` is a text processing utility, it allows running external shell commands via `system()` call. We can utilize that to our advantage like so:
```sh
$ awk '{cmd=sprintf("cat \"%s\"",$0); system(cmd)}' file_list.txt
```
The idea here is simple: we re... |
867,354 | I have a list of filenames inside a file called `list_of_files.txt`.
I want to copy the contents of each file in that list into another file called `all_compounds.sdf`.
How should I do this from the command line? | 2017/01/03 | [
"https://askubuntu.com/questions/867354",
"https://askubuntu.com",
"https://askubuntu.com/users/637711/"
] | Don't use simple command substitution to get filenames (that could easily break with spaces and other special characters). Use something like `xargs`:
```sh
xargs -d '\n' -a list_of_files.txt cat > all_compounds.sdf
```
Or a `while read` loop:
```sh
while IFS= read -r file; do cat "$file"; done < list_of_files.txt ... | While GNU `awk` is a text processing utility, it allows running external shell commands via `system()` call. We can utilize that to our advantage like so:
```sh
$ awk '{cmd=sprintf("cat \"%s\"",$0); system(cmd)}' file_list.txt
```
The idea here is simple: we re... |
18,732,595 | I would like to have a model that belongs to another one. In my controller, I'd like to get all items in that model, but I want the attributes from the table it belongs to as well. For example:
```
class Comment extends Eloquent {
public function post()
{
return $this->belongsTo('Post');
}
}
```... | 2013/09/11 | [
"https://Stackoverflow.com/questions/18732595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/463604/"
] | If you want to get the results only with one query done on the background, without using `with()`, you can use `fluent` and `join()`.
```
SELECT * FROM comments LEFT JOIN posts ON comments.post_id = posts.id
```
is equal to:
```
DB::table('comments')
->join('posts','comments.post_id','=','posts.id','left')
... | $comments:: all()->with ('post')->get() |
18,732,595 | I would like to have a model that belongs to another one. In my controller, I'd like to get all items in that model, but I want the attributes from the table it belongs to as well. For example:
```
class Comment extends Eloquent {
public function post()
{
return $this->belongsTo('Post');
}
}
```... | 2013/09/11 | [
"https://Stackoverflow.com/questions/18732595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/463604/"
] | From the [documentation on eager loading](http://laravel.com/docs/eloquent#eager-loading):
>
> Thankfully, we can use eager loading to drastically reduce the number of queries. The relationships that should be eager loaded may be specified via the with method [...]
>
>
>
Using the `with()` parameter will use a **... | $comments:: all()->with ('post')->get() |
18,732,595 | I would like to have a model that belongs to another one. In my controller, I'd like to get all items in that model, but I want the attributes from the table it belongs to as well. For example:
```
class Comment extends Eloquent {
public function post()
{
return $this->belongsTo('Post');
}
}
```... | 2013/09/11 | [
"https://Stackoverflow.com/questions/18732595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/463604/"
] | From the [documentation on eager loading](http://laravel.com/docs/eloquent#eager-loading):
>
> Thankfully, we can use eager loading to drastically reduce the number of queries. The relationships that should be eager loaded may be specified via the with method [...]
>
>
>
Using the `with()` parameter will use a **... | If you want to get the results only with one query done on the background, without using `with()`, you can use `fluent` and `join()`.
```
SELECT * FROM comments LEFT JOIN posts ON comments.post_id = posts.id
```
is equal to:
```
DB::table('comments')
->join('posts','comments.post_id','=','posts.id','left')
... |
14,814 | I'm searching a discussion group for asking questions about how layout, typography and etc. for scientific writing
Especially concerning:
* Ph.D. thesis
* in engineering / materials science
* conventions for scientific writing / Ph.D. thesis German language and/or at German universities
e. g.
* how to present / s... | 2011/04/02 | [
"https://tex.stackexchange.com/questions/14814",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/4009/"
] | I do not know of any communities that discuss this (probably because conventions don't change much). However, I can forward you to some relevant documents:
* [Typefaces for Symbols in Scientific Manuscripts](http://physics.nist.gov/cuu/pdf/typefaces.pdf)
* [Typesetting mathematics for science and technology according ... | Start with *The Visual Display of Quantitative Information* by Tufte. It doesn't cover everything in your question, but an provides excellent foundation for anyone trying to make a point with data. As an added bonus, there is a nice latex class modeling the Tufte style. |
67,310,444 | I need help to perform the following
My CSV file looks like this
```
900001_10459.jpg,036921,Initiated
900002_10454.jpg,027964,Initiated
900003_10440.jpg,021449,Initiated
900004_10440.jpg,016650,Initiated
900005_10440.jpg,013929,Initiated
```
What I need to do is generate a new csv file to be as follows
```
900001... | 2021/04/29 | [
"https://Stackoverflow.com/questions/67310444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13037276/"
] | Try
```
sed 's/,0*([0-9]*)([0-9]),/,\1.\2,/' myfile.csv
``` | Assuming that values with leading zeros appears solely in 2nd column I would use GNU `AWK` for this task following way, let `file.txt` content be
```
900001_10459.jpg,036921,Initiated
900002_10454.jpg,027964,Initiated
900003_10440.jpg,021449,Initiated
900004_10440.jpg,016650,Initiated
900005_10440.jpg,013929,Initiated... |
67,310,444 | I need help to perform the following
My CSV file looks like this
```
900001_10459.jpg,036921,Initiated
900002_10454.jpg,027964,Initiated
900003_10440.jpg,021449,Initiated
900004_10440.jpg,016650,Initiated
900005_10440.jpg,013929,Initiated
```
What I need to do is generate a new csv file to be as follows
```
900001... | 2021/04/29 | [
"https://Stackoverflow.com/questions/67310444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13037276/"
] | Try
```
sed 's/,0*([0-9]*)([0-9]),/,\1.\2,/' myfile.csv
``` | >
> `I wish to have 4 numbers (including zeros) and the last value (5th value) separated from the 4 values by a decimal point`.
>
>
>
If I understand, you need not all digits of that field but only the last five digits.
Using `awk` you can get the last five with the `substr` function and then print the field with... |
67,310,444 | I need help to perform the following
My CSV file looks like this
```
900001_10459.jpg,036921,Initiated
900002_10454.jpg,027964,Initiated
900003_10440.jpg,021449,Initiated
900004_10440.jpg,016650,Initiated
900005_10440.jpg,013929,Initiated
```
What I need to do is generate a new csv file to be as follows
```
900001... | 2021/04/29 | [
"https://Stackoverflow.com/questions/67310444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13037276/"
] | Using `awk` and with the conditions specified in the [comment](https://stackoverflow.com/questions/67310444/update-a-csv-file-to-drop-the-first-number-and-insert-a-decimal-place-in-a-parti#comment118975638_67310444), you can use:
```
$ awk -F, '{ printf "%s,%06.1f,%s\n", $1, $2 / 10, $3 }' data
900001_10459.jpg,3692.1... | Assuming that values with leading zeros appears solely in 2nd column I would use GNU `AWK` for this task following way, let `file.txt` content be
```
900001_10459.jpg,036921,Initiated
900002_10454.jpg,027964,Initiated
900003_10440.jpg,021449,Initiated
900004_10440.jpg,016650,Initiated
900005_10440.jpg,013929,Initiated... |
67,310,444 | I need help to perform the following
My CSV file looks like this
```
900001_10459.jpg,036921,Initiated
900002_10454.jpg,027964,Initiated
900003_10440.jpg,021449,Initiated
900004_10440.jpg,016650,Initiated
900005_10440.jpg,013929,Initiated
```
What I need to do is generate a new csv file to be as follows
```
900001... | 2021/04/29 | [
"https://Stackoverflow.com/questions/67310444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13037276/"
] | Using `awk` and with the conditions specified in the [comment](https://stackoverflow.com/questions/67310444/update-a-csv-file-to-drop-the-first-number-and-insert-a-decimal-place-in-a-parti#comment118975638_67310444), you can use:
```
$ awk -F, '{ printf "%s,%06.1f,%s\n", $1, $2 / 10, $3 }' data
900001_10459.jpg,3692.1... | >
> `I wish to have 4 numbers (including zeros) and the last value (5th value) separated from the 4 values by a decimal point`.
>
>
>
If I understand, you need not all digits of that field but only the last five digits.
Using `awk` you can get the last five with the `substr` function and then print the field with... |
16,317,669 | Hi I have the following saved as upload.php.
```
<html>
<head>
</head>
<body>
<?php
for($file_count = 0; $file_count <= count($_FILES['files']['tmp_name']); $file_count++){
echo '111111';
if( $_FILES['files']['error'][$file_count] == 0){
echo '2222222222';
... | 2013/05/01 | [
"https://Stackoverflow.com/questions/16317669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2339221/"
] | There is a better approach, Symfony allows you to enable a testing session mode that doesnt use the 'session\_\*' functionality. I am not sure exactly how to enable this in Silex, but you have to enable the mock file storage in Symfony.
```
storage_id: session.storage.mock_file
```
Documentation for Silex is here: <... | Two solutions :
1. Run the test in an isolated process :
```
/**
* @runInSeparateProcess
*/
public function testAppControllerForm()
{
$client = $this->createClient();
$crawler = $client->request('GET', '/app/form');
$this->assertTrue($client->getResponse()->isOk());
}
```
2. Redirect phpunit's output... |
321,743 | What's the best way to find all (or most of) the water in an area in a Minecraft world (to be able to remove it)? Especially water in caves is a problem. | 2017/11/20 | [
"https://gaming.stackexchange.com/questions/321743",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/100734/"
] | Since a big part of Minecraft is finding resources, the game won't make it too easy for you. You will have to go through the caves and search for it.
But to find water in particular, you can make your task a bit easier by turning subtitles on. Flowing water produces sound and if you have subtitles on, you not only s... | **This was about an earlier version of the question. Apparently the asker didn't mean this, but worded it poorly.**
= The manual way =
You can let sand fall into the water to split it into columns (7x7 should be good) and then drain it with sponges.
It should probably be the easiest to go into the water, place one s... |
49,560,809 | How do you output average of multiple columns?
```
Gender Age Salary Yr_exp cup_coffee_daily
Male 28 45000.0 6.0 2.0
Female 40 70000.0 15.0 10.0
Female 23 40000.0 1.0 0.0
Male 35 55000.0 12.0 6.... | 2018/03/29 | [
"https://Stackoverflow.com/questions/49560809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9420826/"
] | Given this dataframe:
```
df = pd.DataFrame({
"Gender": ["Male", "Female", "Female", "Male"],
"Age": [28, 40, 23, 35],
"Salary": [45000, 70000, 40000, 55000],
"Yr_exp": [6, 15, 1, 12]
})
df
Age Gender Salary Yr_exp
0 28 Male 45000 6
1 40 Female 70000 15
2 23 Female 40... | You can also use [`pandas.agg()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.agg.html):
```
df.groupby("Gender").agg({'Age' : 'mean', 'Salary' : 'mean', 'Yr_exp': 'mean'})
```
Would result to:
```
Age Salary Yr_exp
Gender
Female 31.5 55000 8
Male 31.5... |
11,396,526 | I need to parse and generate some texts from and to c++ objects.
The syntax is:
```
command #param #param #param
```
There is set of commands some of them have no params etc.
Params are mainly numbers.
The question is: Should I use Boost Spirit for this task? Or just simply tokenize each line evaluate function to ... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11396526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1044544/"
] | I implemented more or less precisely this [in a previous answer](https://stackoverflow.com/a/7897417/85371) to the question " [Using boost::bind with boost::function: retrieve binded variable type](https://stackoverflow.com/questions/7893768/using-boostbind-with-boostfunction-retrieve-binded-variable-type/7897417#78974... | For simple formatted, easily tested input, tokenizing should be enough.
When tokenizing, you can read a line from the input and put that in a stringstream (iss). From iss, you read the first word and pass that to a command factory which creates the right command for you. Then you can pass iss to the readInParameters... |
11,274 | I've looked at and tried a couple of solutions on here but struggling to apply them to my circumstance.
Below is my current code. I would like a 'default' asset (image) to be used if one hasn't been specified by the admin. This is so that the front end doesn't have gaps in the gallery.
```
<ul id="photListing">
{% ca... | 2015/09/01 | [
"https://craftcms.stackexchange.com/questions/11274",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/189/"
] | You can test if your `first()` method returns an asset model.
And depending on that have different image URLs, the (transformed) asset's one or the URL of your placholder image.
```
{% set image = block.mx_peoplePhoto.first() %}
{% set imageUrl = image ? image.url('500x500') : url('images/_static/placeholder.jpg') %}... | I have a macro that I use for all images that falls back to our logo if an image is not supplied to it for whatever reason.
```
{% macro imageTransform(image, transform, caption, extraHTML) %}
{# Fallback to our logo if the image is null... #}
{% if not image|length %}
{% set image = craft.assets.id('84').first() ... |
74,197,264 | I'm making an dependent drop-downn of countries states and cities in laravel using jQuery and Ajax. I'm doing it on localhost Xampp. First i use jQuery for country. when country change jQuery get value and send to Controller. But when i send value from RegistrationFormComponent to CountryStateCity Controller and try to... | 2022/10/25 | [
"https://Stackoverflow.com/questions/74197264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20330580/"
] | This is written incorrectly.
```
public function getstate(Request $request) {
$state = State::where('countryid'->$cid)->get();
return response()->json($state);
}
```
It should look like this.
```
public function getstate(Request $request) {
$state = State::where('countryid', '=', $requ... | please check controller function
```
public function getstate(Request $request) {
$state = State::where('countryid' `=` ,request->$countryid)->get();
return response()->json($state);
}
``` |
928,295 | I have a problem configuring httpd to accept large SPNEGO authentication headers.
The request work fine with Authorization header line of up to at least 5674 bytes but break with Authorization header of more than 6178 bytes with the following answer :
```
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>... | 2018/08/28 | [
"https://serverfault.com/questions/928295",
"https://serverfault.com",
"https://serverfault.com/users/423611/"
] | On my Ubuntu 18.04 LTS machine with Apache 2.4 i modified the file:
/etc/apache2/conf-available/httpd.conf
according to the docs at <https://httpd.apache.org/docs/2.4/mod/core.html>
```
# https://askubuntu.com/questions/340792/size-of-a-request-header-field-exceeds-server-limit-due-to-many-if-none-match-va
# default... | Edit your virtual hosts and review limitation about request size.
you can check the defaults values in httpd.h (DEFAULT\_LIMIT\_REQUEST\_FIELDSIZE for example)
example :
```
<VirtualHost ...>
ServerName www.mysite.com
...
#HTTP Request
LimitRequestFieldSize 32768
LimitRequestFields 200
Limit... |
928,295 | I have a problem configuring httpd to accept large SPNEGO authentication headers.
The request work fine with Authorization header line of up to at least 5674 bytes but break with Authorization header of more than 6178 bytes with the following answer :
```
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>... | 2018/08/28 | [
"https://serverfault.com/questions/928295",
"https://serverfault.com",
"https://serverfault.com/users/423611/"
] | On my Ubuntu 18.04 LTS machine with Apache 2.4 i modified the file:
/etc/apache2/conf-available/httpd.conf
according to the docs at <https://httpd.apache.org/docs/2.4/mod/core.html>
```
# https://askubuntu.com/questions/340792/size-of-a-request-header-field-exceeds-server-limit-due-to-many-if-none-match-va
# default... | If you put your LimitRequest directives in your server config, those directives must be inserted before your VirtualHost config. |
18,586,386 | I am able to update the like and unlike button via ajax, but I am not able to update the like count.
Post `has_many` likes
likes\_controller.rb
```
def create
@like = Like.new(:post_id => params[:post_to_be_liked])
if @like.save
respond_to do |format|
format.html {redirect_to :back, notic... | 2013/09/03 | [
"https://Stackoverflow.com/questions/18586386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1862498/"
] | But why are you doing this in your view?
```
<% @post = user.posts.first %>
```
It will update only your first post always. I can't understand.
Try with this:
\_liked\_users.html.erb
```
<%= @updated_post = Post.where(id: @post.id) %>
<%= "#{@updated_post.likes.length} like this" %>
```
or
```
<%= @post.r... | I think you should try to do this
```
@post = user.posts.first
```
after save in your controller and remove <% @post = user.posts.first %> from erb file and if it is not possible then initialize @post in your controller#create
```
@post = Post.find(params[:post_to_be_liked])
``` |
27,511,781 | Let's imagine I have the following table `users`:
```
id name
1 John
2 Mike
3 Max
```
And table `posts`
```
id author_id date title
1 1 2014-12-12 Post 2
2 1 2014-12-10 Post 1
3 2 2014-10-01 Lorem ipsum
...and so on
```
And I'd like to have a query containing the following data... | 2014/12/16 | [
"https://Stackoverflow.com/questions/27511781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4141266/"
] | You must know what is the scale of the map you are showing. Having scale of the map you could convert pixels size to metric size. And having this proportion you can convert radius given in pixels to meters. | So here's how you do it...
Jedil is correct you have to find your screen width/height, the dpi of the screen, etc. So, looking through [this old osmdroid](https://code.google.com/p/osmdroid/source/browse/trunk/osmdroid-android/src/main/java/org/osmdroid/views/overlay/ScaleBarOverlay.java?r=1152) source I sorta figured... |
27,511,781 | Let's imagine I have the following table `users`:
```
id name
1 John
2 Mike
3 Max
```
And table `posts`
```
id author_id date title
1 1 2014-12-12 Post 2
2 1 2014-12-10 Post 1
3 2 2014-10-01 Lorem ipsum
...and so on
```
And I'd like to have a query containing the following data... | 2014/12/16 | [
"https://Stackoverflow.com/questions/27511781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4141266/"
] | You must know what is the scale of the map you are showing. Having scale of the map you could convert pixels size to metric size. And having this proportion you can convert radius given in pixels to meters. | I think what you're looking for is a meters-to-pixels calculation. You can get this from the projection:
```
// Get projection
Projection proj = mMapView.getProjection();
// How many pixels in 100 meters for this zoom level
float pixels = proj.metersToPixels(100);
// How many meters in 100 pixels for this zoom level
f... |
2,299,580 | I am trying to populate a couple text box fields in my MVC application. I have a text box that a user can enter an ID and then click search, and based on the ID input from the user, information should be brought back to populate First Name, Last Name text boxes on the same page.
The problem I am having is bringing ba... | 2010/02/19 | [
"https://Stackoverflow.com/questions/2299580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277325/"
] | There are a few different issues here all working against you. The first is that you're setting a specific Foreground value on your control instance, which has a higher priority than values set from `Trigger`s in your `Style` for properties of the control itself. This is different than properties set on elements *insid... | A couple ideas to try:
1. Get rid of one of your triggers. Having two opposing triggers may not be a good idea. I would set the default `Background`, `BorderBrush`, and `Foreground` directly on your `Border` declaration, and remove the `Enabled="True"` trigger. Then, debugging is only a matter of getting the `Enabled=... |
2,299,580 | I am trying to populate a couple text box fields in my MVC application. I have a text box that a user can enter an ID and then click search, and based on the ID input from the user, information should be brought back to populate First Name, Last Name text boxes on the same page.
The problem I am having is bringing ba... | 2010/02/19 | [
"https://Stackoverflow.com/questions/2299580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277325/"
] | There are a few different issues here all working against you. The first is that you're setting a specific Foreground value on your control instance, which has a higher priority than values set from `Trigger`s in your `Style` for properties of the control itself. This is different than properties set on elements *insid... | The possible reason is that your `DisabledBackgroundBrush` is not visible at the point where you use your style. Please try to add the styles into the `ControlTemplate`'s resources:
```
<ControlTemplate TargetType="{x:Type TextBox}">
<ControlTemplate.Resources>
<SolidColorBrush x:Key="DisabledBackgroundBru... |
4,159 | Is there any alternative for faucet as I am seeing "Unfortunately the faucet has run dry" message on the site. I don't understand what "faucet has run dry" means. | 2022/04/15 | [
"https://tezos.stackexchange.com/questions/4159",
"https://tezos.stackexchange.com",
"https://tezos.stackexchange.com/users/8209/"
] | Are you using <https://teztnets.xyz> ?
<https://faucet.tezos.com> has been deprecated. Now, each test network has its own faucet. | I've develop a little faucet for testnet (only Ithacanet for instance)
<https://tezos-testnet-faucet.netlify.app/>
Feel free to use it and give me some feedback about it ;) |
23,788,176 | Is it possible for this code to be modified to include Bluetooth Low Energy devices as well? <https://code.google.com/p/pybluez/source/browse/trunk/examples/advanced/inquiry-with-rssi.py?r=1>
I can find devices like my phone and other bluetooth 4.0 devices, but not any BLE. If this cannot be modified, is it possible t... | 2014/05/21 | [
"https://Stackoverflow.com/questions/23788176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3582887/"
] | As I said in the comment, that library won't work with BLE.
Here's some example code to do a simple BLE scan:
```
import sys
import os
import struct
from ctypes import (CDLL, get_errno)
from ctypes.util import find_library
from socket import (
socket,
AF_BLUETOOTH,
SOCK_RAW,
BTPROTO_HCI,
SOL_HCI,... | You could also try [pygattlib](https://github.com/oscaracena/pygattlib). It can be used to discover devices, and (currently) there is a basic support for reading/writing characteristics. No RSSI for now.
You could discover using the following snippet:
```
from gattlib import DiscoveryService
service = DiscoveryServi... |
41,897,027 | i am retrieving some results from a mysql database and they come in a form separated by brackets. I want to remove the brackets, i have used the strip function but that will only work for when i have one result to display.
The code below will only remove brackets for search results that only have one element.
```
@... | 2017/01/27 | [
"https://Stackoverflow.com/questions/41897027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7291401/"
] | I think the simple way is using **extend**
```
result = []
for i in c.fetchall()
result.extend(i)
``` | If you want to simply remove all brackets from a result, you can use replace() method. The syntax is string.replace(string\_to\_replace, string\_to\_replace\_with).
eg:
```
result = str(result).replace("()", "")
```
This will need to be done for each bracket type, I believe. So another round for "[]".
Note that af... |
41,897,027 | i am retrieving some results from a mysql database and they come in a form separated by brackets. I want to remove the brackets, i have used the strip function but that will only work for when i have one result to display.
The code below will only remove brackets for search results that only have one element.
```
@... | 2017/01/27 | [
"https://Stackoverflow.com/questions/41897027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7291401/"
] | I think the simple way is using **extend**
```
result = []
for i in c.fetchall()
result.extend(i)
``` | After some playing around I found that the results you get back from a mysql query aren't string but tuples so simply trying to remove the brackets doesn't work.
Here's is my example of how I dealt with it, starting with the query:
```
mycursor.execute("SELECT name1, name2 FROM testdatabase where (name1 REGEXP '^test... |
364,190 | So, I installed Ubuntu alongside Windows 7 just now, on my girlfriend's laptop. I used a USB stick and followed all the default options, choosing a partition size of 32GB for Ubuntu 11.10.
After installation completed, the machine rebooted and now all I'm left with is a command prompt like this:
**`grub>`**
I was ex... | 2011/12/03 | [
"https://superuser.com/questions/364190",
"https://superuser.com",
"https://superuser.com/users/57008/"
] | A pipe takes the stdout from one process and connects it to the stdin of the next process; that doesn't make any sense for what you're trying to do (`ln` doesn't do anything with stdin).
You probably want something like this (untested):
```
find `pwd` -name "*.php" -execdir ln -s {} /home/frankv/www/bietroboter.de/sy... | You can also use xargs to execute commands from standard input:
`find` pwd `-name "*.php" | xargs ln -s -t /home/frankv/www/bietroboter.de/symlinks` |
1,698,042 | I have a Data View Web Part, on a custom edit Page for a list. I want to grab the current URL and pass it to the next page, so I can return to the editing screen.
I have followed these instructions to display the current page URL:
<http://www.stevesofian.net/post/XSLT-Tip-Get-Current-Page-URL.aspx>
Inside of Sharepoi... | 2009/11/08 | [
"https://Stackoverflow.com/questions/1698042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55486/"
] | The `struct` module converts packed data to Python values, and vice-versa.
```
>>> import struct
>>> struct.unpack("<h", "\x00\x05")
(1280,)
>>> struct.unpack("<h", "\x00\x06")
(1536,)
>>> struct.unpack("<h", "\x01\x06")
(1537,)
```
"h" means a short int, or 16-bit int. "<" means use little-endian. | [`struct`](http://docs.python.org/library/struct.html) is fine if you have to convert one or a small number of 2-byte strings to integers, but [`array`](http://docs.python.org/library/array.html?highlight=array#module-array) and `numpy` itself are better options. Specifically, [numpy.fromstring](http://docs.scipy.org/d... |
1,698,042 | I have a Data View Web Part, on a custom edit Page for a list. I want to grab the current URL and pass it to the next page, so I can return to the editing screen.
I have followed these instructions to display the current page URL:
<http://www.stevesofian.net/post/XSLT-Tip-Get-Current-Page-URL.aspx>
Inside of Sharepoi... | 2009/11/08 | [
"https://Stackoverflow.com/questions/1698042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55486/"
] | The `struct` module converts packed data to Python values, and vice-versa.
```
>>> import struct
>>> struct.unpack("<h", "\x00\x05")
(1280,)
>>> struct.unpack("<h", "\x00\x06")
(1536,)
>>> struct.unpack("<h", "\x01\x06")
(1537,)
```
"h" means a short int, or 16-bit int. "<" means use little-endian. | [Kevin Burke's answer](https://stackoverflow.com/a/1698048/8008041) to this question works great when your binary string represents a single short integer, but if your string holds binary data representing multiple integers, you will need to add an additional 'h' for each additional integer that the string represents. ... |
1,698,042 | I have a Data View Web Part, on a custom edit Page for a list. I want to grab the current URL and pass it to the next page, so I can return to the editing screen.
I have followed these instructions to display the current page URL:
<http://www.stevesofian.net/post/XSLT-Tip-Get-Current-Page-URL.aspx>
Inside of Sharepoi... | 2009/11/08 | [
"https://Stackoverflow.com/questions/1698042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55486/"
] | The `struct` module converts packed data to Python values, and vice-versa.
```
>>> import struct
>>> struct.unpack("<h", "\x00\x05")
(1280,)
>>> struct.unpack("<h", "\x00\x06")
(1536,)
>>> struct.unpack("<h", "\x01\x06")
(1537,)
```
"h" means a short int, or 16-bit int. "<" means use little-endian. | ```py
int(value[::-1].hex(), 16)
```
By example:
```py
value = b'\xfd\xff\x00\x00\x00\x00\x00\x00'
print(int(value[::-1].hex(), 16))
65533
```
`[::-1]` invert the values (little endian), `.hex()` trabnsform to hex literal, `int(,16)` transform from hex literal to int base16. |
1,698,042 | I have a Data View Web Part, on a custom edit Page for a list. I want to grab the current URL and pass it to the next page, so I can return to the editing screen.
I have followed these instructions to display the current page URL:
<http://www.stevesofian.net/post/XSLT-Tip-Get-Current-Page-URL.aspx>
Inside of Sharepoi... | 2009/11/08 | [
"https://Stackoverflow.com/questions/1698042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55486/"
] | [`struct`](http://docs.python.org/library/struct.html) is fine if you have to convert one or a small number of 2-byte strings to integers, but [`array`](http://docs.python.org/library/array.html?highlight=array#module-array) and `numpy` itself are better options. Specifically, [numpy.fromstring](http://docs.scipy.org/d... | [Kevin Burke's answer](https://stackoverflow.com/a/1698048/8008041) to this question works great when your binary string represents a single short integer, but if your string holds binary data representing multiple integers, you will need to add an additional 'h' for each additional integer that the string represents. ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.