qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
62,917,093
I have the following piece of code which joins two tables and prints in a 2D list ``` print("Resident:\tRoom:\t\tLast check-in:") print(' ') join = "SELECT users.name, users.room, attendance.clock_in FROM users JOIN attendance ON users.id = attendance.user_id" cursor.execute(join) output = cursor.fetchall() for x in r...
2020/07/15
[ "https://Stackoverflow.com/questions/62917093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13776195/" ]
``` join = "SELECT users.name, users.room, attendance.clock_in FROM users JOIN attendance ON users.id = attendance.user_id WHERE attendance.clock_in >= CURDATE() AND attendance.clock_in < CURDATE() + INTERVAL 1 DAY" ```
``` join = "SELECT users.name, users.room, attendance.clock_in FROM users " \ "JOIN attendance ON users.id = attendance.user_id " \ "WHERE attendance.clock_in >= CURDATE() " \ "AND attendance.clock_in < CURDATE() + INTERVAL 1 DAY" ```
39,798,158
okay good evening i been having problems recieving data from http request from a C++ program I use `Wininet` ``` InternetOpenA() InternetConnect() HttpOpenRequest() HttpSendRequest() ``` now the good news is it sends the program to the php file, now no worries all work fine there when i do a code like this to ...
2016/09/30
[ "https://Stackoverflow.com/questions/39798158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6084276/" ]
You can disable the button after it is clicked. Only issue is if you use ASP.Net MVC client-side validation, you want to disable it ***only after client-side validation is successful***. ***Otherwise, button will be disabled forever*** if user clicks on the button without entering anything. ``` @using (Html.BeginFo...
You can disable the button on click with jQuery like this: ``` $('#ButtonToTriggerId').click(function(){ $(this).prop('disabled',true)}); ``` But the correct is create a progress bar or a loading gif to "entretain" the user. If you are using JQuery ajax you can do like this: ``` $('#ButtonToTriggerId').click(funct...
13,736,837
I've recently installed a `mips-linux-gnu-gcc` crosstool in my linux machine which is based on i686. When I want to compile some codes, it showed me that error. Every installing step was followed by <http://developer.mips.com/tools/compilers/open-source-toolchain-linux/> After I installed the crosstool, I wrote a sim...
2012/12/06
[ "https://Stackoverflow.com/questions/13736837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1283768/" ]
The compiler you downloaded from MIPS is a 64-bit executable. Are you running a 32-bit host? If you need a cross compiler for a 32-bit host targeting MIPS GNU/Linux, consider using the Sourcery CodeBench Lite compiler for MIPS GNU/Linux targets: [Sourcery CodeBench Lite for MIPS GNU/Linux](http://www.mentor.com/embed...
It looks like the `mips-linux-gnu-gcc` binary does not match the architecture of the machine you are trying to run it on. This might be something like a 32/64 bit mismatch. Try using the free Mentor/Codesourcery MIPS gnu/gcc cross compilation tool chain instead. You can download from [here](http://www.mentor.com/embe...
42,700,888
A simple question: I used to have a Braintree SDK test access token. Now it's gone. When I try to generate a new one, I get this: > > You don't have any sandbox Business accounts in (AU, CA, GB, FR, IT, SG, JP, DE, US, IN, C2, HK) to generate Braintree SDK test access tokens. First, please create a sandbox Business a...
2017/03/09
[ "https://Stackoverflow.com/questions/42700888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/523247/" ]
I think their Sandbox may be broken right now. My two Sandbox accounts (buyer and facilitator) have disappeared from their system though I can still log in. Payments are also failing on my test application.
I started implementing a PayPal Checkout Workflow today and tried for several hours to create a sandbox account and app, so I could get REST API credentials. No luck until now. It looks like their backend is broken right now.
21,029,821
I want to use the `skewness()` and `kurtosis()` functions from the *e1071* package. I have tried downloading the `e1071` package with ``` install.packages("e1071", dep = TRUE) ``` but it still doesn't seem to work. So I am wondering if it is the wrong version I installed. I've tried searching the CRAN site but I c...
2014/01/09
[ "https://Stackoverflow.com/questions/21029821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3165084/" ]
You could try this: go to the <https://cran.r-project.org/web/packages/e1071/index.html> get the windows [Finding the windows binary file](http://i.stack.imgur.com/TaweP.jpg)binaries for the library and put it in your library folder within the R installation. Then load the library within R library(e1071) :)
This is how I did it for mac: 1) Download the binary - <https://CRAN.R-project.org/package=e1071> 2) Run R CMD INSTALL e1071\_version.tgz After this i tried to load the library but ran into the following problem. If you don't you can skip the step below. Error: package or namespace load failed for ‘e1071’ in dyn.load(...
21,029,821
I want to use the `skewness()` and `kurtosis()` functions from the *e1071* package. I have tried downloading the `e1071` package with ``` install.packages("e1071", dep = TRUE) ``` but it still doesn't seem to work. So I am wondering if it is the wrong version I installed. I've tried searching the CRAN site but I c...
2014/01/09
[ "https://Stackoverflow.com/questions/21029821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3165084/" ]
You could try this: go to the <https://cran.r-project.org/web/packages/e1071/index.html> get the windows [Finding the windows binary file](http://i.stack.imgur.com/TaweP.jpg)binaries for the library and put it in your library folder within the R installation. Then load the library within R library(e1071) :)
Well I did like this if you are using Rstudio go to packages in the right windows click on install write e1071 click install and it will work
21,029,821
I want to use the `skewness()` and `kurtosis()` functions from the *e1071* package. I have tried downloading the `e1071` package with ``` install.packages("e1071", dep = TRUE) ``` but it still doesn't seem to work. So I am wondering if it is the wrong version I installed. I've tried searching the CRAN site but I c...
2014/01/09
[ "https://Stackoverflow.com/questions/21029821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3165084/" ]
You could try this: go to the <https://cran.r-project.org/web/packages/e1071/index.html> get the windows [Finding the windows binary file](http://i.stack.imgur.com/TaweP.jpg)binaries for the library and put it in your library folder within the R installation. Then load the library within R library(e1071) :)
In R (for OSX) select `Packages & Data` -> `Package Installer` from the menu. If you haven't already select a Datacenter. Then you can search for the package and install it via `Install selected` [![Install selected screenshot](https://i.stack.imgur.com/FlP20.png)](https://i.stack.imgur.com/FlP20.png) Then you can us...
21,029,821
I want to use the `skewness()` and `kurtosis()` functions from the *e1071* package. I have tried downloading the `e1071` package with ``` install.packages("e1071", dep = TRUE) ``` but it still doesn't seem to work. So I am wondering if it is the wrong version I installed. I've tried searching the CRAN site but I c...
2014/01/09
[ "https://Stackoverflow.com/questions/21029821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3165084/" ]
Well I did like this if you are using Rstudio go to packages in the right windows click on install write e1071 click install and it will work
This is how I did it for mac: 1) Download the binary - <https://CRAN.R-project.org/package=e1071> 2) Run R CMD INSTALL e1071\_version.tgz After this i tried to load the library but ran into the following problem. If you don't you can skip the step below. Error: package or namespace load failed for ‘e1071’ in dyn.load(...
21,029,821
I want to use the `skewness()` and `kurtosis()` functions from the *e1071* package. I have tried downloading the `e1071` package with ``` install.packages("e1071", dep = TRUE) ``` but it still doesn't seem to work. So I am wondering if it is the wrong version I installed. I've tried searching the CRAN site but I c...
2014/01/09
[ "https://Stackoverflow.com/questions/21029821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3165084/" ]
In R (for OSX) select `Packages & Data` -> `Package Installer` from the menu. If you haven't already select a Datacenter. Then you can search for the package and install it via `Install selected` [![Install selected screenshot](https://i.stack.imgur.com/FlP20.png)](https://i.stack.imgur.com/FlP20.png) Then you can us...
This is how I did it for mac: 1) Download the binary - <https://CRAN.R-project.org/package=e1071> 2) Run R CMD INSTALL e1071\_version.tgz After this i tried to load the library but ran into the following problem. If you don't you can skip the step below. Error: package or namespace load failed for ‘e1071’ in dyn.load(...
48,343,928
I have the following two containers started but kafka says connection refused. `docker run zookeeper` and `docker run wurstmeister/kafka` I run it just like that and the connection is refused. In the logs it says: > > INFO Opening socket connection to server localhost/127.0.0.1:2181. > Will not attempt to authenti...
2018/01/19
[ "https://Stackoverflow.com/questions/48343928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4753897/" ]
Had the same issue. What helped was actualy: 1. Creating a bridge network: `docker network create -d bridge kafka-network` 2. Running a Zookeeper within this network: `docker run -d -p 2181:2181 --network kafka-network --name zookeeper zookeeper:latest` along with exposing port `2181` 3. Running a Kafka docker attachi...
Hi Drew you need to provide specific zookeeper docker container IP. Instead of localhost in Kafka configuration. You can get Docker IP by running > > docker ps > > > docker inspect > > > And you need to make sure that Docker containers are able to communicate with each other. Please refer the following <https...
48,343,928
I have the following two containers started but kafka says connection refused. `docker run zookeeper` and `docker run wurstmeister/kafka` I run it just like that and the connection is refused. In the logs it says: > > INFO Opening socket connection to server localhost/127.0.0.1:2181. > Will not attempt to authenti...
2018/01/19
[ "https://Stackoverflow.com/questions/48343928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4753897/" ]
Hi Drew you need to provide specific zookeeper docker container IP. Instead of localhost in Kafka configuration. You can get Docker IP by running > > docker ps > > > docker inspect > > > And you need to make sure that Docker containers are able to communicate with each other. Please refer the following <https...
This means the zookeeper is not running on the localhost ip(127.0.0.1). You need to explicitly get it via ``` docker inspect zookeeper --format='{{ .NetworkSettings.IPAddress }}' ``` The above command should give you the zoo-keeper's container IP which can be used to start the Kafka server. To Sum up, below comman...
48,343,928
I have the following two containers started but kafka says connection refused. `docker run zookeeper` and `docker run wurstmeister/kafka` I run it just like that and the connection is refused. In the logs it says: > > INFO Opening socket connection to server localhost/127.0.0.1:2181. > Will not attempt to authenti...
2018/01/19
[ "https://Stackoverflow.com/questions/48343928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4753897/" ]
Hi Drew you need to provide specific zookeeper docker container IP. Instead of localhost in Kafka configuration. You can get Docker IP by running > > docker ps > > > docker inspect > > > And you need to make sure that Docker containers are able to communicate with each other. Please refer the following <https...
Using the Docker 'host' network mode instead of the default 'bridge' mode might help, at least this is the working solution for my project. The 'host' network mode bypasses the IP issue by using the network stack of the Docker host directly instead of creating an isolated Docker network. As an example see: <https://gi...
48,343,928
I have the following two containers started but kafka says connection refused. `docker run zookeeper` and `docker run wurstmeister/kafka` I run it just like that and the connection is refused. In the logs it says: > > INFO Opening socket connection to server localhost/127.0.0.1:2181. > Will not attempt to authenti...
2018/01/19
[ "https://Stackoverflow.com/questions/48343928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4753897/" ]
Had the same issue. What helped was actualy: 1. Creating a bridge network: `docker network create -d bridge kafka-network` 2. Running a Zookeeper within this network: `docker run -d -p 2181:2181 --network kafka-network --name zookeeper zookeeper:latest` along with exposing port `2181` 3. Running a Kafka docker attachi...
This means the zookeeper is not running on the localhost ip(127.0.0.1). You need to explicitly get it via ``` docker inspect zookeeper --format='{{ .NetworkSettings.IPAddress }}' ``` The above command should give you the zoo-keeper's container IP which can be used to start the Kafka server. To Sum up, below comman...
48,343,928
I have the following two containers started but kafka says connection refused. `docker run zookeeper` and `docker run wurstmeister/kafka` I run it just like that and the connection is refused. In the logs it says: > > INFO Opening socket connection to server localhost/127.0.0.1:2181. > Will not attempt to authenti...
2018/01/19
[ "https://Stackoverflow.com/questions/48343928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4753897/" ]
Had the same issue. What helped was actualy: 1. Creating a bridge network: `docker network create -d bridge kafka-network` 2. Running a Zookeeper within this network: `docker run -d -p 2181:2181 --network kafka-network --name zookeeper zookeeper:latest` along with exposing port `2181` 3. Running a Kafka docker attachi...
Using the Docker 'host' network mode instead of the default 'bridge' mode might help, at least this is the working solution for my project. The 'host' network mode bypasses the IP issue by using the network stack of the Docker host directly instead of creating an isolated Docker network. As an example see: <https://gi...
63,844,432
My problem references to this issue here on github <https://github.com/mapstruct/mapstruct/issues/1427> I got at least two versions of mappers with the same name. I want to use springs getBean/Autowired possibilities but this doesn't work out of the mapstructs box yet. :-) I followed the second workaround mentioned i...
2020/09/11
[ "https://Stackoverflow.com/questions/63844432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11433112/" ]
As stated from Filip here <https://github.com/mapstruct/mapstruct/issues/1427> i followed his approach and with a few modifications it worked. I added a solution comment in the link. The main changes are: 1. i added `componentModel = "spring"` to my mappers and used a filter to exclude all of my mapper classes (the i...
I had this issue before, and I resolved it using the `Spring bean` definition in a configuration class, a class annotated with `@Configuration`, with the `Mapstruct` mapper call like below: ``` @Bean public IMyMapper offerWebMapper() { return Mappers.getMapper(IMyMapper.class); } ``` And then you can inject the ...
83,718
I want to change the photo aspect-ratio, of course without stretching the image, to print them on a fixed size screen. It is okay to leave two horizontal or vertical white bands around the image to achieve this, but I can only use the basic mac "preview" software to modify the images. Is there any way to do this?
2016/10/15
[ "https://photo.stackexchange.com/questions/83718", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/53504/" ]
If you look in the "Tools Menu" you'll see there's an "Adjust Size…" option. This does not do what you want, but it turns out you can use it to get what you need. You can do the following: 1. Open your image and choose "Select All" (Cmd-A) from the "Edit" menu 2. Choose "Copy" (Cmd-C) from the "Edit" menu 3. Choose "N...
why don't you download some other good software? <http://x.photoscape.org/mac/> - Photoscape is a good and handy software which helps in quick photo edits, resize, crop, etc. You don't have to go for conventional crude preview software.
54,054,063
I have this code: ``` {% set foto = 'photo_gallery/' ~ {{ image.id }} ~ '/' %} {% set thumbs = 'photo_gallery/thumbs/' ~ {{ image.id }} ~ '/' %} <img src="{{ pageTemplate.pageHeader.mainUrl }}{{ image.image |replace({foto: thumbs}) }}"> ``` This is give me error: ``` Fatal error: Uncaught Twig_Error_Syntax: A hash...
2019/01/05
[ "https://Stackoverflow.com/questions/54054063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10846403/" ]
One way to do it would be to use [`StringTokenizer`](https://docs.oracle.com/javase/10/docs/api/java/util/StringTokenizer.html). If you make the assumption that every output line must start with `123`, even if the input doesn't start with it, it could be: ``` String input = "123testes1233iambeginnerplshelp123 .."; Str...
A simple approach (without any dependencies) would look something like this, ``` class Test { public static void main (String[] args) throws java.lang.Exception { String a = "123testes1233iambeginnerplshelp123"; StringBuffer sb = new StringBuffer(); for (int i=0; i<a.length()-1; i++) {...
54,054,063
I have this code: ``` {% set foto = 'photo_gallery/' ~ {{ image.id }} ~ '/' %} {% set thumbs = 'photo_gallery/thumbs/' ~ {{ image.id }} ~ '/' %} <img src="{{ pageTemplate.pageHeader.mainUrl }}{{ image.image |replace({foto: thumbs}) }}"> ``` This is give me error: ``` Fatal error: Uncaught Twig_Error_Syntax: A hash...
2019/01/05
[ "https://Stackoverflow.com/questions/54054063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10846403/" ]
One way to do it would be to use [`StringTokenizer`](https://docs.oracle.com/javase/10/docs/api/java/util/StringTokenizer.html). If you make the assumption that every output line must start with `123`, even if the input doesn't start with it, it could be: ``` String input = "123testes1233iambeginnerplshelp123 .."; Str...
my solution ``` public StringSplitNum(){ String someString = "123testes1233iambeginnerplshelp123abc"; String regex = "((?<=[a-zA-Z])(?=[0-9]))|((?<=[0-9])(?=[a-zA-Z]))"; List arr = Arrays.asList(someString.split(regex)); for(int i=0; i< arr.size();i+=2){ System.out.println(arr.get(i)+ " " + arr.ge...
54,054,063
I have this code: ``` {% set foto = 'photo_gallery/' ~ {{ image.id }} ~ '/' %} {% set thumbs = 'photo_gallery/thumbs/' ~ {{ image.id }} ~ '/' %} <img src="{{ pageTemplate.pageHeader.mainUrl }}{{ image.image |replace({foto: thumbs}) }}"> ``` This is give me error: ``` Fatal error: Uncaught Twig_Error_Syntax: A hash...
2019/01/05
[ "https://Stackoverflow.com/questions/54054063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10846403/" ]
You can solve it using Regex. Everytime we are looking for patterns where number is followed by characters and if it is found, print it: ``` String text = "123testes1233stackoverflowwillsaveyou123dontworry"; String wordToFind = "\\d+[a-z]+"; Pattern word = Pattern.compile(wordToFind); M...
A simple approach (without any dependencies) would look something like this, ``` class Test { public static void main (String[] args) throws java.lang.Exception { String a = "123testes1233iambeginnerplshelp123"; StringBuffer sb = new StringBuffer(); for (int i=0; i<a.length()-1; i++) {...
54,054,063
I have this code: ``` {% set foto = 'photo_gallery/' ~ {{ image.id }} ~ '/' %} {% set thumbs = 'photo_gallery/thumbs/' ~ {{ image.id }} ~ '/' %} <img src="{{ pageTemplate.pageHeader.mainUrl }}{{ image.image |replace({foto: thumbs}) }}"> ``` This is give me error: ``` Fatal error: Uncaught Twig_Error_Syntax: A hash...
2019/01/05
[ "https://Stackoverflow.com/questions/54054063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10846403/" ]
You can solve it using Regex. Everytime we are looking for patterns where number is followed by characters and if it is found, print it: ``` String text = "123testes1233stackoverflowwillsaveyou123dontworry"; String wordToFind = "\\d+[a-z]+"; Pattern word = Pattern.compile(wordToFind); M...
my solution ``` public StringSplitNum(){ String someString = "123testes1233iambeginnerplshelp123abc"; String regex = "((?<=[a-zA-Z])(?=[0-9]))|((?<=[0-9])(?=[a-zA-Z]))"; List arr = Arrays.asList(someString.split(regex)); for(int i=0; i< arr.size();i+=2){ System.out.println(arr.get(i)+ " " + arr.ge...
54,054,063
I have this code: ``` {% set foto = 'photo_gallery/' ~ {{ image.id }} ~ '/' %} {% set thumbs = 'photo_gallery/thumbs/' ~ {{ image.id }} ~ '/' %} <img src="{{ pageTemplate.pageHeader.mainUrl }}{{ image.image |replace({foto: thumbs}) }}"> ``` This is give me error: ``` Fatal error: Uncaught Twig_Error_Syntax: A hash...
2019/01/05
[ "https://Stackoverflow.com/questions/54054063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10846403/" ]
A simple approach (without any dependencies) would look something like this, ``` class Test { public static void main (String[] args) throws java.lang.Exception { String a = "123testes1233iambeginnerplshelp123"; StringBuffer sb = new StringBuffer(); for (int i=0; i<a.length()-1; i++) {...
my solution ``` public StringSplitNum(){ String someString = "123testes1233iambeginnerplshelp123abc"; String regex = "((?<=[a-zA-Z])(?=[0-9]))|((?<=[0-9])(?=[a-zA-Z]))"; List arr = Arrays.asList(someString.split(regex)); for(int i=0; i< arr.size();i+=2){ System.out.println(arr.get(i)+ " " + arr.ge...
6,483,232
Oh my mac, whenever I start terminal I want to run a few commands, open another tab, cd into a certain dir, start a server on my local, and ssh into a remote server. How do I do this automatically? Thanks
2011/06/26
[ "https://Stackoverflow.com/questions/6483232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/663447/" ]
You could write a shell script that does all that. And if you don't want to manually input your password when logging on to the SSH server, then you can put your key on the remote server as an authorized key not needing the password (if configured correctly of course). [This page](http://lambie.org/2007/11/03/tabs-in-...
Have a look at [Terminitor](https://github.com/achiu/terminitor). It's focus is on setting up the terminal per-project but config can be saved in a single file and run at will. If this does not prove helpful, +1 for Applescript as mentioned by @netrom
6,483,232
Oh my mac, whenever I start terminal I want to run a few commands, open another tab, cd into a certain dir, start a server on my local, and ssh into a remote server. How do I do this automatically? Thanks
2011/06/26
[ "https://Stackoverflow.com/questions/6483232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/663447/" ]
You could write a shell script that does all that. And if you don't want to manually input your password when logging on to the SSH server, then you can put your key on the remote server as an authorized key not needing the password (if configured correctly of course). [This page](http://lambie.org/2007/11/03/tabs-in-...
Add the commands to your ~/.bashrc file and ensure it is runned each time you start the terminal: Preferences > Shell > Startup > Mark: Run command and type: source ~/bashrc
38,701,071
I have an API that returns data including a timestamp for that record. In swift I have the timestamp element loaded and converted into a double and can then convert that into time. I want to be able to return the time if the date of the record is today and return the date if the record is not today. See below: ``` ...
2016/08/01
[ "https://Stackoverflow.com/questions/38701071", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4484099/" ]
There is a handy function on NSCalendar that tells you whether an NSDate is in today or not (requires at least iOS 8) `isDateInToday()` To see it working, put this into a playground: ``` // Create a couple of unix dates. let timeIntervalToday: NSTimeInterval = NSDate().timeIntervalSince1970 let timeIntervalLastYear: ...
Abizern's answer in **Swift 3**: ``` import UIKit let timeIntervalToday: TimeInterval = Date().timeIntervalSince1970 let timeIntervalLastYear: TimeInterval = 1438435830 // This is just to show what the dates are. let now = Date(timeIntervalSince1970: timeIntervalToday) let then = Date(timeIntervalSince1970: timeInter...
35,400,074
I notice that in a lot of template engines, in the HTML5 , in various frameworks and in plain php sites there is the data-device-type="dedicated" added onto the `<HTML>` tag. Why is this done? Is there some sort of default browser behavior that reacts to this data-device-type? Why include it always? Does that not rend...
2016/02/15
[ "https://Stackoverflow.com/questions/35400074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3449042/" ]
`data-device-type` is not a HTML5 attribute. All attributes that a prefixed with `data-` are application-defined. The attribute's "real" name is then just `device-type`. Apparently `data-device-type`, `data-device-agent`, and others seem to be a convention that has been adopted by web developers recently - though I ca...
Global html **data-\*** attributes are used to store data (ready to be called later by css or javascript). Example: ```js var zzz = document.getElementsByTagName("div")[0].getAttribute("data-color"); var yyy = document.getElementsByTagName("div")[1].getAttribute("data-color"); document.getElementsByTagName("div")[...
21,904,609
Okay I have 15 variables $A - $O. I need a different way to compare the variables as I think I am doing this a really long way. It works the way I want it to but I'm not happy with the amount of code. So what my code is doing it's generating a random number for each of the variables. I have it doing this while they e...
2014/02/20
[ "https://Stackoverflow.com/questions/21904609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1859838/" ]
You could do this with an array: ``` $randoms = array(); while(count($randoms) < 15) { $randoms[] = mt_rand($min, $max);//add random $randoms = array_unique($randoms);//remove duplicates } $randoms = array_combine(range('a', 'o'), $randoms);//set keys a to o ``` And if you *really*, ***Really*** want those v...
In PHP you can use variables to access other variables by names in strings. For instance you can do something like that in your case: ``` $names = array('a','b','c','d'); // And so on - it can be done easier with casting to char function check_names_equal($names) { foreach($names as $name) { global $$nam...
21,904,609
Okay I have 15 variables $A - $O. I need a different way to compare the variables as I think I am doing this a really long way. It works the way I want it to but I'm not happy with the amount of code. So what my code is doing it's generating a random number for each of the variables. I have it doing this while they e...
2014/02/20
[ "https://Stackoverflow.com/questions/21904609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1859838/" ]
You could do this with an array: ``` $randoms = array(); while(count($randoms) < 15) { $randoms[] = mt_rand($min, $max);//add random $randoms = array_unique($randoms);//remove duplicates } $randoms = array_combine(range('a', 'o'), $randoms);//set keys a to o ``` And if you *really*, ***Really*** want those v...
try this ``` $min = 0; $min = 999; while (count($array) < 16){ $val = rand($min,$max); if (!in_array($val, $array)) { $array[] = $val; } } ```
21,904,609
Okay I have 15 variables $A - $O. I need a different way to compare the variables as I think I am doing this a really long way. It works the way I want it to but I'm not happy with the amount of code. So what my code is doing it's generating a random number for each of the variables. I have it doing this while they e...
2014/02/20
[ "https://Stackoverflow.com/questions/21904609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1859838/" ]
You could do this with an array: ``` $randoms = array(); while(count($randoms) < 15) { $randoms[] = mt_rand($min, $max);//add random $randoms = array_unique($randoms);//remove duplicates } $randoms = array_combine(range('a', 'o'), $randoms);//set keys a to o ``` And if you *really*, ***Really*** want those v...
The easiest way is to add the variables to an array and then perform your do-while as such: ``` $arr = array(&$a, &$b, &$c, &$d); do { foreach ($arr as $i => $k) $arr[$i] = rand($min, $max); } while (count($arr) == array_unique($arr)); ``` But in your example you are re-doing a lot of work that is not n...
21,904,609
Okay I have 15 variables $A - $O. I need a different way to compare the variables as I think I am doing this a really long way. It works the way I want it to but I'm not happy with the amount of code. So what my code is doing it's generating a random number for each of the variables. I have it doing this while they e...
2014/02/20
[ "https://Stackoverflow.com/questions/21904609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1859838/" ]
You could do this with an array: ``` $randoms = array(); while(count($randoms) < 15) { $randoms[] = mt_rand($min, $max);//add random $randoms = array_unique($randoms);//remove duplicates } $randoms = array_combine(range('a', 'o'), $randoms);//set keys a to o ``` And if you *really*, ***Really*** want those v...
Ahother option is to create an array and go growing it with random values comparing every new vaue with the existing ones: ``` $myvars=array(); while (sizeof($myvars)<15) { $success=false; do{ $candidate=rand($min,$max); //compare the candidate with every element in array if (!in_array...
579,452
In Dirac's Principles of QM following is stated: $$ \langle x | A + B | x \rangle = \langle x | A | x \rangle + \langle x | B |x \rangle $$ but $$ \langle x | AB | x \rangle \ne \langle x | A | x \rangle \langle x | B | x \rangle $$ and so $\langle x|A|x \rangle$ is not exact but average value of observable A other...
2020/09/13
[ "https://physics.stackexchange.com/questions/579452", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/135125/" ]
When submerged, the coin displaces as much water as it has volume (logical). When floating on the box, the coin displaces as much water as corresponds to its weight. As metal has a higher density than water, it means that the coin in the box displaces more water than when the coin is submerged.
I'm not an expert so please check if this makes sense. It seems like the "reason" for this is that when it's on the box, it's displacing water "using" the box. Since the box is less dense, the same weight occupies more space, so the weight of the coin gets amplified by the ratio of its specific weight to the box's spe...
579,452
In Dirac's Principles of QM following is stated: $$ \langle x | A + B | x \rangle = \langle x | A | x \rangle + \langle x | B |x \rangle $$ but $$ \langle x | AB | x \rangle \ne \langle x | A | x \rangle \langle x | B | x \rangle $$ and so $\langle x|A|x \rangle$ is not exact but average value of observable A other...
2020/09/13
[ "https://physics.stackexchange.com/questions/579452", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/135125/" ]
When submerged, the coin displaces as much water as it has volume (logical). When floating on the box, the coin displaces as much water as corresponds to its weight. As metal has a higher density than water, it means that the coin in the box displaces more water than when the coin is submerged.
The key is that the box can bob up and down. If both were completely submerged to begin with, then you'd be right: no rearranging of them underwater will cause some sort of strange change in displacement. But because the box is floating, so that *not all of it* is displacing water, the amount of water it displaces can ...
579,452
In Dirac's Principles of QM following is stated: $$ \langle x | A + B | x \rangle = \langle x | A | x \rangle + \langle x | B |x \rangle $$ but $$ \langle x | AB | x \rangle \ne \langle x | A | x \rangle \langle x | B | x \rangle $$ and so $\langle x|A|x \rangle$ is not exact but average value of observable A other...
2020/09/13
[ "https://physics.stackexchange.com/questions/579452", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/135125/" ]
When submerged, the coin displaces as much water as it has volume (logical). When floating on the box, the coin displaces as much water as corresponds to its weight. As metal has a higher density than water, it means that the coin in the box displaces more water than when the coin is submerged.
The coin is denser than water. When placed on the box, it will displace it's weight in water, which is more volume than the coin. When placed directly in the water it will sink to the bottom and displace only it's own volume in water, which will be less because it's denser. Another way to think about it is to have a p...
579,452
In Dirac's Principles of QM following is stated: $$ \langle x | A + B | x \rangle = \langle x | A | x \rangle + \langle x | B |x \rangle $$ but $$ \langle x | AB | x \rangle \ne \langle x | A | x \rangle \langle x | B | x \rangle $$ and so $\langle x|A|x \rangle$ is not exact but average value of observable A other...
2020/09/13
[ "https://physics.stackexchange.com/questions/579452", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/135125/" ]
When submerged, the coin displaces as much water as it has volume (logical). When floating on the box, the coin displaces as much water as corresponds to its weight. As metal has a higher density than water, it means that the coin in the box displaces more water than when the coin is submerged.
Based on the wording of your question as well as some of your comments, it seems as though you believe that the amount of liquid displaced by a submerged object is related to the weight of the object. It is not. If a coin is submerged in water, it will always displace the exact volume of water that is equivalent to it...
579,452
In Dirac's Principles of QM following is stated: $$ \langle x | A + B | x \rangle = \langle x | A | x \rangle + \langle x | B |x \rangle $$ but $$ \langle x | AB | x \rangle \ne \langle x | A | x \rangle \langle x | B | x \rangle $$ and so $\langle x|A|x \rangle$ is not exact but average value of observable A other...
2020/09/13
[ "https://physics.stackexchange.com/questions/579452", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/135125/" ]
The key is that the box can bob up and down. If both were completely submerged to begin with, then you'd be right: no rearranging of them underwater will cause some sort of strange change in displacement. But because the box is floating, so that *not all of it* is displacing water, the amount of water it displaces can ...
I'm not an expert so please check if this makes sense. It seems like the "reason" for this is that when it's on the box, it's displacing water "using" the box. Since the box is less dense, the same weight occupies more space, so the weight of the coin gets amplified by the ratio of its specific weight to the box's spe...
579,452
In Dirac's Principles of QM following is stated: $$ \langle x | A + B | x \rangle = \langle x | A | x \rangle + \langle x | B |x \rangle $$ but $$ \langle x | AB | x \rangle \ne \langle x | A | x \rangle \langle x | B | x \rangle $$ and so $\langle x|A|x \rangle$ is not exact but average value of observable A other...
2020/09/13
[ "https://physics.stackexchange.com/questions/579452", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/135125/" ]
The coin is denser than water. When placed on the box, it will displace it's weight in water, which is more volume than the coin. When placed directly in the water it will sink to the bottom and displace only it's own volume in water, which will be less because it's denser. Another way to think about it is to have a p...
I'm not an expert so please check if this makes sense. It seems like the "reason" for this is that when it's on the box, it's displacing water "using" the box. Since the box is less dense, the same weight occupies more space, so the weight of the coin gets amplified by the ratio of its specific weight to the box's spe...
579,452
In Dirac's Principles of QM following is stated: $$ \langle x | A + B | x \rangle = \langle x | A | x \rangle + \langle x | B |x \rangle $$ but $$ \langle x | AB | x \rangle \ne \langle x | A | x \rangle \langle x | B | x \rangle $$ and so $\langle x|A|x \rangle$ is not exact but average value of observable A other...
2020/09/13
[ "https://physics.stackexchange.com/questions/579452", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/135125/" ]
Based on the wording of your question as well as some of your comments, it seems as though you believe that the amount of liquid displaced by a submerged object is related to the weight of the object. It is not. If a coin is submerged in water, it will always displace the exact volume of water that is equivalent to it...
I'm not an expert so please check if this makes sense. It seems like the "reason" for this is that when it's on the box, it's displacing water "using" the box. Since the box is less dense, the same weight occupies more space, so the weight of the coin gets amplified by the ratio of its specific weight to the box's spe...
579,452
In Dirac's Principles of QM following is stated: $$ \langle x | A + B | x \rangle = \langle x | A | x \rangle + \langle x | B |x \rangle $$ but $$ \langle x | AB | x \rangle \ne \langle x | A | x \rangle \langle x | B | x \rangle $$ and so $\langle x|A|x \rangle$ is not exact but average value of observable A other...
2020/09/13
[ "https://physics.stackexchange.com/questions/579452", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/135125/" ]
The coin is denser than water. When placed on the box, it will displace it's weight in water, which is more volume than the coin. When placed directly in the water it will sink to the bottom and displace only it's own volume in water, which will be less because it's denser. Another way to think about it is to have a p...
The key is that the box can bob up and down. If both were completely submerged to begin with, then you'd be right: no rearranging of them underwater will cause some sort of strange change in displacement. But because the box is floating, so that *not all of it* is displacing water, the amount of water it displaces can ...
579,452
In Dirac's Principles of QM following is stated: $$ \langle x | A + B | x \rangle = \langle x | A | x \rangle + \langle x | B |x \rangle $$ but $$ \langle x | AB | x \rangle \ne \langle x | A | x \rangle \langle x | B | x \rangle $$ and so $\langle x|A|x \rangle$ is not exact but average value of observable A other...
2020/09/13
[ "https://physics.stackexchange.com/questions/579452", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/135125/" ]
The coin is denser than water. When placed on the box, it will displace it's weight in water, which is more volume than the coin. When placed directly in the water it will sink to the bottom and displace only it's own volume in water, which will be less because it's denser. Another way to think about it is to have a p...
Based on the wording of your question as well as some of your comments, it seems as though you believe that the amount of liquid displaced by a submerged object is related to the weight of the object. It is not. If a coin is submerged in water, it will always displace the exact volume of water that is equivalent to it...
64,162,805
So I've seen this question asked many times but I have not found an answer to my issue. I'm using phpmyadmin, I have 1 table with 2 columns and I have a .csv with 2 columns. My csv does not have headers and my columns are separated by ";", already changed it in phpmyadmin to "Columns separated with ;", but I still got ...
2020/10/01
[ "https://Stackoverflow.com/questions/64162805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11745254/" ]
As it says in the manual > > When importing data into a table from a CSV file where the table has an ‘auto\_increment’ field, make the ‘auto\_increment’ value for each record in the CSV field to be ‘0’ (zero). This allows the ‘auto\_increment’ field to populate correctly. > > > see <https://docs.phpmyadmin.net/en...
So, what worked for me was: I exported the table as an csv and worked over that. After I was done, I imported this modified csv and it worked. It must've been what [nbk](https://stackoverflow.com/users/5193536/nbk) said about termination, so I guess in a way that was the answer
149,900
The Antequera-Granada high speed line [opened 2019-06-26](https://www.railwaygazette.com/europe/granada-joins-the-ave-network/48776.article). When I search for tickets on the [RENFE website](http://www.renfe.com/), I find tickets up to and including 2019-12-15 for trains Granada-Madrid and Granada-Barcelona, but none a...
2019/11/19
[ "https://travel.stackexchange.com/questions/149900", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/2509/" ]
Yes it is. I contacted privately the Renfe official account in Twitter ([@Renfe](https://twitter.com/Renfe)) and they replied: > > Los billetes Madrid-Granada y Barcelona-Granada, a partir del 15 de diciembre, se pondrán a la venta en los próximos días. > > > That is: > > Madrid-Granada and Barcelona-Granada ti...
Tickets became available 2019-11-21 (Thursday), 24 days in advance. Thanks RENFE! `</s>`
8,590,055
I would like to ask, I have a window called `MainWindow` and another one called `ImportForm`. In the `MainWindow` i call ``` private void generate_Window(int num_chart) { Window ownedWindow = new ImportForm(num_chart); ownedWindow.Owner = this; ownedWindow.Show(); } ``` In the child window i m...
2011/12/21
[ "https://Stackoverflow.com/questions/8590055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1109843/" ]
It seems like an awkward design choice. Anyways, here is how you can do it: MainWindow.cs: ``` private void generate_Window(int num_chart) { Window ownedWindow = new ImportForm(num_chart, import_chart); ownedWindow.Owner = this; ownedWindow.Show(); } private void import_chart(int n, string s, bool b) {...
How about adding an event to your ImportForm "ImportFinished" where you pass in your values as the eventargs. This event is fired in the Close or Closing event of the ImportForm and handled in your MainWindow. You could also show the ImportForm as a Modal dialog and read the values when the ShowDialog method returns.
8,590,055
I would like to ask, I have a window called `MainWindow` and another one called `ImportForm`. In the `MainWindow` i call ``` private void generate_Window(int num_chart) { Window ownedWindow = new ImportForm(num_chart); ownedWindow.Owner = this; ownedWindow.Show(); } ``` In the child window i m...
2011/12/21
[ "https://Stackoverflow.com/questions/8590055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1109843/" ]
It seems like an awkward design choice. Anyways, here is how you can do it: MainWindow.cs: ``` private void generate_Window(int num_chart) { Window ownedWindow = new ImportForm(num_chart, import_chart); ownedWindow.Owner = this; ownedWindow.Show(); } private void import_chart(int n, string s, bool b) {...
A simple way to do this is to make `var1`, `var2`, and `var3` instance variables that are visible in the scope of the parent (e.g. make them `public`), and then in the `MainWindow`, attach to the `Closed` event, and read the variables from `(ImportForm)sender`.
8,590,055
I would like to ask, I have a window called `MainWindow` and another one called `ImportForm`. In the `MainWindow` i call ``` private void generate_Window(int num_chart) { Window ownedWindow = new ImportForm(num_chart); ownedWindow.Owner = this; ownedWindow.Show(); } ``` In the child window i m...
2011/12/21
[ "https://Stackoverflow.com/questions/8590055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1109843/" ]
It seems like an awkward design choice. Anyways, here is how you can do it: MainWindow.cs: ``` private void generate_Window(int num_chart) { Window ownedWindow = new ImportForm(num_chart, import_chart); ownedWindow.Owner = this; ownedWindow.Show(); } private void import_chart(int n, string s, bool b) {...
I have an example from my own code. It's generic and obvious enough that I can share it here. I've done something along these lines. ``` /// <summary> /// Show an InputBox similar to the pre-.NET InputBox functionality. Returns the original value when Cancel was pressed. /// </summary> /// <param name...
23,379,415
Consider the following short program. ``` #include <string> int main(){ std::string hello("HelloWorld"); std::string& helloRef(hello); // "line 2" std::string& hello3 = hello; // "line 3" } ``` Are line 2 and line 3 equivalent? * If so, can someone please provide documentation on the li...
2014/04/30
[ "https://Stackoverflow.com/questions/23379415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/391161/" ]
Yes, helloRef and hello3 will both be references to the hello string object. This is called reference initialization. Typically you would use the = operator here. You would use the 2nd line's form in the constructor initialization list of a class, like this: ``` class c { public: c() : hello("HelloWorld"), ...
``` #include <string> int main(){ std::string hello("HelloWorld"); std::string& helloRef(hello); std::string& hello3 = hello; } ``` In the above code, by line number 1, invokes single parameter constructor in predefined string class and creates the object hello by initializing the string "HelloWorld". By line numb...
21,335,297
I have a Windows Media Player-Compononent. I want it to fill the whole form except a line at the bottom for some buttons and Text. So Dock-> Fill minus the part at the bottom but when resized, the part at the bottom should resize to left and right but stay at the bottom and the Windows Media Player-Compononent should r...
2014/01/24
[ "https://Stackoverflow.com/questions/21335297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3105934/" ]
Add a panel set its dock to `Bottom`, then add a Media(whatever) component set its dock to `Fill`. You're done.
You don't need any additional Panels or SplitContainers. Problem can be solved with proper docking and anchoring. Place your control on form and resize it so that line at the bottom will stay (you can easily do it by setting dock to top). Then set all [anchors](http://msdn.microsoft.com/en-us/library/system.windows.for...
21,335,297
I have a Windows Media Player-Compononent. I want it to fill the whole form except a line at the bottom for some buttons and Text. So Dock-> Fill minus the part at the bottom but when resized, the part at the bottom should resize to left and right but stay at the bottom and the Windows Media Player-Compononent should r...
2014/01/24
[ "https://Stackoverflow.com/questions/21335297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3105934/" ]
Add a panel set its dock to `Bottom`, then add a Media(whatever) component set its dock to `Fill`. You're done.
For anyone else having this issue: I had 2 panels stacked `panel1` was fill, `panel2` was bottom docked. It looked like it worked but text would appear off `panel1` down under `panel2`. I fixed this with the [padding property](https://msdn.microsoft.com/en-us/library/ms229627(v=vs.110).aspx). I added `20 padding` to...
21,335,297
I have a Windows Media Player-Compononent. I want it to fill the whole form except a line at the bottom for some buttons and Text. So Dock-> Fill minus the part at the bottom but when resized, the part at the bottom should resize to left and right but stay at the bottom and the Windows Media Player-Compononent should r...
2014/01/24
[ "https://Stackoverflow.com/questions/21335297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3105934/" ]
You don't need any additional Panels or SplitContainers. Problem can be solved with proper docking and anchoring. Place your control on form and resize it so that line at the bottom will stay (you can easily do it by setting dock to top). Then set all [anchors](http://msdn.microsoft.com/en-us/library/system.windows.for...
For anyone else having this issue: I had 2 panels stacked `panel1` was fill, `panel2` was bottom docked. It looked like it worked but text would appear off `panel1` down under `panel2`. I fixed this with the [padding property](https://msdn.microsoft.com/en-us/library/ms229627(v=vs.110).aspx). I added `20 padding` to...
38,064,302
I have the following controller concern that is used for authentication: ``` module ValidateEventRequest extend ActiveSupport::Concern def event_request_verified?(request) sha256 = OpenSSL::Digest::SHA256.new secret = app_client_id body = request.body.read signature = OpenSSL::HMAC.hexdigest(sha25...
2016/06/27
[ "https://Stackoverflow.com/questions/38064302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161869/" ]
you can create a EVENT that running every minute and delete old records like this: **enable scheduler** ``` SET GLOBAL event_scheduler = ON; ``` **create EVENT runs every minute** ``` CREATE EVENT cleanup ON SCHEDULE EVERY 1 MINUTE DO DELETE FROM yourTable WHERE unix_time < UNIX_TIMESTAMP(); ``` **Sample**...
You *could* create a view, something like this: ``` create view v_table as select (case when unix_time < UNIX_TIMESTAMP() then id end) as id, (case when unix_time < UNIX_TIMESTAMP() then user_id end) as user_id from banned; ``` Or: ``` create view v_table as select b.* from banned b ...
14,329,794
How can I find out the number of Bytes a certain integer number takes up to store? E.g. for * hexadecimal `\x00` - `\xff` (or decimal `0` - `255` = binary `0000 0000` - `1111 1111`) I'm looking to get 1 (Byte), * hexadecimal `\x100` - `\xffff` (or decimal `256` - `65535` = binary `0000 0001 0000 0000` - `1111 1111 11...
2013/01/15
[ "https://Stackoverflow.com/questions/14329794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1198201/" ]
on python command prompt, you can use size of function ``` **$ import python $ import ctypes $ ctypes.sizeof(ctypes.c_int)** ```
``` # Python 3 import math nbr = 0xff # 255 defined in hexadecimal nbr = "{0:b}".format(nbr) # Transform the number into a string formated as bytes. bit_length = len(nbr) # Number of characters byte_length = math.ceil( bit_length/8 ) # Get minimum number of bytes ```
14,329,794
How can I find out the number of Bytes a certain integer number takes up to store? E.g. for * hexadecimal `\x00` - `\xff` (or decimal `0` - `255` = binary `0000 0000` - `1111 1111`) I'm looking to get 1 (Byte), * hexadecimal `\x100` - `\xffff` (or decimal `256` - `65535` = binary `0000 0001 0000 0000` - `1111 1111 11...
2013/01/15
[ "https://Stackoverflow.com/questions/14329794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1198201/" ]
Unless you're dealing with an `array.array` or a `numpy.array` - the size always has object overhead. And since Python deals with BigInts naturally, it's really, really hard to tell... ``` >>> i = 5 >>> import sys >>> sys.getsizeof(i) 24 ``` So on a 64bit platform it requires 24 bytes to store what could be stored i...
By using a simple biwise operation to move all the used bits over 1 byte each time you can see how many bytes are needed to store a number. It's probably worth noting that while this method is very generic, it will not work on negative numbers and only looks at the binary of the variable without taking into account wh...
14,329,794
How can I find out the number of Bytes a certain integer number takes up to store? E.g. for * hexadecimal `\x00` - `\xff` (or decimal `0` - `255` = binary `0000 0000` - `1111 1111`) I'm looking to get 1 (Byte), * hexadecimal `\x100` - `\xffff` (or decimal `256` - `65535` = binary `0000 0001 0000 0000` - `1111 1111 11...
2013/01/15
[ "https://Stackoverflow.com/questions/14329794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1198201/" ]
By using a simple biwise operation to move all the used bits over 1 byte each time you can see how many bytes are needed to store a number. It's probably worth noting that while this method is very generic, it will not work on negative numbers and only looks at the binary of the variable without taking into account wh...
``` # Python 3 import math nbr = 0xff # 255 defined in hexadecimal nbr = "{0:b}".format(nbr) # Transform the number into a string formated as bytes. bit_length = len(nbr) # Number of characters byte_length = math.ceil( bit_length/8 ) # Get minimum number of bytes ```
14,329,794
How can I find out the number of Bytes a certain integer number takes up to store? E.g. for * hexadecimal `\x00` - `\xff` (or decimal `0` - `255` = binary `0000 0000` - `1111 1111`) I'm looking to get 1 (Byte), * hexadecimal `\x100` - `\xffff` (or decimal `256` - `65535` = binary `0000 0001 0000 0000` - `1111 1111 11...
2013/01/15
[ "https://Stackoverflow.com/questions/14329794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1198201/" ]
You can use simple math: ``` >>> from math import log >>> def bytes_needed(n): ... if n == 0: ... return 1 ... return int(log(n, 256)) + 1 ... >>> bytes_needed(0x01) 1 >>> bytes_needed(0x100) 2 >>> bytes_needed(0x10000) 3 ```
``` # Python 3 import math nbr = 0xff # 255 defined in hexadecimal nbr = "{0:b}".format(nbr) # Transform the number into a string formated as bytes. bit_length = len(nbr) # Number of characters byte_length = math.ceil( bit_length/8 ) # Get minimum number of bytes ```
14,329,794
How can I find out the number of Bytes a certain integer number takes up to store? E.g. for * hexadecimal `\x00` - `\xff` (or decimal `0` - `255` = binary `0000 0000` - `1111 1111`) I'm looking to get 1 (Byte), * hexadecimal `\x100` - `\xffff` (or decimal `256` - `65535` = binary `0000 0001 0000 0000` - `1111 1111 11...
2013/01/15
[ "https://Stackoverflow.com/questions/14329794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1198201/" ]
Unless you're dealing with an `array.array` or a `numpy.array` - the size always has object overhead. And since Python deals with BigInts naturally, it's really, really hard to tell... ``` >>> i = 5 >>> import sys >>> sys.getsizeof(i) 24 ``` So on a 64bit platform it requires 24 bytes to store what could be stored i...
``` # Python 3 import math nbr = 0xff # 255 defined in hexadecimal nbr = "{0:b}".format(nbr) # Transform the number into a string formated as bytes. bit_length = len(nbr) # Number of characters byte_length = math.ceil( bit_length/8 ) # Get minimum number of bytes ```
14,329,794
How can I find out the number of Bytes a certain integer number takes up to store? E.g. for * hexadecimal `\x00` - `\xff` (or decimal `0` - `255` = binary `0000 0000` - `1111 1111`) I'm looking to get 1 (Byte), * hexadecimal `\x100` - `\xffff` (or decimal `256` - `65535` = binary `0000 0001 0000 0000` - `1111 1111 11...
2013/01/15
[ "https://Stackoverflow.com/questions/14329794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1198201/" ]
Unless you're dealing with an `array.array` or a `numpy.array` - the size always has object overhead. And since Python deals with BigInts naturally, it's really, really hard to tell... ``` >>> i = 5 >>> import sys >>> sys.getsizeof(i) 24 ``` So on a 64bit platform it requires 24 bytes to store what could be stored i...
on python command prompt, you can use size of function ``` **$ import python $ import ctypes $ ctypes.sizeof(ctypes.c_int)** ```
14,329,794
How can I find out the number of Bytes a certain integer number takes up to store? E.g. for * hexadecimal `\x00` - `\xff` (or decimal `0` - `255` = binary `0000 0000` - `1111 1111`) I'm looking to get 1 (Byte), * hexadecimal `\x100` - `\xffff` (or decimal `256` - `65535` = binary `0000 0001 0000 0000` - `1111 1111 11...
2013/01/15
[ "https://Stackoverflow.com/questions/14329794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1198201/" ]
``` def byte_length(i): return (i.bit_length() + 7) // 8 ``` Of course, as Jon Clements points out, this isn't the size of the actual `PyIntObject`, which has a PyObject header, and stores the value as a bignum in whatever way is easiest to deal with rather than most compact, and which you have to have at least o...
By using a simple biwise operation to move all the used bits over 1 byte each time you can see how many bytes are needed to store a number. It's probably worth noting that while this method is very generic, it will not work on negative numbers and only looks at the binary of the variable without taking into account wh...
14,329,794
How can I find out the number of Bytes a certain integer number takes up to store? E.g. for * hexadecimal `\x00` - `\xff` (or decimal `0` - `255` = binary `0000 0000` - `1111 1111`) I'm looking to get 1 (Byte), * hexadecimal `\x100` - `\xffff` (or decimal `256` - `65535` = binary `0000 0001 0000 0000` - `1111 1111 11...
2013/01/15
[ "https://Stackoverflow.com/questions/14329794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1198201/" ]
``` def byte_length(i): return (i.bit_length() + 7) // 8 ``` Of course, as Jon Clements points out, this isn't the size of the actual `PyIntObject`, which has a PyObject header, and stores the value as a bignum in whatever way is easiest to deal with rather than most compact, and which you have to have at least o...
on python command prompt, you can use size of function ``` **$ import python $ import ctypes $ ctypes.sizeof(ctypes.c_int)** ```
14,329,794
How can I find out the number of Bytes a certain integer number takes up to store? E.g. for * hexadecimal `\x00` - `\xff` (or decimal `0` - `255` = binary `0000 0000` - `1111 1111`) I'm looking to get 1 (Byte), * hexadecimal `\x100` - `\xffff` (or decimal `256` - `65535` = binary `0000 0001 0000 0000` - `1111 1111 11...
2013/01/15
[ "https://Stackoverflow.com/questions/14329794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1198201/" ]
``` def byte_length(i): return (i.bit_length() + 7) // 8 ``` Of course, as Jon Clements points out, this isn't the size of the actual `PyIntObject`, which has a PyObject header, and stores the value as a bignum in whatever way is easiest to deal with rather than most compact, and which you have to have at least o...
``` # Python 3 import math nbr = 0xff # 255 defined in hexadecimal nbr = "{0:b}".format(nbr) # Transform the number into a string formated as bytes. bit_length = len(nbr) # Number of characters byte_length = math.ceil( bit_length/8 ) # Get minimum number of bytes ```
14,329,794
How can I find out the number of Bytes a certain integer number takes up to store? E.g. for * hexadecimal `\x00` - `\xff` (or decimal `0` - `255` = binary `0000 0000` - `1111 1111`) I'm looking to get 1 (Byte), * hexadecimal `\x100` - `\xffff` (or decimal `256` - `65535` = binary `0000 0001 0000 0000` - `1111 1111 11...
2013/01/15
[ "https://Stackoverflow.com/questions/14329794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1198201/" ]
You can use simple math: ``` >>> from math import log >>> def bytes_needed(n): ... if n == 0: ... return 1 ... return int(log(n, 256)) + 1 ... >>> bytes_needed(0x01) 1 >>> bytes_needed(0x100) 2 >>> bytes_needed(0x10000) 3 ```
on python command prompt, you can use size of function ``` **$ import python $ import ctypes $ ctypes.sizeof(ctypes.c_int)** ```
14,897
I have a bash\_file that operates on a latex file to produce a pdf. ``` #!/bin/bash /usr/bin/pandoc/ filein.md -t beamer -o fileout.md ; /usr/bin/pdflatex/ fileother.tex ; /usr/bin/evince fileother.tex ``` If I execute in normal mode ``` ! ./bash_file.sh ``` it works fine but I cannnot work in vim while I am view...
2018/01/21
[ "https://vi.stackexchange.com/questions/14897", "https://vi.stackexchange.com", "https://vi.stackexchange.com/users/11895/" ]
If you start vim in a folder which contains the file `foo.sh` with the following content: ``` #!/bin/bash echo "Output of the bash script" ``` You can open a new buffer (`:enew` for example) and execute the script and get it's output in this new buffer with the following command: ``` :read ! ./foo.sh ``` Your ne...
Before you execute your command, run ``` :term ``` This will open a shell in a buffer window. You can then run commands there, and then while those commands are running ^W back to a normal window. This does, admittedly, make it a little annoying to send CTRL-W to that window; you need to press a period after your CT...
548,275
I am reading a text on data mining. I came across this formula, but I do not understand how to apply it. There aren't any examples following the forumla and my research online has produced very few results. Can someone explain how to apply this formula? [![enter image description here](https://i.stack.imgur.com/wN5qs.p...
2021/10/14
[ "https://stats.stackexchange.com/questions/548275", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/337826/" ]
Let's suppose we have three groups ``` 0-20000 20 20000-39999 60 40000- 20 ``` where the second column is frequency, and also percent. The median must be within the second group as $20\%$ are less and $20\%$ are more. Then the recipe gives $20000 + [(50 - 20) / 60] \times 20000$ which is $20000 +...
You have binned data, $k$-th bin contains $freq\_k$ points, and has some width $width\_k = U\_k - L\_k$ where $L\_k$ is the lower bound for the interval, and $U\_k$ is the upper bound (e.g. "\$10-20,000"). * Median is located at the $N/2$ point (median is a middle value of a sorted list of values). * $\sum(freq)$ is t...
19,332,137
how can i query all records in mysql where field is not empty or null? such as bellow, some products\_name is empty ,and some is null , how to get other has values records? ![enter image description here](https://i.stack.imgur.com/1LkXW.png) ``` -- ---------------------------- -- Table structure for `a` -- ----------...
2013/10/12
[ "https://Stackoverflow.com/questions/19332137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2364534/" ]
The list multiplication does not clone (or create new) objects, but simply references the same (in your case mutable) object various times. See here: ``` a = [[3]*3]*3 print(a) a[0][1] = 1 print(a) ```
`grid = [[[0]*9]*9]*50` does not create 50 of 9x9 grid. When you state `[[[0]*9]*9]*50`, python creates 9 reference of `[0]`. List multiplication only creates new references of the same object, in other words, every single list you made refer to the same place in the memory, used to store the `[0]` list. [A similiar ...
4,847,892
Frankly I am a newbie in both C# and Asp.net MVC. I also do not know how the asp.net web application actually works on IIS and ASP.NET framework behind the scene. I am confused with the decision where I have to declare a field of DbContext (or any class derived from DbContext) in my asp.net mvc application. I have tw...
2011/01/31
[ "https://Stackoverflow.com/questions/4847892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/596314/" ]
If you make it a static field in global.asax, you will run into concurrency problems. Multiple threads from multiple requests can come in and get each other's data. What's worse is that this will not show up until you start getting more traffic on your website, or until you start load testing. You'll implement it as a ...
You should go with the second option. ie declare and use it in the controller. If you put the DBContext as a static field in global.asax, you are basically making it a single instance for the entire application. On the other hand, with the second option you have a DBcontext for each request. It would be better if you ...
62,847,943
I am trying to position my RecyclerView so that it is below my AppBarLayout, however the layout\_below attribute is not being recognised by android studio? It does not show in the auto-complete. ``` <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns...
2020/07/11
[ "https://Stackoverflow.com/questions/62847943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12833718/" ]
The problem lies in this `StringUtils.isEmpty()` method itself because sometime [TextUtils.isEmpty(null) returns false](https://stackoverflow.com/questions/39862072/textutils-isemptynull-returns-false) at that time you are passing `value` as `null` then you are invoking `trim()` method on the `null` value that is causi...
Maybe instead of: `value.trim().isEmpty()` try this: `value.trim().equals("")`
62,847,943
I am trying to position my RecyclerView so that it is below my AppBarLayout, however the layout\_below attribute is not being recognised by android studio? It does not show in the auto-complete. ``` <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns...
2020/07/11
[ "https://Stackoverflow.com/questions/62847943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12833718/" ]
As you know, `||` operator will invoke the code on both sides (to get one true value) and `null.trim()..` will cause the exception. Since the expected behavior of `StringUtils.isEmpty` method is to throw an exception when a `null` value is being passed so you should write the unit test to expect an exception with `nul...
Maybe instead of: `value.trim().isEmpty()` try this: `value.trim().equals("")`
62,847,943
I am trying to position my RecyclerView so that it is below my AppBarLayout, however the layout\_below attribute is not being recognised by android studio? It does not show in the auto-complete. ``` <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns...
2020/07/11
[ "https://Stackoverflow.com/questions/62847943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12833718/" ]
**The complete solution, I have got-** Due to default values set in app/build.gradle, I was getting false returned from `TextUtils.isEmpty()` which was not expected by me. ``` testOptions { unitTests.returnDefaultValues = true } ``` **Reference -** [TextUtils.isEmpty(null) returns false](https://stackoverflow...
Maybe instead of: `value.trim().isEmpty()` try this: `value.trim().equals("")`
62,847,943
I am trying to position my RecyclerView so that it is below my AppBarLayout, however the layout\_below attribute is not being recognised by android studio? It does not show in the auto-complete. ``` <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns...
2020/07/11
[ "https://Stackoverflow.com/questions/62847943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12833718/" ]
The problem lies in this `StringUtils.isEmpty()` method itself because sometime [TextUtils.isEmpty(null) returns false](https://stackoverflow.com/questions/39862072/textutils-isemptynull-returns-false) at that time you are passing `value` as `null` then you are invoking `trim()` method on the `null` value that is causi...
As you know, `||` operator will invoke the code on both sides (to get one true value) and `null.trim()..` will cause the exception. Since the expected behavior of `StringUtils.isEmpty` method is to throw an exception when a `null` value is being passed so you should write the unit test to expect an exception with `nul...
62,847,943
I am trying to position my RecyclerView so that it is below my AppBarLayout, however the layout\_below attribute is not being recognised by android studio? It does not show in the auto-complete. ``` <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns...
2020/07/11
[ "https://Stackoverflow.com/questions/62847943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12833718/" ]
The problem lies in this `StringUtils.isEmpty()` method itself because sometime [TextUtils.isEmpty(null) returns false](https://stackoverflow.com/questions/39862072/textutils-isemptynull-returns-false) at that time you are passing `value` as `null` then you are invoking `trim()` method on the `null` value that is causi...
**The complete solution, I have got-** Due to default values set in app/build.gradle, I was getting false returned from `TextUtils.isEmpty()` which was not expected by me. ``` testOptions { unitTests.returnDefaultValues = true } ``` **Reference -** [TextUtils.isEmpty(null) returns false](https://stackoverflow...
198,776
Does anyone know how to create a iTunes Playlist that shows only songs in My Library which are part of a complete album in My Library. Essentially I want to see all my complete albums. You can in Spotify but with Apple Music every song you add to a playlist it assumes you want it added to My Library.
2015/08/04
[ "https://apple.stackexchange.com/questions/198776", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/6342/" ]
There is no way to automate this functionality in iTunes today. To do so, the system would need to know how many songs were in each album and that isn't immediately available. Plus, what if you have an album with twelve songs and you only have eleven, but you still want it in the list. Or what about singles that have o...
Apple has released a fix for this. In Settings>Music it lets you toggle between showing playlist songs in library or not.
198,776
Does anyone know how to create a iTunes Playlist that shows only songs in My Library which are part of a complete album in My Library. Essentially I want to see all my complete albums. You can in Spotify but with Apple Music every song you add to a playlist it assumes you want it added to My Library.
2015/08/04
[ "https://apple.stackexchange.com/questions/198776", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/6342/" ]
I don't have a full answer for this, but I eliminated about 200 songs from my latest Smart Playlist (e.g., 2017 songs) by adding criteria of Album does not contain text "Single". There's unfortunately no filter for "of" field for total count of tracks, because then you could filter out anything where this is set to 1 (...
Apple has released a fix for this. In Settings>Music it lets you toggle between showing playlist songs in library or not.
69,044,308
I'm learning to use Android Jetpack Compose. Now I have a **Regular.otf** font file in **assets/font**. I want to use it in Text. ``` java.lang.RuntimeException: Font asset not found /commonui/src/main/assets/font/Regular.otf at android.graphics.Typeface.createFromFile(Typeface.java:998) at android.graphics.Ty...
2021/09/03
[ "https://Stackoverflow.com/questions/69044308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16822491/" ]
replace line with this typeface = Typeface.createFromAsset(getAssets(),"font/Regular.otf") Happy Coding!
You need to rename your font to lower cases as per google recommendations. Further you can set font using: ``` myTextView.typeface = ResourcesCompat.getFont(this, R.font.regular) ``` For more details refer to : <https://johncodeos.com/how-to-add-custom-fonts-in-your-android-app-using-kotlin/>
69,044,308
I'm learning to use Android Jetpack Compose. Now I have a **Regular.otf** font file in **assets/font**. I want to use it in Text. ``` java.lang.RuntimeException: Font asset not found /commonui/src/main/assets/font/Regular.otf at android.graphics.Typeface.createFromFile(Typeface.java:998) at android.graphics.Ty...
2021/09/03
[ "https://Stackoverflow.com/questions/69044308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16822491/" ]
You should put the font resource in the `res/font/` folder and name it in lowercase, for example `regular.otf`. It is also probably a good idea to give it a real font name rather than a font style name. Read more about adding font resources in [documentation](https://developer.android.com/guide/topics/resources/font-re...
replace line with this typeface = Typeface.createFromAsset(getAssets(),"font/Regular.otf") Happy Coding!
69,044,308
I'm learning to use Android Jetpack Compose. Now I have a **Regular.otf** font file in **assets/font**. I want to use it in Text. ``` java.lang.RuntimeException: Font asset not found /commonui/src/main/assets/font/Regular.otf at android.graphics.Typeface.createFromFile(Typeface.java:998) at android.graphics.Ty...
2021/09/03
[ "https://Stackoverflow.com/questions/69044308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16822491/" ]
You should put the font resource in the `res/font/` folder and name it in lowercase, for example `regular.otf`. It is also probably a good idea to give it a real font name rather than a font style name. Read more about adding font resources in [documentation](https://developer.android.com/guide/topics/resources/font-re...
You need to rename your font to lower cases as per google recommendations. Further you can set font using: ``` myTextView.typeface = ResourcesCompat.getFont(this, R.font.regular) ``` For more details refer to : <https://johncodeos.com/how-to-add-custom-fonts-in-your-android-app-using-kotlin/>
12,739
I'm working in a big project, where we're creating a standard software A for several customers and in parallel extending that software for one customer (software B). There are several Scrum teams. The teams, which work on A, are geographically and contractually separated from B teams. Often we need to have something f...
2014/12/02
[ "https://pm.stackexchange.com/questions/12739", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/1264/" ]
Some ideas coming from working in the same environment: Small Changes ------------- 1) Shorten the duration of iterations for team A so that they are required to ship product more frequently and in smaller increments. Shortening the iteration will allow for quicker response to changing priorities at a higher coordina...
**Make sure you are communicating.** Make sure the Product Owners responsible for A understand the dependencies that B is relying on. Work with them to get agreement on prioritizing the items that are needed for the teams working on B to be able to make progress. If necessary, escalate this to whoever is in a position ...
4,650,355
I need help with this question. I'm using the [camel-http](http://camel.apache.org/http.html) component as shown [here](https://stackoverflow.com/questions/4353700/http-post-from-activemq-using-camel/4354877#4354877) but I'm having trouble because the body I'm sending has unescaped ampersands. This is causing the que...
2011/01/10
[ "https://Stackoverflow.com/questions/4650355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/182484/" ]
Ok, I bit the bullet. I created a java POJO ``` package com.wufoo.camel; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import org.apache.log4j.Logger; public class PayloadEncoder { public String getEncodedBody(String body) throws UnsupportedEncodingException { Logger mylogger ...
You can also use groovy language, like this: ``` <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/b...
18,938
Когда появилось слово "собака" в русском языке? Что если английский купец пришел на двор к русскому коллеге лет 300 назад и удивился, как лает собака хозяина.
2013/05/01
[ "https://rus.stackexchange.com/questions/18938", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/1745/" ]
Вполне возможно, в 12 веке. Раньше на Руси было слово пёс, а собака- тюркское.Есть версия, что от татаро-монголов :"ic-бак" - «пес-следопыт», заднеязычный вариант попал к славянам «съ-бак (а)». Переднеязычный сь-бк стал основой для формы, предшествующей " кебк" (кбк, кбек - кобяк) В огузо-карлукских наречиях - «кобо...
Собака имеет объяснение в румынском языке. Слово сформировано из двух частей. СО = asociat =асоциат, и БАЧ= baci=чабан. Смысл слова "собака" - тот кто помогает чабану пасти овец. Все очень просто.
18,938
Когда появилось слово "собака" в русском языке? Что если английский купец пришел на двор к русскому коллеге лет 300 назад и удивился, как лает собака хозяина.
2013/05/01
[ "https://rus.stackexchange.com/questions/18938", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/1745/" ]
Вполне возможно, в 12 веке. Раньше на Руси было слово пёс, а собака- тюркское.Есть версия, что от татаро-монголов :"ic-бак" - «пес-следопыт», заднеязычный вариант попал к славянам «съ-бак (а)». Переднеязычный сь-бк стал основой для формы, предшествующей " кебк" (кбк, кбек - кобяк) В огузо-карлукских наречиях - «кобо...
Даа, наши древние русские приручили собаку, начали думать как ее назвать, ну никак нужного слова не нашли - поехали к тюркам, поклонились и спрашивают - как нам назвать сие животное. А тюрки - "Ну вы тупые, это же собака"
18,938
Когда появилось слово "собака" в русском языке? Что если английский купец пришел на двор к русскому коллеге лет 300 назад и удивился, как лает собака хозяина.
2013/05/01
[ "https://rus.stackexchange.com/questions/18938", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/1745/" ]
Существует версия, согласно которой слово СОБАКА является ранним общевосточнославянским заимствованием из иранских языков Северного Причерноморья (*sabāka - ср.фарси sabah, авест. spaka- - прилаг."собачий", spa - "собака". Иранское слово родственно др.-инд.* Çvā - "собака". Тюркское происхождение, по мнению Фасмера, не...
Собака имеет объяснение в румынском языке. Слово сформировано из двух частей. СО = asociat =асоциат, и БАЧ= baci=чабан. Смысл слова "собака" - тот кто помогает чабану пасти овец. Все очень просто.
18,938
Когда появилось слово "собака" в русском языке? Что если английский купец пришел на двор к русскому коллеге лет 300 назад и удивился, как лает собака хозяина.
2013/05/01
[ "https://rus.stackexchange.com/questions/18938", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/1745/" ]
Существует версия, согласно которой слово СОБАКА является ранним общевосточнославянским заимствованием из иранских языков Северного Причерноморья (*sabāka - ср.фарси sabah, авест. spaka- - прилаг."собачий", spa - "собака". Иранское слово родственно др.-инд.* Çvā - "собака". Тюркское происхождение, по мнению Фасмера, не...
Даа, наши древние русские приручили собаку, начали думать как ее назвать, ну никак нужного слова не нашли - поехали к тюркам, поклонились и спрашивают - как нам назвать сие животное. А тюрки - "Ну вы тупые, это же собака"
48,035,150
I've tried every permutation I can think of, and read all sorts of doc about Swift `#selectors`, but I'm not getting anywhere. Here's the code: ``` class AFSelectionState: GKComponent { let clearSelectionIndicator: (Set<Int>?) -> Void let setSelectionIndicator: (Set<Int>) -> Void init(setSelectionIndicato...
2017/12/30
[ "https://Stackoverflow.com/questions/48035150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1610473/" ]
`Selector` is basically a string, not a closure, or block or whatever piece of code that could be executed. To achieve what you need try this: ``` selectionState = AFSelectionState( setSelectionIndicator: self.setSelectionIndicator_, clearSelectionIndicator: self.clearSelectionIndicator_ ) ``` P.S. make su...
This is the right syntax: ``` selectionState = AFSelectionState(setSelectionIndicator: setSelectionIndicator_, clearSelectionIndicator: clearSelectionIndicator_) ``` You mixed Selectors and Closures. Check out the link: <https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_La...
5,327,045
I am performing some simple tests with ActiveMQ to see how it performs on a non stable network. The first test consists in a producer that sends messages to a remote queue. The message is of type ObjectMessage with serializable content inside (a list of Objects). With a good network everything works correctly, but whe...
2011/03/16
[ "https://Stackoverflow.com/questions/5327045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/217089/" ]
I have seen similar behaviour with linked servers (although usually Oracle not SQL Server) and the problem was traced to the driver being used for the linked server. I see you have SQL Native Client 10 as the provider, could you try using Microsoft OLE DB Provider for SQL Server instead and seeing if it makes a differ...
Also would be curious to know if you have the same problem when you use OpenQuery instead of the four-part naming convention: ``` SELECT * FROM OpenQuery(linkserver,'SELECT * FROM Customers where CustomerId = 1140') ``` IIRC, that should be faster, anyway... I believe that would force it to take care of the "where"...
25,522,220
i have a little question in relation to the free() function of C. I allocate in a program a multidimensional array with this code : ``` char **newMatrix( int N ){ int i,j; char **a = malloc(sizeof *a * N); if (a) { for (i = 0; i < N; i++) { a[i] = malloc(sizeof *a[i] * N); } ...
2014/08/27
[ "https://Stackoverflow.com/questions/25522220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3748224/" ]
free will not clear the memory for you. It just marks it as available for the OS to reallocate somewhere else. People tend to assign NULL to a pointer after freeing to prevent accidental reuse. If you want to be sure what your code is doing, you could memset the allocated space to a known value before freeing. To be ho...
free() will only remove the reference to memory pointed to, by the pointer passed to it. Once a pointer is passed to free() and the free() returns a success(which always is..), the pointer should never be used. To avoid this usage, which is a illegal reference, a pointer variable should always be assigned NULL after...
25,522,220
i have a little question in relation to the free() function of C. I allocate in a program a multidimensional array with this code : ``` char **newMatrix( int N ){ int i,j; char **a = malloc(sizeof *a * N); if (a) { for (i = 0; i < N; i++) { a[i] = malloc(sizeof *a[i] * N); } ...
2014/08/27
[ "https://Stackoverflow.com/questions/25522220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3748224/" ]
`free` does not mean that it will actually delete the memory! It will inform to the OS that I don't want this memory any more, use it for some other process! You can certainly continue to use array `a` after calling `free(a)` and nothing will stop you. However the results will be completely undefined and unpredictable...
free will not clear the memory for you. It just marks it as available for the OS to reallocate somewhere else. People tend to assign NULL to a pointer after freeing to prevent accidental reuse. If you want to be sure what your code is doing, you could memset the allocated space to a known value before freeing. To be ho...
25,522,220
i have a little question in relation to the free() function of C. I allocate in a program a multidimensional array with this code : ``` char **newMatrix( int N ){ int i,j; char **a = malloc(sizeof *a * N); if (a) { for (i = 0; i < N; i++) { a[i] = malloc(sizeof *a[i] * N); } ...
2014/08/27
[ "https://Stackoverflow.com/questions/25522220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3748224/" ]
free will not clear the memory for you. It just marks it as available for the OS to reallocate somewhere else. People tend to assign NULL to a pointer after freeing to prevent accidental reuse. If you want to be sure what your code is doing, you could memset the allocated space to a known value before freeing. To be ho...
If I understood you correctly you want to check if: * You don't reuse memory after freeing it * You freed all of the memory It's not possible to do it directly from within language - however there are tools which can help. For example [Valgrind](http://valgrind.org/) can check both of those things (and much more). If...
25,522,220
i have a little question in relation to the free() function of C. I allocate in a program a multidimensional array with this code : ``` char **newMatrix( int N ){ int i,j; char **a = malloc(sizeof *a * N); if (a) { for (i = 0; i < N; i++) { a[i] = malloc(sizeof *a[i] * N); } ...
2014/08/27
[ "https://Stackoverflow.com/questions/25522220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3748224/" ]
`free` does not mean that it will actually delete the memory! It will inform to the OS that I don't want this memory any more, use it for some other process! You can certainly continue to use array `a` after calling `free(a)` and nothing will stop you. However the results will be completely undefined and unpredictable...
free() will only remove the reference to memory pointed to, by the pointer passed to it. Once a pointer is passed to free() and the free() returns a success(which always is..), the pointer should never be used. To avoid this usage, which is a illegal reference, a pointer variable should always be assigned NULL after...
25,522,220
i have a little question in relation to the free() function of C. I allocate in a program a multidimensional array with this code : ``` char **newMatrix( int N ){ int i,j; char **a = malloc(sizeof *a * N); if (a) { for (i = 0; i < N; i++) { a[i] = malloc(sizeof *a[i] * N); } ...
2014/08/27
[ "https://Stackoverflow.com/questions/25522220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3748224/" ]
`free` does not mean that it will actually delete the memory! It will inform to the OS that I don't want this memory any more, use it for some other process! You can certainly continue to use array `a` after calling `free(a)` and nothing will stop you. However the results will be completely undefined and unpredictable...
If I understood you correctly you want to check if: * You don't reuse memory after freeing it * You freed all of the memory It's not possible to do it directly from within language - however there are tools which can help. For example [Valgrind](http://valgrind.org/) can check both of those things (and much more). If...
32,314,815
jQuery('html').css('height') will show height in px. I would like to check if height is set to 100%. Is there any easy way?
2015/08/31
[ "https://Stackoverflow.com/questions/32314815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1207443/" ]
You can use `xsl:text` to wrap the plain text you want to output. ``` <xsl:template match="author"> <xsl:value-of select="@surname" /> <xsl:if test="count(g)&gt;1"> <xsl:text>,</xsl:text> <xsl:for-each select="g"> <xsl:value-of select="substring(.,1,1)" /> <xsl:text>.</x...
Whitespace in the stylesheet is significant only if one of the following conditions applies: 1. it is within an `xsl:text` element 2. it is part of the same text node as non-whitespace characters (as in your example) 3. there is an `xml:space="preserve"` attribute.
934,712
Context ------- I am given the 3 points: $P(3,-1,3)$, $Q(1,-1,6)$, and $R(5,0,1)$ I know that $\overrightarrow{PQ} =(3-1)\hat{i}+((-1)-(-1))\hat{j}+(3-6)\hat{k} $ $=2\hat{i}+0\hat{j}-3\hat{k}$ and $\overrightarrow{PR} =(3-5)\hat{i}+((-1)-0)\hat{j}+(3-1)\hat{k} $ $=-2\hat{i}-\hat{j}+2\hat{k}$ and $\|\overrigh...
2014/09/17
[ "https://math.stackexchange.com/questions/934712", "https://math.stackexchange.com", "https://math.stackexchange.com/users/116774/" ]
My answer: In fact $\overrightarrow{PQ}\cdot\overrightarrow{PR}=||\overrightarrow{PQ}||||\overrightarrow{PR}||\cos(\theta)$ where $\theta$ is the angle between the two vectors. $||\overrightarrow{PQ}||\cos(\theta)$ represents the projection of vector $\overrightarrow{PQ}$ onto the direction $\overrightarrow{PR}$, so t...
Suppose you have two vectors $\vec{a}$ and $\vec{b}$: $$\vec{a}=\left( \begin{array}{c} a\_1\\ a\_2\\ a\_3\\ \end{array} \right), \quad \vec{b}=\left( \begin{array}{c} b\_1\\ b\_2\\ b\_3\\ \end{array} \right).$$ Then the following holds: $$\vec{a}\cdot\vec{b} = ||\vec{a}||\ ||\vec{b}||\cos{(\theta)},$$ with $...
45,374,990
``` Robot robot = new Robot(); BufferedImage screenShot = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); ImageIO.write(screenShot, "JPG", new File("ScreenShot.jpg")); ``` This code will capture the screenshot of whatever is present on the desktop screen when test cases fail. B...
2017/07/28
[ "https://Stackoverflow.com/questions/45374990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6568807/" ]
Try this: ``` WHERE ISNULL([Column],1) = CASE WHEN @Variable1 IN (1,2) THEN 1 ELSE @Variable2 END ``` P.S. Change value `1` to any value that not valid for `[Column]`.
It is not possible to test for NULL values with comparison operators, such as =, <, or <>. You have to use IS NULL or IS NOT NULL operators. Rewrite your condition: ``` WHERE ([Column] IS NULL AND @Variable1 IN (1,2) OR [Column] = @Variable2) AND ...other conditions... ```
45,374,990
``` Robot robot = new Robot(); BufferedImage screenShot = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); ImageIO.write(screenShot, "JPG", new File("ScreenShot.jpg")); ``` This code will capture the screenshot of whatever is present on the desktop screen when test cases fail. B...
2017/07/28
[ "https://Stackoverflow.com/questions/45374990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6568807/" ]
Try this: ``` WHERE ISNULL([Column],1) = CASE WHEN @Variable1 IN (1,2) THEN 1 ELSE @Variable2 END ``` P.S. Change value `1` to any value that not valid for `[Column]`.
``` WHERE CASE WHEN @Variable1 IN (1,2) AND [Column] IS NULL THEN 1 WHEN [Column] = @Variable2 THEN 1 ELSE 0 END = 1 ```
24,485,720
I am trying a tutorial from androidhive for google maps The MainActivity.java is ``` package info.achuthan.googlemaps; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.SupportMapFragment; import android.os.Bundle; import android.app.Act...
2014/06/30
[ "https://Stackoverflow.com/questions/24485720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3706231/" ]
Before throwing threads at this problem, optimize the use of a single core. CPU cache misses make a measurable difference in cases like this. For example consider this example code, in one case it sums up values array[i][j] and in the other array[j][i]. One of them suffers a lot less CPU cache misses, and is thus much ...
Break the input into segments. When you get to the bottom: ``` compute() method when at threshold ``` int[][] A = original A matrix int[][] B = original B matrix int[][] C = new instantiated result matrix int start = starting position int end = ending position // column size is equal in all int columns = A[0]...
41,301,698
I want to create a matrix in R with element [-1,0,1] with probability [1/6, 2/3, 1/6] respectively. The probability may change during runtime. for static probability I have got the output but the problem is dynamic change in the probability. for example, If I create a matrix for the above probability with [sqrt(3),0,...
2016/12/23
[ "https://Stackoverflow.com/questions/41301698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1598346/" ]
Supposing you want a 2x3 matrix: ``` matrix(sample(c(-1,0,1), size=6, replace=TRUE, prob=c(1/6,2/3,1/6)), nrow=2) ``` So you sample from the values you want, with probabilities defined in `prob`. This is just a vector, but you can make it into a matrix of the desired shape using `matrix` afterwards. Replace the prob...
You can try this to generate a mxn matrix: ``` sample.dynamic.matrix <- function(pop.symbols, probs, m, n) { samples <- sample(pop.symbols, m*n, prob = probs, replace=TRUE) return(matrix(samples, nrow=m)) } set.seed(123) sample.dynamic.matrix(-1:1, c(1/6,2/3,1/6), 2, 3) # [,1] [,2] [,3] #[1,] 0 0 -1...
36,421,452
I'm trying to make a WindowsFormApplication in Visual Studio 2015 and need some help. I've been trying to search for the answer on internet but can find out how to do the following: I have two windows (solutions?). I open the second window with a button in the first one with this code: ``` this.Hide(); intermec prodi...
2016/04/05
[ "https://Stackoverflow.com/questions/36421452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4952385/" ]
A Form is just another Control. Think of it as a Container (because it holds other Controls). A User Control can also hold more than one Control. There are ways you can display a Window inside another Window in a WinForms app, but the desired effect is not always guaranteed. So it would be best to place all of your co...
I think you are talking about form inheritance: Just create a form, lets call it as frmBase. And add some controls onto frmBase which you want to have on other forms as well. Create other form, lets call it as frmDerived. In the code behind of frmDerived, just do the following: ``` // derive the frmDerived form fro...
2,947,353
> > **Possible Duplicate:** > > [Does SQL Server 2005 have an equivalent to MySql’s ENUM data type?](https://stackoverflow.com/questions/262802/does-sql-server-2005-have-an-equivalent-to-mysqls-enum-data-type) > > > Is there any way to define ENUM in SQL Server 2005? I have fixed values which I need to use in...
2010/06/01
[ "https://Stackoverflow.com/questions/2947353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130452/" ]
Use one or more scalar UDFs? One per constant: * `dbo.CONST_Bicycle` returns 1 * `dbo.CONST_Car` returns 2 One per enum: * `dbo.CONST_Types('Bicycle')` returns 1 * `dbo.CONST_Types('Car')` returns 2 Or use a table with ID, Name per enum Use a client side enum to match this (perhaps with validation against the tab...
You might want to have lookup table named LuVehicle With columns Id and Name. Values may look like ``` 1,Bicycle 2,Car 3,MotorCycle ``` Then you can have foriegn key of Id column wherever you need in your database tables. To retrieve the exact name of the value, you can have a simple inner join with LuVehicle tab...
2,947,353
> > **Possible Duplicate:** > > [Does SQL Server 2005 have an equivalent to MySql’s ENUM data type?](https://stackoverflow.com/questions/262802/does-sql-server-2005-have-an-equivalent-to-mysqls-enum-data-type) > > > Is there any way to define ENUM in SQL Server 2005? I have fixed values which I need to use in...
2010/06/01
[ "https://Stackoverflow.com/questions/2947353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130452/" ]
Use one or more scalar UDFs? One per constant: * `dbo.CONST_Bicycle` returns 1 * `dbo.CONST_Car` returns 2 One per enum: * `dbo.CONST_Types('Bicycle')` returns 1 * `dbo.CONST_Types('Car')` returns 2 Or use a table with ID, Name per enum Use a client side enum to match this (perhaps with validation against the tab...
SQL Server supports user defined data types. You might want to do something with [CREATE TYPE (Transact-SQL)](http://msdn.microsoft.com/en-us/library/ms175007.aspx). But I don't know even if it is possible through User defined datatypes and not aware of its pros and cons. May be someone else will throw more light on it...
2,947,353
> > **Possible Duplicate:** > > [Does SQL Server 2005 have an equivalent to MySql’s ENUM data type?](https://stackoverflow.com/questions/262802/does-sql-server-2005-have-an-equivalent-to-mysqls-enum-data-type) > > > Is there any way to define ENUM in SQL Server 2005? I have fixed values which I need to use in...
2010/06/01
[ "https://Stackoverflow.com/questions/2947353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130452/" ]
You might want to have lookup table named LuVehicle With columns Id and Name. Values may look like ``` 1,Bicycle 2,Car 3,MotorCycle ``` Then you can have foriegn key of Id column wherever you need in your database tables. To retrieve the exact name of the value, you can have a simple inner join with LuVehicle tab...
SQL Server supports user defined data types. You might want to do something with [CREATE TYPE (Transact-SQL)](http://msdn.microsoft.com/en-us/library/ms175007.aspx). But I don't know even if it is possible through User defined datatypes and not aware of its pros and cons. May be someone else will throw more light on it...
60,526
My friend has an early draft of a math result he would like to publish. In telling me about his results, I made an observation that significantly simplified a portion of the proof. He wanted to list me on the final publication (not as a co-author, but more of a shout out for contributing), which I was happy with. I do...
2015/12/23
[ "https://academia.stackexchange.com/questions/60526", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/33257/" ]
**TLDR:** Well, looks like I wrote a pretty long answer! I don't really see how I can summarize it in a single sentence, sorry... You'll just have to read the whole thing. :-) --- You are worried about being the bearer of bad news and upsetting your friend, which is very noble, but it's not clear to me that that's in...
Tell him what you have figured out. Maybe he will want to modify his own proof and add you as an author. Maybe he will just add a note that it has been pointed out to him that the result can also be proven using other specified methods. Maybe he will look over your shorter proof with interest but not change his manuscr...
63,642,647
I know I can store the numbers in an array first like arr[] = {1,2,3}; then call a sum function to add all the numbers like sum(arr); But what if I want to not use the arr[] and just call sum(1,2,3)? The values will be determined by the user so it can be sum(1,2), sum(1,2,3,4,5) or sum(1,2,5) ``` #include <iostream>...
2020/08/29
[ "https://Stackoverflow.com/questions/63642647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14035983/" ]
You can write the function like this: ``` template<typename ...Ts> auto sum(Ts ...ts) { int arr[]{ ts... }; addition(arr); } ``` which stores the variadic arguments into an array, and the calls `addition` on that array. Here's a [demo](https://godbolt.org/z/3Yfdxs). --- However, you can also simply write ...
Another option is to use stringstreams to handle the process. I imagine the variadic template approach @cigien is going to be more efficient, but stringstreams are really useful for many purposes: ``` #include <sstream> #include <iostream> int ssum(std::stringstream &obj) { int accumulator = 0; std::string bu...
934,181
**Background**: We have migrated 2 old webservers to 2 new, more robust servers- Ubuntu 17.04 and 18.04. We purchased Thawte SSL certificates for the domains we host(about 20) to use on 2 servers. Each server has its own, single static IP address. The certificates were configured in the fashion of Common Name **www.ex...
2018/10/05
[ "https://serverfault.com/questions/934181", "https://serverfault.com", "https://serverfault.com/users/490739/" ]
I ended up figuring this out a while back by tinkering with the order of things. What finally worked for all the .conf files for all our websites: ``` <VirtualHost *:80> ServerName www.otherdomain.org ServerAlias www4.otherdomain.org otherdomain.org ServerAdmin webmaster@otherdo...
Of today 2023 there is still this error of wrong certificate that has been lengthy explained in <https://blog.apnic.net/2020/04/07/the-wrong-certificate-apache-lets-encrypt-and-openssl/> with reason being fauty default behavior of openssl library not relying intended host name for site.
34,548,039
i am using [Gorilla Mux](http://www.gorillatoolkit.org/pkg/mux) for writing a REST API and i am having trouble organizing my routes, currently all of my routes are defined in the `main.go` file like this ``` //main.go package main import ( "NovAPI/routes" "fmt" "github.com/gorilla/mux" "net/http" ) f...
2015/12/31
[ "https://Stackoverflow.com/questions/34548039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5288071/" ]
What about something like this ? ``` //main.go package main import ( "NovAPI/routes" "fmt" "github.com/gorilla/mux" "net/http" ) func main() { router := mux.NewRouter().StrictSlash(true) router.HandleFunc("/hello", HelloHandler) router.HandleFunc("/user", UserHandler) router.HandleF...
I like checking out other projects in github to grab ideas on how to do stuff, and for these cases I usually take a look first at the [Docker repo](https://github.com/docker/docker). This is the way they do it: For the [system](https://github.com/docker/docker/tree/master/api/server/router/system)'s routes, define all...
34,548,039
i am using [Gorilla Mux](http://www.gorillatoolkit.org/pkg/mux) for writing a REST API and i am having trouble organizing my routes, currently all of my routes are defined in the `main.go` file like this ``` //main.go package main import ( "NovAPI/routes" "fmt" "github.com/gorilla/mux" "net/http" ) f...
2015/12/31
[ "https://Stackoverflow.com/questions/34548039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5288071/" ]
What about something like this ? ``` //main.go package main import ( "NovAPI/routes" "fmt" "github.com/gorilla/mux" "net/http" ) func main() { router := mux.NewRouter().StrictSlash(true) router.HandleFunc("/hello", HelloHandler) router.HandleFunc("/user", UserHandler) router.HandleF...
Since I am new to Go, I prefer a less verbose solution. In each module, we can create a Route function that expects a main route pointer and creates sub-routes to it. Our main.go file would be as follows ``` package main import ( "net/http" "github.com/user-name/repo-name/auth" "github.com/gorilla/mux" ) ...