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
55,508,892
I have a button to backup my local database(SQLITE) to another path so that I can email the file to me. How can I copy the SQLite data to my for example downloads folder? Here is the code of my backup button: ``` private void BtnBackup_Clicked(object sender, EventArgs e) { string fileName = Path.Comb...
2019/04/04
[ "https://Stackoverflow.com/questions/55508892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I guess your database is MS SQL Server. SQL Server stores time in `HH:MI:SS` format. Use `TimeSpan` in your model to store/get the data. Here is another possible solution: [How to save time only without the date using ASP.NET MVC 5 Data Annotation "DataType.Time?](https://stackoverflow.com/questions/24693572/how-to-...
``` DateTime newintime = DateTime.Parse(Request["intime"].ToLongTimeString()); //change here DateTime newouttime = DateTime.Parse(Request["out_time"].ToLongTimeString());// here also model = db.bookm.Where(x=>x.intime>= newintime && x.out_time <= newouttime ).First(); ``` user ToLongTimeString();
17,528,159
How to remove curly brackets in R? Eg. "{abcd}" to "abcd" How can I use gsub function in R to do this? If any other method is available, please suggest.
2013/07/08
[ "https://Stackoverflow.com/questions/17528159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2560936/" ]
Try this ``` gsub("\\{|\\}", "", "{abcd}") [1] "abcd" ``` Or this ``` gsub("[{}]", "", "{abcd}") ```
``` x <- "{abcd}" gsub("^\\{+(.+)\\}+$", '\\1', x) ``` This will remove all braces on either end of the string. The difference between this and @Dickoa's answer is that this would leave any braces inside the string alone.
17,528,159
How to remove curly brackets in R? Eg. "{abcd}" to "abcd" How can I use gsub function in R to do this? If any other method is available, please suggest.
2013/07/08
[ "https://Stackoverflow.com/questions/17528159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2560936/" ]
Try this ``` gsub("\\{|\\}", "", "{abcd}") [1] "abcd" ``` Or this ``` gsub("[{}]", "", "{abcd}") ```
I tend to do it in 2 steps with the argument `fixed = TRUE`, which will speed up things quite a bit. ``` x <- "{abcd}" res1 = gsub("{", "", x, fixed = TRUE) res1 = gsub("}", "", res1, fixed = TRUE) ``` and some benchmarks will tell you thats it about twice as fast: ``` mc = microbenchmark::microbenchmark(times = 30...
17,528,159
How to remove curly brackets in R? Eg. "{abcd}" to "abcd" How can I use gsub function in R to do this? If any other method is available, please suggest.
2013/07/08
[ "https://Stackoverflow.com/questions/17528159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2560936/" ]
``` x <- "{abcd}" gsub("^\\{+(.+)\\}+$", '\\1', x) ``` This will remove all braces on either end of the string. The difference between this and @Dickoa's answer is that this would leave any braces inside the string alone.
I tend to do it in 2 steps with the argument `fixed = TRUE`, which will speed up things quite a bit. ``` x <- "{abcd}" res1 = gsub("{", "", x, fixed = TRUE) res1 = gsub("}", "", res1, fixed = TRUE) ``` and some benchmarks will tell you thats it about twice as fast: ``` mc = microbenchmark::microbenchmark(times = 30...
51,859,100
After trying to install 'models' module I get this error: ``` C:\Users\Filip>pip install models Collecting models Using cached https://files.pythonhosted.org/packages/92/3c/ac1ddde60c02b5a46993bd3c6f4c66a9dbc100059da8333178ce17a22db5/models-0.9.3.tar.gz Complete output from command python setup.py egg_info: Traceback ...
2018/08/15
[ "https://Stackoverflow.com/questions/51859100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9990279/" ]
It looks like `models` [was renamed](https://pypi.org/project/models/) to [pymodels](https://pypi.org/project/pymodels/) then renamed again to [doqu](https://pypi.org/project/doqu/) [(source code)](https://bitbucket.org/neithere/doqu/) which I was able to install the latest version from pypi. Is this legacy code? Will ...
There was a problem like that on the codecademy.com FLASKFM project. If you try to run code on your local IDE will give an error. Because of module.py file not updating yet. After updating modul.py file your main server app for Flask project should work.
69,669,752
I'm using an angular material tree to display a deeply nested object. While building the tree, how do I store the current path along with the values? ``` const TREE_DATA = JSON.parse(JSON.stringify({ "cars": [ { "model": "", "make": "Audi", "year": "" }, ...
2021/10/21
[ "https://Stackoverflow.com/questions/69669752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8882952/" ]
See this issue on TypeScript's GitHub project: [Module path maps are not resolved in emitted code (#10866)](https://github.com/microsoft/TypeScript/issues/10866) tl;dr ===== * TypeScript won't rewrite your module paths * `paths` was designed to help TypeScript understand path aliases used by bundlers * You'll either ...
I've been stuck with this issue for 2 whole days trying to find something that works. @Wing's answer is correct, if you're using plain `tsc` with no other tools, then Node won't know what you mean by `@/` (or whatever your alias is) in your imports. I've tried a few different approaches and I've found one that require...
449,283
I have a collection of reviewers who are rating applications. Each application is reviewed by at least two people and they give a score between 0 and 50 among various criteria. Looking at the mean for each reviewer, it's seems a few rated more harshly than others, and that they give disproportionately lower scores to ...
2020/02/13
[ "https://stats.stackexchange.com/questions/449283", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/273625/" ]
Hopefully this isn't overkill, but I think this is a case where creating a linear model, and looking at the estimated marginal means, would make sense. Estimated marginal means are adjusted for the other terms in the model. That is, the E.M. mean score for student A can be adjusted for the effect of Evaluator 1. That i...
*@Sal Mangiafico* is on the right track, so I'd just add my few cents to his answer. The phenomenon you are describing is called *examiner effect*, and you can google for this term to find more hints on solving this problem. Are you familiar with [Item Response Theory](https://en.wikipedia.org/wiki/Item_response_theor...
35,827,150
I struggle since a few days to get a correct provisioning profile. I am an independent iOS dev with my own iTunes connect account but I recently started to develop for a development team. Since then, I can't get a correct provisionning profile to run my app from xCode to my iPhone. iOS documentation describes how to ...
2016/03/06
[ "https://Stackoverflow.com/questions/35827150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2521010/" ]
Each team member is responsible for creating their own key/cert pair and adding it to their machine via Keychain Access. That is for Development builds. Distribution certs can only be created by an admin. To create an app Id or provision on the member center you need to have admin access. If you don't have admin acces...
Ok, here are the steps: 1. Generate a new CSR from Keychain. 2. Go to iTunes Connect. 3. In Certificate section: * Download Apple's World Wide Relations Authority Certificate using CSR. * Download iOS Developer Certificate using CSR. 4. Add both these certificates to Keychain. 5. In Provisional Profile Section: * ...
6,685,140
I have many web applications in a Visual Studio solution. All have the same post build command: ``` xcopy "$(TargetDir)*.dll" "D:\Project\bin" /i /d /y ``` It would be useful to avoid replacing newer files with old ones (e.g. someone could accidentally add a reference to an old version of a DLL). How can I use xco...
2011/07/13
[ "https://Stackoverflow.com/questions/6685140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66708/" ]
From typing "help xcopy" at the command line: ``` /D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time. ``` So you already are using xcopy to only replace old files with new ones. ...
Not tested, but I use a similar command script for these sorts of tasks. ``` set DIR_DEST=D:\Project\bin pushd "$(TargetDir)" :: :: Move Files matching pattern and delete them :: for %%g in (*.dll) do (xcopy "%%g" "%DIR_DEST%" /D /Y & del "%%g") :: :: Move Files matching pattern :: :: for %%g in (*.dll) do (xcopy "%...
6,685,140
I have many web applications in a Visual Studio solution. All have the same post build command: ``` xcopy "$(TargetDir)*.dll" "D:\Project\bin" /i /d /y ``` It would be useful to avoid replacing newer files with old ones (e.g. someone could accidentally add a reference to an old version of a DLL). How can I use xco...
2011/07/13
[ "https://Stackoverflow.com/questions/6685140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66708/" ]
From typing "help xcopy" at the command line: ``` /D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time. ``` So you already are using xcopy to only replace old files with new ones. ...
User following command to copy all new and modified file from source to destination xcopy c:\source d:\destination /D /I /E /Y /D to check any modified file are there /I If the destination does not exist and copying more than one file, assumes that destination must be a directory. /E To copy directory and sub d...
6,685,140
I have many web applications in a Visual Studio solution. All have the same post build command: ``` xcopy "$(TargetDir)*.dll" "D:\Project\bin" /i /d /y ``` It would be useful to avoid replacing newer files with old ones (e.g. someone could accidentally add a reference to an old version of a DLL). How can I use xco...
2011/07/13
[ "https://Stackoverflow.com/questions/6685140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66708/" ]
User following command to copy all new and modified file from source to destination xcopy c:\source d:\destination /D /I /E /Y /D to check any modified file are there /I If the destination does not exist and copying more than one file, assumes that destination must be a directory. /E To copy directory and sub d...
Not tested, but I use a similar command script for these sorts of tasks. ``` set DIR_DEST=D:\Project\bin pushd "$(TargetDir)" :: :: Move Files matching pattern and delete them :: for %%g in (*.dll) do (xcopy "%%g" "%DIR_DEST%" /D /Y & del "%%g") :: :: Move Files matching pattern :: :: for %%g in (*.dll) do (xcopy "%...
10,214,949
I have a function defined that way: ``` var myObject = new Object(); function myFunction(someString){ myObject.someString= 0; } ``` The problem is `someString` is taken as the string `someString` instead of the value of that variable. So, after I use that function several times over with differe...
2012/04/18
[ "https://Stackoverflow.com/questions/10214949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1290170/" ]
You can use the associative array approach: ``` var someString = 'asdf'; myObject[someString] = 0; // {asdf: 0} myObject['foo'] = 'bar'; ``` You can basically use any string to retrieve your method/parameter. ``` var i = 1; myObject['test' + i] = i + 1; // gives us {test1: 2} ```
Try this ``` var myObject = new Object(); function myFunction(someString){ myObject[someString]= 0; } ```
69,619,770
I have a df that looks like this: [![enter image description here](https://i.stack.imgur.com/PBVX9.png)](https://i.stack.imgur.com/PBVX9.png) I want to remove the part that is equal to `ID` from `Name`, and then build three new variable which equal to the last two digit of `Name`, the 3 place in `Name', and 4th place...
2021/10/18
[ "https://Stackoverflow.com/questions/69619770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13631281/" ]
Use [`split`](https://docs.python.org/3/library/stdtypes.html#str.split), then reverse the string and finally [`capitalize`](https://docs.python.org/3/library/stdtypes.html#str.capitalize): ``` s = 'this is the best' res = " ".join([si[::-1].capitalize() for si in s.split()]) print(res) ``` **Output** ``` Siht Si ...
Just do: ``` " ".join([str(i[::-1]).title() for i in input.split()]) ```
69,619,770
I have a df that looks like this: [![enter image description here](https://i.stack.imgur.com/PBVX9.png)](https://i.stack.imgur.com/PBVX9.png) I want to remove the part that is equal to `ID` from `Name`, and then build three new variable which equal to the last two digit of `Name`, the 3 place in `Name', and 4th place...
2021/10/18
[ "https://Stackoverflow.com/questions/69619770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13631281/" ]
Use [`split`](https://docs.python.org/3/library/stdtypes.html#str.split), then reverse the string and finally [`capitalize`](https://docs.python.org/3/library/stdtypes.html#str.capitalize): ``` s = 'this is the best' res = " ".join([si[::-1].capitalize() for si in s.split()]) print(res) ``` **Output** ``` Siht Si ...
The other answers here works as well. But I think this will be a lot easier to understand. ``` s = 'this is the best' words = s.split() # Split into list of each word res = '' for word in words: word = word[::-1] # Reverse the word word = word.capitalize() + ' ' # Capitalize and add empty space res += ...
39,937,368
I want to know if it's authorized to avoid Thread deadlocks by making the threads not starting at the same time? Is there an other way to avoid the deadlocks in the following code? Thanks in advance! ``` public class ThreadDeadlocks { public static Object Lock1 = new Object(); public static Object Lock2 = ne...
2016/10/08
[ "https://Stackoverflow.com/questions/39937368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5398064/" ]
There are two ways to get a deadlock: 1. Lock escalation. For example, a thread holding a shareable read lock tries to escalate to an exclusive write lock. If more than one thread holding a read lock tries to escalate to a write lock, a deadlock results. This doesn't apply to what you're doing. (Offhand, I don't even ...
No, starting threads at different times is not a way to avoid deadlocks - in fact, what you'd be trying with different start times is a heuristic to serialize their critical sections. ++ see why at the and of this answer [Edited with a solution] > > Is there an other way to avoid the deadlocks in the following code?...
39,937,368
I want to know if it's authorized to avoid Thread deadlocks by making the threads not starting at the same time? Is there an other way to avoid the deadlocks in the following code? Thanks in advance! ``` public class ThreadDeadlocks { public static Object Lock1 = new Object(); public static Object Lock2 = ne...
2016/10/08
[ "https://Stackoverflow.com/questions/39937368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5398064/" ]
There are two ways to get a deadlock: 1. Lock escalation. For example, a thread holding a shareable read lock tries to escalate to an exclusive write lock. If more than one thread holding a read lock tries to escalate to a write lock, a deadlock results. This doesn't apply to what you're doing. (Offhand, I don't even ...
As the other mentioned, delays won't help because threads by their nature have unknown start time. When you call start() on a thread, it becomes runnable, but you cannot know when it will be running.
39,937,368
I want to know if it's authorized to avoid Thread deadlocks by making the threads not starting at the same time? Is there an other way to avoid the deadlocks in the following code? Thanks in advance! ``` public class ThreadDeadlocks { public static Object Lock1 = new Object(); public static Object Lock2 = ne...
2016/10/08
[ "https://Stackoverflow.com/questions/39937368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5398064/" ]
There are two ways to get a deadlock: 1. Lock escalation. For example, a thread holding a shareable read lock tries to escalate to an exclusive write lock. If more than one thread holding a read lock tries to escalate to a write lock, a deadlock results. This doesn't apply to what you're doing. (Offhand, I don't even ...
I'm assuming this is just demo code, so you already know that playing with sleeps is not guaranteed to work (as stressed in other answers). In your demo code I see two options to try avoid the deadlock: * Remove any sleep within the body of the functions executed by the threads and just put a single, long enough, sle...
18,837,093
I'm converting pdf files to images with ImageMagic, everything is ok until I use `-resize` option, then I get image with black background. I use this command: ``` convert -density 400 image.pdf -resize 25% image.png ``` I need to use `-resize` option otherwise I get really large image. Is there any other option whic...
2013/09/16
[ "https://Stackoverflow.com/questions/18837093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2581710/" ]
``` Select City, Sum(Money), Sum(Case When Age < 30 Then 1 Else 0 End), Sum(Case When Age > 30 Then 1 Else 0 End) From table Group By City ```
You can use this Query, ``` SELECT City, SUM(Money), SUM(case when Age < 30 then 1 else 0 end), SUM(case when Age > 30 then 1 else 0 end) FROM tableA GROUP BY City ```
19,785,290
Assuming I have a class that does some heavy processing, operating with several collections. What I want to do is to make sure that such operation can't lead to out-of-memory or even better I want to set a threshold of how much memory it can use. ``` class MyClass() { public void myMethod() { for(int i=0; ...
2013/11/05
[ "https://Stackoverflow.com/questions/19785290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1990089/" ]
You can use profiler (for ex. JProfiler) for view memory usage by classes. Or , how mentioned Areo, just print memory usage: ``` Runtime runtime = Runtime.getRuntime(); long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory(); System.out.println("Used Memory before" + usedMemoryBefore); ...
Here is a sample code to run memory usage in a separate thread. Since the GC can be triggered anytime when the process is running, this will record memory usage every second and report out the maximum memory used. The `runnable` is the actual process that needs measuring, and `runTimeSecs` is the expected time the pro...
19,785,290
Assuming I have a class that does some heavy processing, operating with several collections. What I want to do is to make sure that such operation can't lead to out-of-memory or even better I want to set a threshold of how much memory it can use. ``` class MyClass() { public void myMethod() { for(int i=0; ...
2013/11/05
[ "https://Stackoverflow.com/questions/19785290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1990089/" ]
Here is an example from Netty which does something similar: [MemoryAwareThreadPoolExecutor](http://grepcode.com/file/repo1.maven.org/maven2/org.jboss.netty/netty/3.0.0.CR1/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java). Guava's [cache class](https://code.google.com/p/guava-libraries/wiki/CachesEx...
The easiest way to estimate memory usage is to use methods from `Runtime` class. -------------------------------------------------------------------------------- **I suggest not to rely on it, but use it only for approximate estimations. Ideally you should only log this information and analyze it on your own, without ...
19,785,290
Assuming I have a class that does some heavy processing, operating with several collections. What I want to do is to make sure that such operation can't lead to out-of-memory or even better I want to set a threshold of how much memory it can use. ``` class MyClass() { public void myMethod() { for(int i=0; ...
2013/11/05
[ "https://Stackoverflow.com/questions/19785290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1990089/" ]
To measure current memory usage use : `Runtime.getRuntime().freeMemory()` , `Runtime.getRuntime().totalMemory()` Here is a good example: [get OS-level system information](https://stackoverflow.com/questions/25552/using-java-to-get-os-level-system-information) But this measurement is not precise but it can give you m...
This question is a bit tricky, due to the way in which Java can allocate a lot of short-lived objects during processing, which will subsequently be collected during garbage collection. In the accepted answer, we cannot say with any certainty that garbage collection has been run at any given time. Even if we introduce a...
19,785,290
Assuming I have a class that does some heavy processing, operating with several collections. What I want to do is to make sure that such operation can't lead to out-of-memory or even better I want to set a threshold of how much memory it can use. ``` class MyClass() { public void myMethod() { for(int i=0; ...
2013/11/05
[ "https://Stackoverflow.com/questions/19785290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1990089/" ]
To measure current memory usage use : `Runtime.getRuntime().freeMemory()` , `Runtime.getRuntime().totalMemory()` Here is a good example: [get OS-level system information](https://stackoverflow.com/questions/25552/using-java-to-get-os-level-system-information) But this measurement is not precise but it can give you m...
Here is an example from Netty which does something similar: [MemoryAwareThreadPoolExecutor](http://grepcode.com/file/repo1.maven.org/maven2/org.jboss.netty/netty/3.0.0.CR1/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java). Guava's [cache class](https://code.google.com/p/guava-libraries/wiki/CachesEx...
19,785,290
Assuming I have a class that does some heavy processing, operating with several collections. What I want to do is to make sure that such operation can't lead to out-of-memory or even better I want to set a threshold of how much memory it can use. ``` class MyClass() { public void myMethod() { for(int i=0; ...
2013/11/05
[ "https://Stackoverflow.com/questions/19785290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1990089/" ]
I can think of several options: * Finding out how much memory your method requires via a microbenchmark (i.e. [jmh](http://openjdk.java.net/projects/code-tools/jmh/)). * Building allocation strategies based on heuristic estimation. There are several open source solutions implementing class size estimation i.e. [ClassS...
The easiest way to estimate memory usage is to use methods from `Runtime` class. -------------------------------------------------------------------------------- **I suggest not to rely on it, but use it only for approximate estimations. Ideally you should only log this information and analyze it on your own, without ...
19,785,290
Assuming I have a class that does some heavy processing, operating with several collections. What I want to do is to make sure that such operation can't lead to out-of-memory or even better I want to set a threshold of how much memory it can use. ``` class MyClass() { public void myMethod() { for(int i=0; ...
2013/11/05
[ "https://Stackoverflow.com/questions/19785290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1990089/" ]
To measure current memory usage use : `Runtime.getRuntime().freeMemory()` , `Runtime.getRuntime().totalMemory()` Here is a good example: [get OS-level system information](https://stackoverflow.com/questions/25552/using-java-to-get-os-level-system-information) But this measurement is not precise but it can give you m...
The easiest way to estimate memory usage is to use methods from `Runtime` class. -------------------------------------------------------------------------------- **I suggest not to rely on it, but use it only for approximate estimations. Ideally you should only log this information and analyze it on your own, without ...
19,785,290
Assuming I have a class that does some heavy processing, operating with several collections. What I want to do is to make sure that such operation can't lead to out-of-memory or even better I want to set a threshold of how much memory it can use. ``` class MyClass() { public void myMethod() { for(int i=0; ...
2013/11/05
[ "https://Stackoverflow.com/questions/19785290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1990089/" ]
You can use profiler (for ex. JProfiler) for view memory usage by classes. Or , how mentioned Areo, just print memory usage: ``` Runtime runtime = Runtime.getRuntime(); long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory(); System.out.println("Used Memory before" + usedMemoryBefore); ...
The easiest way to estimate memory usage is to use methods from `Runtime` class. -------------------------------------------------------------------------------- **I suggest not to rely on it, but use it only for approximate estimations. Ideally you should only log this information and analyze it on your own, without ...
19,785,290
Assuming I have a class that does some heavy processing, operating with several collections. What I want to do is to make sure that such operation can't lead to out-of-memory or even better I want to set a threshold of how much memory it can use. ``` class MyClass() { public void myMethod() { for(int i=0; ...
2013/11/05
[ "https://Stackoverflow.com/questions/19785290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1990089/" ]
I can think of several options: * Finding out how much memory your method requires via a microbenchmark (i.e. [jmh](http://openjdk.java.net/projects/code-tools/jmh/)). * Building allocation strategies based on heuristic estimation. There are several open source solutions implementing class size estimation i.e. [ClassS...
Here is an example from Netty which does something similar: [MemoryAwareThreadPoolExecutor](http://grepcode.com/file/repo1.maven.org/maven2/org.jboss.netty/netty/3.0.0.CR1/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java). Guava's [cache class](https://code.google.com/p/guava-libraries/wiki/CachesEx...
19,785,290
Assuming I have a class that does some heavy processing, operating with several collections. What I want to do is to make sure that such operation can't lead to out-of-memory or even better I want to set a threshold of how much memory it can use. ``` class MyClass() { public void myMethod() { for(int i=0; ...
2013/11/05
[ "https://Stackoverflow.com/questions/19785290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1990089/" ]
You can use profiler (for ex. JProfiler) for view memory usage by classes. Or , how mentioned Areo, just print memory usage: ``` Runtime runtime = Runtime.getRuntime(); long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory(); System.out.println("Used Memory before" + usedMemoryBefore); ...
To measure current memory usage use : `Runtime.getRuntime().freeMemory()` , `Runtime.getRuntime().totalMemory()` Here is a good example: [get OS-level system information](https://stackoverflow.com/questions/25552/using-java-to-get-os-level-system-information) But this measurement is not precise but it can give you m...
19,785,290
Assuming I have a class that does some heavy processing, operating with several collections. What I want to do is to make sure that such operation can't lead to out-of-memory or even better I want to set a threshold of how much memory it can use. ``` class MyClass() { public void myMethod() { for(int i=0; ...
2013/11/05
[ "https://Stackoverflow.com/questions/19785290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1990089/" ]
Here is an example from Netty which does something similar: [MemoryAwareThreadPoolExecutor](http://grepcode.com/file/repo1.maven.org/maven2/org.jboss.netty/netty/3.0.0.CR1/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java). Guava's [cache class](https://code.google.com/p/guava-libraries/wiki/CachesEx...
This question is a bit tricky, due to the way in which Java can allocate a lot of short-lived objects during processing, which will subsequently be collected during garbage collection. In the accepted answer, we cannot say with any certainty that garbage collection has been run at any given time. Even if we introduce a...
39,410,484
I have `View` with some components handles. I can change color of label like this. `labelHandle.setForeground(Color.Blue);` I want to make text of this `label` blinking - the idea is that on the `View` I will have method `blink(Boolean on)` and if I call `blink(true)` the method will start new thread which will...
2016/09/09
[ "https://Stackoverflow.com/questions/39410484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1097772/" ]
Just set the `.RequestTimeout` [property](https://msdn.microsoft.com/en-us/library/aa239748(v=vs.60).aspx): ``` With FTP .URL = strHostName .Protocol = 2 .UserName = strUserName .Password = strPassWord .RequestTimeout 5 '<------ .Execute , "Get " + strRemoteFileName + " " + strLocalFileNa...
You should control this in your `.StillExecuting` loop This should work I think. It mostly depends on what your `inet` class is: *custom* or *MSINET.OCX reference*. If it's custom you should have declared the `cancel` method. ``` Dim dtStart As Date dtStart = Now .Execute , "Get " + strRemoteFileName + " " + strLocal...
4,631,616
my code broke somewhere along the way, and crashes when using the navigation bar buttons. Error message: `*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView newMemoViewController:didAddMemo:]: unrecognized selector sent to instance 0x5b55a60'` When debugging, the program doe...
2011/01/08
[ "https://Stackoverflow.com/questions/4631616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/560496/" ]
You're probably setting the delegate of `NewMemoViewController` to a `UIView` object instead of an object that implements the `NewMemoDelegate` protocol. The error message is telling you that a `newMemoViewController:didAddMemo:` message was sent to a `UIView` object and the `UIView` object didn't know what to do with...
I'm guessing you've over-released the delegate. I notice you have `@property (assign) ... delegate;`. This means that whenever you set the delegate, that object must be retained by something else as well. The other possibility is the delegate is actually a UIView, but I'm guessing it's the other case.
23,824,950
``` <li class="row"> <div class="small-6 column center"> <img src="test.jpg"> </div> <div class="small-6 column center"> <p>hello</p> </div> </li> ``` I wish to make the hello p in the centre (vertically and horizontally) of it's column. I do this with the styles: ``` p{ bottom: 0; ...
2014/05/23
[ "https://Stackoverflow.com/questions/23824950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1013512/" ]
try this:- ``` #include<stdio.h> #include<stdlib.h> /*Queue has five properties. capacity stands for the maximum number of elements Queue can hold. Size stands for the current size of the Queue and elements is the array of elements. front is the index of first element (the index at which we remove the element) and ...
A solution using double pointers is probably the best. You are implementing a priority queue technically, not a list. You implement it by keeping a linked list that is sorted. The dequeue operation on a priority queue will remove the first item from the list. As this is a homework assignment I set it up for you but yo...
23,824,950
``` <li class="row"> <div class="small-6 column center"> <img src="test.jpg"> </div> <div class="small-6 column center"> <p>hello</p> </div> </li> ``` I wish to make the hello p in the centre (vertically and horizontally) of it's column. I do this with the styles: ``` p{ bottom: 0; ...
2014/05/23
[ "https://Stackoverflow.com/questions/23824950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1013512/" ]
try this:- ``` #include<stdio.h> #include<stdlib.h> /*Queue has five properties. capacity stands for the maximum number of elements Queue can hold. Size stands for the current size of the Queue and elements is the array of elements. front is the index of first element (the index at which we remove the element) and ...
The following code should do the work. It will add to the list in increasing age order: ``` #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct _node_t { int age; char *name; struct _node_t *nextPtr; } node_t; node_t *node; void enqueue(char *name, int age) { node_t *p, *prev, ...
1,115,973
I've noticed an increasing number of jobs that are asking for experience with data mining and business intelligence technologies. This sounds like an incredibly broad topic but where would one go if they wanted to develop at least a partial understanding of this stuff if it were to come up in an interview?
2009/07/12
[ "https://Stackoverflow.com/questions/1115973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132153/" ]
A very good book with practical examples is the [Programming Collective Intelligence: Building Smart Web 2.0 Applications](https://rads.stackoverflow.com/amzn/click/com/0596529325) by Toby Segaran.
Go read [Data Mining: Practical Machine Learning Tools and Techniques (Second Edition)](http://www.cs.waikato.ac.nz/~ml/weka/book.html). Then use [Weka](http://www.cs.waikato.ac.nz/~ml/weka/index.html) on a pet project. Despite the name, this is a good book, and the Weka package has several levels of entry into the dat...
1,115,973
I've noticed an increasing number of jobs that are asking for experience with data mining and business intelligence technologies. This sounds like an incredibly broad topic but where would one go if they wanted to develop at least a partial understanding of this stuff if it were to come up in an interview?
2009/07/12
[ "https://Stackoverflow.com/questions/1115973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132153/" ]
Go read [Data Mining: Practical Machine Learning Tools and Techniques (Second Edition)](http://www.cs.waikato.ac.nz/~ml/weka/book.html). Then use [Weka](http://www.cs.waikato.ac.nz/~ml/weka/index.html) on a pet project. Despite the name, this is a good book, and the Weka package has several levels of entry into the dat...
Consider reading [Ralph Kimball's books](http://www.amazon.com/s/ref=nb_ss?url=search-alias%3Daps&field-keywords=ralph+kimball&x=0&y=0) for an introduction to Business Intelligence. Also, try to not stick to one technolgy-vendor, every company has its own biased vision of BI, you'll need a 360 overview.
1,115,973
I've noticed an increasing number of jobs that are asking for experience with data mining and business intelligence technologies. This sounds like an incredibly broad topic but where would one go if they wanted to develop at least a partial understanding of this stuff if it were to come up in an interview?
2009/07/12
[ "https://Stackoverflow.com/questions/1115973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132153/" ]
Go read [Data Mining: Practical Machine Learning Tools and Techniques (Second Edition)](http://www.cs.waikato.ac.nz/~ml/weka/book.html). Then use [Weka](http://www.cs.waikato.ac.nz/~ml/weka/index.html) on a pet project. Despite the name, this is a good book, and the Weka package has several levels of entry into the dat...
Maybe you can also try to work with real BI - it is almost impossible to get in contact with data-filled and running SAS, MS, Oracle etc. I work in a team which integrates BI BellaDati for enterprises. For try-out and personal purposes it is free with some datastore limitations ( <http://www.trgiman.eu/en/belladati/pro...
1,115,973
I've noticed an increasing number of jobs that are asking for experience with data mining and business intelligence technologies. This sounds like an incredibly broad topic but where would one go if they wanted to develop at least a partial understanding of this stuff if it were to come up in an interview?
2009/07/12
[ "https://Stackoverflow.com/questions/1115973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132153/" ]
A very good book with practical examples is the [Programming Collective Intelligence: Building Smart Web 2.0 Applications](https://rads.stackoverflow.com/amzn/click/com/0596529325) by Toby Segaran.
Consider reading [Ralph Kimball's books](http://www.amazon.com/s/ref=nb_ss?url=search-alias%3Daps&field-keywords=ralph+kimball&x=0&y=0) for an introduction to Business Intelligence. Also, try to not stick to one technolgy-vendor, every company has its own biased vision of BI, you'll need a 360 overview.
1,115,973
I've noticed an increasing number of jobs that are asking for experience with data mining and business intelligence technologies. This sounds like an incredibly broad topic but where would one go if they wanted to develop at least a partial understanding of this stuff if it were to come up in an interview?
2009/07/12
[ "https://Stackoverflow.com/questions/1115973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132153/" ]
A very good book with practical examples is the [Programming Collective Intelligence: Building Smart Web 2.0 Applications](https://rads.stackoverflow.com/amzn/click/com/0596529325) by Toby Segaran.
Maybe you can also try to work with real BI - it is almost impossible to get in contact with data-filled and running SAS, MS, Oracle etc. I work in a team which integrates BI BellaDati for enterprises. For try-out and personal purposes it is free with some datastore limitations ( <http://www.trgiman.eu/en/belladati/pro...
18,219
I'm going to try to provide a high level overview of the issue - realizing that more details/info will be necessary - but I don't want to write a novel that seems too overwhelming for people to respond to :) **Background**: Let's say I have 3 sets (A, B, C) of irregular point data of varying quality; A is "better" th...
2011/12/26
[ "https://gis.stackexchange.com/questions/18219", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/1384/" ]
When "best" is interpreted as "minimum variance unbiased estimator," then **the answer is [cokriging](http://www.gammadesign.com/gswinhelp/kriging_and_cokriging/cokriging.htm)**. This technique views the three datasets as realizations of three correlated spatial stochastic processes. It characterizes the process and th...
One thing I can come up with is to use simulation. For each of your observations you have a probability distribution, e.g. a normal distribution. For the low quality observations these probablity distributions are larger. From each of these observations you can draw a realization of the prob. distribution, interpolate ...
60,512,703
In my Laravel-5.8, I passed data from controller to view using JSON. ``` public function findScore(Request $request) { $userCompany = Auth::user()->company_id; $child = DB::table('appraisal_goal_types')->where('company_id', $userCompany)->where('id',$request->id)->first(); if(empty($child)) { abo...
2020/03/03
[ "https://Stackoverflow.com/questions/60512703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12510040/" ]
It seems to me that the LoginController is unnecessary. The spring security configuration has already defined the authenticationProvider to authenticate your login, you don't need another Controller to do the same thing. Try this: 1. remove the LoginController 2. change the login success URL to '/homeLogged' ``` ht...
You're not really using Spring Security to its full extent. There might be a way to make it work using this strange way of logging in but what I would suggest is that you just do things the Spring way: Make the entity you're using for logging in (`User.class` for example) implements Spring's [UserDetails](https://docs...
20,254,934
This question is **only for Python programmers**. This question is **not duplicate not working** [Increment a python floating point value by the smallest possible amount](https://stackoverflow.com/questions/6063755/increment-a-python-floating-point-value-by-the-smallest-possible-amount) see explanation bottom. --- I ...
2013/11/27
[ "https://Stackoverflow.com/questions/20254934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/665926/" ]
``` >>> (1.0).hex() '0x1.0000000000000p+0' >>> float.fromhex('0x0.0000000000001p+0') 2.220446049250313e-16 >>> 1.0 + float.fromhex('0x0.0000000000001p+0') 1.0000000000000002 >>> (1.0 + float.fromhex('0x0.0000000000001p+0')).hex() '0x1.0000000000001p+0' ``` Just use the same sign and exponent.
[Mark Dickinson's answer to a duplicate](https://stackoverflow.com/a/10426033/49793) fares much better, but still fails to give the correct results for the parameters `(0, 1)`. This is probably a good starting point for a pure Python solution. However, getting this exactly right in all cases is not easy, as there are ...
68,018,124
My Loading component: ``` import React from 'react' export default class Loading extends React.Component { constructor(props) { super(props) this.state = { display: 'none' } } render() { return ( <div className="loading" style={{display: this.state....
2021/06/17
[ "https://Stackoverflow.com/questions/68018124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11259682/" ]
If you want to change `display` from `App.js`: 1. Pass it as prop to `Loading` component, and keep the state at `App.js`. 2. pass some prop from `App.js` and when it changes - change the state of `display` in `App.js` 3. Use some global state/store manager like [Redux](https://react-redux.js.org/introduction/getting-s...
[Solution sample](https://codesandbox.io/s/gallant-mccarthy-xf98m?file=/src/App.js:0-485) A simple solution can be found in a code sandbox example.
13,306,013
I have a Master Page based Web site that has menu functionality. CSS is read from a Style.css file successfully. I have now added a seperate Login.aspx page which functions fine, but does not pick up the Account.css file, which has the specific css for the Login page. I do not want the login page to refernence the mast...
2012/11/09
[ "https://Stackoverflow.com/questions/13306013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1811813/" ]
There may be a region that your are using form authentication. If yes then you can use ``` <location path="Account.css"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location> ``` Inside ``` <appSettings></appSettings> ``` Else you can u...
Seems you are hosting your site on IIS in a virtual directory. If you do that, your path must reflect the virtual directory. ``` href="/virtualDir/Account.css" ``` To do this is asp.net use [`ResolveClientUrl`](http://msdn.microsoft.com/en-us/library/system.web.ui.control.resolveclienturl.aspx) ``` href="<%= Resolv...
13,477,363
I have a few kegs of the same package in `/usr/local/Cellar/libfoo` like `/usr/local/Cellar/libfoo/1.0.1`, `/usr/local/Cellar/libfoo/HEAD` and `/usr/local/Cellar/libfoo/mycopy` How can I brew link to a specific version?
2012/11/20
[ "https://Stackoverflow.com/questions/13477363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16998/" ]
If you have installed, for example, php 5.4 it could be switched in the following way to php 5.5: ``` $ php --version PHP 5.4.32 (cli) (built: Aug 26 2014 15:14:01) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies $ brew unlink php54 $ brew switch php55 5.5.16 $ p...
if @simon's answer is not working in some of the mac's please follow the below process. If you have already installed swiftgen using the following commands: $ `brew update` $ `brew install swiftgen` then follow the steps below in order to run swiftgen with older version. Step 1: `brew uninstall swiftgen` Step 2: Na...
13,477,363
I have a few kegs of the same package in `/usr/local/Cellar/libfoo` like `/usr/local/Cellar/libfoo/1.0.1`, `/usr/local/Cellar/libfoo/HEAD` and `/usr/local/Cellar/libfoo/mycopy` How can I brew link to a specific version?
2012/11/20
[ "https://Stackoverflow.com/questions/13477363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16998/" ]
**[This is probably the best way as of 11.1.2022](https://stackoverflow.com/a/9832084/1574376):** To install a specific version, e.g. postgresql 9.5 you simply run: ``` $ brew install postgresql@9.5 ``` To list the available versions run a search with @: ``` $ brew search postgresql@ ==> Formulae postgresql ...
if @simon's answer is not working in some of the mac's please follow the below process. If you have already installed swiftgen using the following commands: $ `brew update` $ `brew install swiftgen` then follow the steps below in order to run swiftgen with older version. Step 1: `brew uninstall swiftgen` Step 2: Na...
13,477,363
I have a few kegs of the same package in `/usr/local/Cellar/libfoo` like `/usr/local/Cellar/libfoo/1.0.1`, `/usr/local/Cellar/libfoo/HEAD` and `/usr/local/Cellar/libfoo/mycopy` How can I brew link to a specific version?
2012/11/20
[ "https://Stackoverflow.com/questions/13477363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16998/" ]
**[This is probably the best way as of 11.1.2022](https://stackoverflow.com/a/9832084/1574376):** To install a specific version, e.g. postgresql 9.5 you simply run: ``` $ brew install postgresql@9.5 ``` To list the available versions run a search with @: ``` $ brew search postgresql@ ==> Formulae postgresql ...
`brew switch libfoo mycopy` You can use `brew switch` to switch between versions of the same package, if it's installed as versioned subdirectories under `Cellar/<packagename>/` This will list versions installed ( for example I had `Cellar/sdl2/2.0.3`, I've compiled into `Cellar/sdl2/2.0.4`) ``` brew info sdl2 ``` ...
13,477,363
I have a few kegs of the same package in `/usr/local/Cellar/libfoo` like `/usr/local/Cellar/libfoo/1.0.1`, `/usr/local/Cellar/libfoo/HEAD` and `/usr/local/Cellar/libfoo/mycopy` How can I brew link to a specific version?
2012/11/20
[ "https://Stackoverflow.com/questions/13477363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16998/" ]
Sadly `brew switch` is deprecated in [Homebrew 2.6.0](https://brew.sh/2020/12/01/homebrew-2.6.0/) (December 2020) ``` $ brew switch Error: Unknown command: switch ``` TLDR, to switch to `package` version `10`: ```sh brew unlink package brew link package@10 ``` --- To use another version of a package, for example...
Homebrew removed `brew switch` subcommand in [Homebrew 2.6.0](https://brew.sh/2020/12/01/homebrew-2.6.0/). Get it back from [here](https://github.com/laggardkernel/homebrew-tap#external-commands). ```sh brew tap laggardkernel/tap brew switch --help ``` --- ### name@version formula There's mainly two ways to switch...
13,477,363
I have a few kegs of the same package in `/usr/local/Cellar/libfoo` like `/usr/local/Cellar/libfoo/1.0.1`, `/usr/local/Cellar/libfoo/HEAD` and `/usr/local/Cellar/libfoo/mycopy` How can I brew link to a specific version?
2012/11/20
[ "https://Stackoverflow.com/questions/13477363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16998/" ]
**[This is probably the best way as of 11.1.2022](https://stackoverflow.com/a/9832084/1574376):** To install a specific version, e.g. postgresql 9.5 you simply run: ``` $ brew install postgresql@9.5 ``` To list the available versions run a search with @: ``` $ brew search postgresql@ ==> Formulae postgresql ...
Homebrew removed `brew switch` subcommand in [Homebrew 2.6.0](https://brew.sh/2020/12/01/homebrew-2.6.0/). Get it back from [here](https://github.com/laggardkernel/homebrew-tap#external-commands). ```sh brew tap laggardkernel/tap brew switch --help ``` --- ### name@version formula There's mainly two ways to switch...
13,477,363
I have a few kegs of the same package in `/usr/local/Cellar/libfoo` like `/usr/local/Cellar/libfoo/1.0.1`, `/usr/local/Cellar/libfoo/HEAD` and `/usr/local/Cellar/libfoo/mycopy` How can I brew link to a specific version?
2012/11/20
[ "https://Stackoverflow.com/questions/13477363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16998/" ]
Homebrew removed `brew switch` subcommand in [Homebrew 2.6.0](https://brew.sh/2020/12/01/homebrew-2.6.0/). Get it back from [here](https://github.com/laggardkernel/homebrew-tap#external-commands). ```sh brew tap laggardkernel/tap brew switch --help ``` --- ### name@version formula There's mainly two ways to switch...
In case `brew switch` produces an error (in this example trying to switch to node version 14): ``` > brew switch node 14 Error: Calling `brew switch` is disabled! Use `brew link` @-versioned formulae instead. ``` The correct way switching versions would be : ``` > brew link --overwrite node@14 ```
13,477,363
I have a few kegs of the same package in `/usr/local/Cellar/libfoo` like `/usr/local/Cellar/libfoo/1.0.1`, `/usr/local/Cellar/libfoo/HEAD` and `/usr/local/Cellar/libfoo/mycopy` How can I brew link to a specific version?
2012/11/20
[ "https://Stackoverflow.com/questions/13477363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16998/" ]
Sadly `brew switch` is deprecated in [Homebrew 2.6.0](https://brew.sh/2020/12/01/homebrew-2.6.0/) (December 2020) ``` $ brew switch Error: Unknown command: switch ``` TLDR, to switch to `package` version `10`: ```sh brew unlink package brew link package@10 ``` --- To use another version of a package, for example...
if @simon's answer is not working in some of the mac's please follow the below process. If you have already installed swiftgen using the following commands: $ `brew update` $ `brew install swiftgen` then follow the steps below in order to run swiftgen with older version. Step 1: `brew uninstall swiftgen` Step 2: Na...
13,477,363
I have a few kegs of the same package in `/usr/local/Cellar/libfoo` like `/usr/local/Cellar/libfoo/1.0.1`, `/usr/local/Cellar/libfoo/HEAD` and `/usr/local/Cellar/libfoo/mycopy` How can I brew link to a specific version?
2012/11/20
[ "https://Stackoverflow.com/questions/13477363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16998/" ]
Homebrew removed `brew switch` subcommand in [Homebrew 2.6.0](https://brew.sh/2020/12/01/homebrew-2.6.0/). Get it back from [here](https://github.com/laggardkernel/homebrew-tap#external-commands). ```sh brew tap laggardkernel/tap brew switch --help ``` --- ### name@version formula There's mainly two ways to switch...
`brew switch libfoo mycopy` You can use `brew switch` to switch between versions of the same package, if it's installed as versioned subdirectories under `Cellar/<packagename>/` This will list versions installed ( for example I had `Cellar/sdl2/2.0.3`, I've compiled into `Cellar/sdl2/2.0.4`) ``` brew info sdl2 ``` ...
13,477,363
I have a few kegs of the same package in `/usr/local/Cellar/libfoo` like `/usr/local/Cellar/libfoo/1.0.1`, `/usr/local/Cellar/libfoo/HEAD` and `/usr/local/Cellar/libfoo/mycopy` How can I brew link to a specific version?
2012/11/20
[ "https://Stackoverflow.com/questions/13477363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16998/" ]
**[This is probably the best way as of 11.1.2022](https://stackoverflow.com/a/9832084/1574376):** To install a specific version, e.g. postgresql 9.5 you simply run: ``` $ brew install postgresql@9.5 ``` To list the available versions run a search with @: ``` $ brew search postgresql@ ==> Formulae postgresql ...
In case `brew switch` produces an error (in this example trying to switch to node version 14): ``` > brew switch node 14 Error: Calling `brew switch` is disabled! Use `brew link` @-versioned formulae instead. ``` The correct way switching versions would be : ``` > brew link --overwrite node@14 ```
13,477,363
I have a few kegs of the same package in `/usr/local/Cellar/libfoo` like `/usr/local/Cellar/libfoo/1.0.1`, `/usr/local/Cellar/libfoo/HEAD` and `/usr/local/Cellar/libfoo/mycopy` How can I brew link to a specific version?
2012/11/20
[ "https://Stackoverflow.com/questions/13477363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16998/" ]
`brew switch libfoo mycopy` You can use `brew switch` to switch between versions of the same package, if it's installed as versioned subdirectories under `Cellar/<packagename>/` This will list versions installed ( for example I had `Cellar/sdl2/2.0.3`, I've compiled into `Cellar/sdl2/2.0.4`) ``` brew info sdl2 ``` ...
if @simon's answer is not working in some of the mac's please follow the below process. If you have already installed swiftgen using the following commands: $ `brew update` $ `brew install swiftgen` then follow the steps below in order to run swiftgen with older version. Step 1: `brew uninstall swiftgen` Step 2: Na...
1,113,332
In my lecture notes we have the following: We have that $f(x, y), g(x, y) \in \mathbb{C}[x, y]$ $$f(x,y)=a\_0(y)+a\_1(y)x+ \dots +a\_n(y)x^n \\ g(x, y)=b\_0(y)+b\_1(y)x+ \dots +b\_m(y)x^m$$ The resultant is defined in the following way: $$Res(f,g)(y)=det\begin{bmatrix} a\_0(y) & a\_1(y) & \dots & a\_n(y) & 0 & ...
2015/01/21
[ "https://math.stackexchange.com/questions/1113332", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
In your case the matrix is given by: $$\begin{pmatrix}y^2 & 0 & 1 \\ y & 1 & 0 \\ 0 & y & 1 \end{pmatrix} $$ In general, note that you have $m$ lines of $a$'s and $n$ lines of $b$'s and most importantly that the final result need to be and $(n+m) \times (n+m)$ matrix. Put differently, to the first line of $a$'s pad...
The resultant is $$\begin{bmatrix} y^2 & 0 & 1\\ y & 1 & 0\\ 0 & y & 1 \end{bmatrix}$$ Since we need $m=1$ row of coefficients of $f$ and $n=2$ rows of coefficients of $g$.
23,538,025
I am trying to insert a column with column name 00:18:e7:f9:65:a6 with the statement ``` ALTER IGNORE TABLE tblwifi_information ADD "00:18:e7:f9:65:a6" INT ``` ...but it throws an error: ``` /* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo...
2014/05/08
[ "https://Stackoverflow.com/questions/23538025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583647/" ]
I just ran your query: ``` ALTER IGNORE TABLE tblwifi_information ADD "00:18:e7:f9:65:a6" INT ``` and got the same error. I then ran: ``` ALTER IGNORE TABLE tblwifi_information ADD `00:18:e7:f9:65:a6` INT ``` and it worked. Pretty sure you need to change " to ` Fail with double qoutes: ![Failed with double qu...
use backticks for columnname change ``` ALTER IGNORE TABLE tblwifi_information ADD "00:18:e7:f9:65:a6" INT ``` TO ``` ALTER IGNORE TABLE tblwifi_information ADD `00:18:e7:f9:65:a6` INT ``` [SQL FIDDLE](http://sqlfiddle.com/#!2/d248b/1) ==============================================
23,538,025
I am trying to insert a column with column name 00:18:e7:f9:65:a6 with the statement ``` ALTER IGNORE TABLE tblwifi_information ADD "00:18:e7:f9:65:a6" INT ``` ...but it throws an error: ``` /* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo...
2014/05/08
[ "https://Stackoverflow.com/questions/23538025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583647/" ]
I just ran your query: ``` ALTER IGNORE TABLE tblwifi_information ADD "00:18:e7:f9:65:a6" INT ``` and got the same error. I then ran: ``` ALTER IGNORE TABLE tblwifi_information ADD `00:18:e7:f9:65:a6` INT ``` and it worked. Pretty sure you need to change " to ` Fail with double qoutes: ![Failed with double qu...
i dont really know what you are trying to achive here pal. instead of: ``` 00:18:e7:f9:65:a6 ``` to ``` 00_18_e7_f9_65_a6 ``` then adjust your code to replace ":" to "\_" in php or mysql. **in sql:** ``` Replace(table_name, ':', '_'); ``` **in PHP:** ``` srt_replace(':','_',$query); ```
23,538,025
I am trying to insert a column with column name 00:18:e7:f9:65:a6 with the statement ``` ALTER IGNORE TABLE tblwifi_information ADD "00:18:e7:f9:65:a6" INT ``` ...but it throws an error: ``` /* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo...
2014/05/08
[ "https://Stackoverflow.com/questions/23538025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583647/" ]
I just ran your query: ``` ALTER IGNORE TABLE tblwifi_information ADD "00:18:e7:f9:65:a6" INT ``` and got the same error. I then ran: ``` ALTER IGNORE TABLE tblwifi_information ADD `00:18:e7:f9:65:a6` INT ``` and it worked. Pretty sure you need to change " to ` Fail with double qoutes: ![Failed with double qu...
To add something to the story, when querying multiple tables, you have to use following expression: ``` `tablename`.`columnname` ``` (NOT `tablename.columnname` ) I took me some time to figure it out, so I hope it helps someone :) Example: ``` SELECT * FROM tb_product p JOIN tb_brand b ON ( `p`.`tb_brand:IDbran...
23,538,025
I am trying to insert a column with column name 00:18:e7:f9:65:a6 with the statement ``` ALTER IGNORE TABLE tblwifi_information ADD "00:18:e7:f9:65:a6" INT ``` ...but it throws an error: ``` /* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo...
2014/05/08
[ "https://Stackoverflow.com/questions/23538025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583647/" ]
use backticks for columnname change ``` ALTER IGNORE TABLE tblwifi_information ADD "00:18:e7:f9:65:a6" INT ``` TO ``` ALTER IGNORE TABLE tblwifi_information ADD `00:18:e7:f9:65:a6` INT ``` [SQL FIDDLE](http://sqlfiddle.com/#!2/d248b/1) ==============================================
i dont really know what you are trying to achive here pal. instead of: ``` 00:18:e7:f9:65:a6 ``` to ``` 00_18_e7_f9_65_a6 ``` then adjust your code to replace ":" to "\_" in php or mysql. **in sql:** ``` Replace(table_name, ':', '_'); ``` **in PHP:** ``` srt_replace(':','_',$query); ```
23,538,025
I am trying to insert a column with column name 00:18:e7:f9:65:a6 with the statement ``` ALTER IGNORE TABLE tblwifi_information ADD "00:18:e7:f9:65:a6" INT ``` ...but it throws an error: ``` /* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo...
2014/05/08
[ "https://Stackoverflow.com/questions/23538025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583647/" ]
use backticks for columnname change ``` ALTER IGNORE TABLE tblwifi_information ADD "00:18:e7:f9:65:a6" INT ``` TO ``` ALTER IGNORE TABLE tblwifi_information ADD `00:18:e7:f9:65:a6` INT ``` [SQL FIDDLE](http://sqlfiddle.com/#!2/d248b/1) ==============================================
To add something to the story, when querying multiple tables, you have to use following expression: ``` `tablename`.`columnname` ``` (NOT `tablename.columnname` ) I took me some time to figure it out, so I hope it helps someone :) Example: ``` SELECT * FROM tb_product p JOIN tb_brand b ON ( `p`.`tb_brand:IDbran...
23,538,025
I am trying to insert a column with column name 00:18:e7:f9:65:a6 with the statement ``` ALTER IGNORE TABLE tblwifi_information ADD "00:18:e7:f9:65:a6" INT ``` ...but it throws an error: ``` /* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo...
2014/05/08
[ "https://Stackoverflow.com/questions/23538025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583647/" ]
To add something to the story, when querying multiple tables, you have to use following expression: ``` `tablename`.`columnname` ``` (NOT `tablename.columnname` ) I took me some time to figure it out, so I hope it helps someone :) Example: ``` SELECT * FROM tb_product p JOIN tb_brand b ON ( `p`.`tb_brand:IDbran...
i dont really know what you are trying to achive here pal. instead of: ``` 00:18:e7:f9:65:a6 ``` to ``` 00_18_e7_f9_65_a6 ``` then adjust your code to replace ":" to "\_" in php or mysql. **in sql:** ``` Replace(table_name, ':', '_'); ``` **in PHP:** ``` srt_replace(':','_',$query); ```
21,029,709
I am aware of the image resizing technic of changing image proportions based on width: ``` img{ max-width: 100%; height: auto; } ``` I need to do the same thing only based on the height of the parent, not the width. I have tried the following with no effect: ``` img{ width: auto; max-height: 100%; } ``` I...
2014/01/09
[ "https://Stackoverflow.com/questions/21029709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/857030/" ]
`max-height` will only restrict the height to be less than the given value. If you want it to be the same as its parent.. give it as `height: 100%` hence this should work: CSS: ``` img{ height: 100%; // changed max-height to height here width: auto; // this is optional } ```
You cannot effectively base it on the height using standard css techniques, but you can make the `height` relate directly to the `width` of the image for a more flexible layout. Try this: ``` img { position: relative; width: 50%; /* desired width */ } img:before{ content: ""; display: block; pa...
21,029,709
I am aware of the image resizing technic of changing image proportions based on width: ``` img{ max-width: 100%; height: auto; } ``` I need to do the same thing only based on the height of the parent, not the width. I have tried the following with no effect: ``` img{ width: auto; max-height: 100%; } ``` I...
2014/01/09
[ "https://Stackoverflow.com/questions/21029709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/857030/" ]
`max-height` will only restrict the height to be less than the given value. If you want it to be the same as its parent.. give it as `height: 100%` hence this should work: CSS: ``` img{ height: 100%; // changed max-height to height here width: auto; // this is optional } ```
i have tried this and it worked . ``` <div class="parent"> <img src="http://searchengineland.com/figz/wp-content/seloads/2014/07/google-logo-sign-1920-600x337.jpg" alt="..." /> </div> .parent { width: 100%; height: 180px; overflow: hidden; } ``` see it here <https://jsfiddle.net/shuhad/vaduvrno/...
21,029,709
I am aware of the image resizing technic of changing image proportions based on width: ``` img{ max-width: 100%; height: auto; } ``` I need to do the same thing only based on the height of the parent, not the width. I have tried the following with no effect: ``` img{ width: auto; max-height: 100%; } ``` I...
2014/01/09
[ "https://Stackoverflow.com/questions/21029709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/857030/" ]
You cannot effectively base it on the height using standard css techniques, but you can make the `height` relate directly to the `width` of the image for a more flexible layout. Try this: ``` img { position: relative; width: 50%; /* desired width */ } img:before{ content: ""; display: block; pa...
i have tried this and it worked . ``` <div class="parent"> <img src="http://searchengineland.com/figz/wp-content/seloads/2014/07/google-logo-sign-1920-600x337.jpg" alt="..." /> </div> .parent { width: 100%; height: 180px; overflow: hidden; } ``` see it here <https://jsfiddle.net/shuhad/vaduvrno/...
53,203,970
The following code can be fixed easily, but quite annoying. ```cpp #include <functional> #include <boost/bind.hpp> void foo() { using namespace std::placeholders; std::bind(_1, _2, _3); // ambiguous } ``` There's a macro `BOOST_BIND_NO_PLACEHOLDERS`, but using this macro will also bring some drawbacks like causi...
2018/11/08
[ "https://Stackoverflow.com/questions/53203970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2709407/" ]
Looks like it has been fixed in newer versions of boost. When including `boost/bind.hpp` we get this message: `#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_B...
You can use ``` #define BOOST_BIND_NO_PLACEHOLDERS ``` before including other Boost headers. I don't know when this was introduced, only that it works in 1.67. Feel free to edit with more accurate information.
53,203,970
The following code can be fixed easily, but quite annoying. ```cpp #include <functional> #include <boost/bind.hpp> void foo() { using namespace std::placeholders; std::bind(_1, _2, _3); // ambiguous } ``` There's a macro `BOOST_BIND_NO_PLACEHOLDERS`, but using this macro will also bring some drawbacks like causi...
2018/11/08
[ "https://Stackoverflow.com/questions/53203970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2709407/" ]
You can use ``` #define BOOST_BIND_NO_PLACEHOLDERS ``` before including other Boost headers. I don't know when this was introduced, only that it works in 1.67. Feel free to edit with more accurate information.
Either add: ``` #define BOOST_BIND_GLOBAL_PLACEHOLDERS ``` before you import boost headers. Or just add to your CMakeLists: ``` add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) ``` when you configure Boost.
53,203,970
The following code can be fixed easily, but quite annoying. ```cpp #include <functional> #include <boost/bind.hpp> void foo() { using namespace std::placeholders; std::bind(_1, _2, _3); // ambiguous } ``` There's a macro `BOOST_BIND_NO_PLACEHOLDERS`, but using this macro will also bring some drawbacks like causi...
2018/11/08
[ "https://Stackoverflow.com/questions/53203970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2709407/" ]
Looks like it has been fixed in newer versions of boost. When including `boost/bind.hpp` we get this message: `#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_B...
Either add: ``` #define BOOST_BIND_GLOBAL_PLACEHOLDERS ``` before you import boost headers. Or just add to your CMakeLists: ``` add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) ``` when you configure Boost.
237,698
I'm trying to understand the Bayes Classifier. I don't really understand its purpose or how to apply it, but I think I understand the parts of the formula: $$P(Y = j \mid X = x\_{0})$$ If I'm correct, it's asking for the largest probability, depending on one of two conditions. If $Y$ is equal to some class $j$, or if...
2016/09/30
[ "https://stats.stackexchange.com/questions/237698", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/132937/" ]
The Bayes classifier is the one that classifies according to the most likely category given the predictor $x$, i.e., $$ \text{arg max}\_j P(Y = j \mid X = x) . $$ Since these "true" probabilities are essentially never known, the Bayes classifier is more a theoretical concept and not something that you can actually us...
Interpret the formula as follows: What is the probability of Y being equal to j, when we know X = x0. So in your dataset, the bayes classifier is effectively computing probabilities of achieving blue or orange when you define the value of x. If in your data, when x is greater than 75, if 90% of the balls are orange, th...
5,294,957
What is the best way to securely authenticate a user ? So far I was thinking of: * Generate a random `$SALT` for each successful login and store `$logged = md5($hashed_password.$SALT)` into database; delete on logout. * Store `$logged` into a cookie (If user checked "remember me"). Set `$_SESSION['user'] = $logged;` ...
2011/03/14
[ "https://Stackoverflow.com/questions/5294957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/348358/" ]
The only issue I can see with your existing framework (which I like otherwise) is that there is the possibility of collision for `$logged`. It is not mathematically impossible for two valid user log-ins to result in the same hash. So I would just make sure to start storing the User `id` or some other unique informatio...
The first step is a bit overkill, as this is what `$_SESSION['foo']` basically does client-side for the lifetime of the session. I'd just store a salted and hashed password for each user to begin with, salting with the date or other pseudo-random factors. Setting the cookie might prove useless if the user clears their...
5,294,957
What is the best way to securely authenticate a user ? So far I was thinking of: * Generate a random `$SALT` for each successful login and store `$logged = md5($hashed_password.$SALT)` into database; delete on logout. * Store `$logged` into a cookie (If user checked "remember me"). Set `$_SESSION['user'] = $logged;` ...
2011/03/14
[ "https://Stackoverflow.com/questions/5294957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/348358/" ]
The first step is a bit overkill, as this is what `$_SESSION['foo']` basically does client-side for the lifetime of the session. I'd just store a salted and hashed password for each user to begin with, salting with the date or other pseudo-random factors. Setting the cookie might prove useless if the user clears their...
In first point you have mentioned It create random SALT string when user logged in and clear it when user log out. 1. Main problem is you have to check SALT string is exist or not in each redirection of page. So it create heavy traffic in Database server. 2. Yes this is very useful for checkout user already logged in...
5,294,957
What is the best way to securely authenticate a user ? So far I was thinking of: * Generate a random `$SALT` for each successful login and store `$logged = md5($hashed_password.$SALT)` into database; delete on logout. * Store `$logged` into a cookie (If user checked "remember me"). Set `$_SESSION['user'] = $logged;` ...
2011/03/14
[ "https://Stackoverflow.com/questions/5294957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/348358/" ]
The first step is a bit overkill, as this is what `$_SESSION['foo']` basically does client-side for the lifetime of the session. I'd just store a salted and hashed password for each user to begin with, salting with the date or other pseudo-random factors. Setting the cookie might prove useless if the user clears their...
One problem I can see - your solution sounds annoying for people who load your site in multiple browsers at the same time.
5,294,957
What is the best way to securely authenticate a user ? So far I was thinking of: * Generate a random `$SALT` for each successful login and store `$logged = md5($hashed_password.$SALT)` into database; delete on logout. * Store `$logged` into a cookie (If user checked "remember me"). Set `$_SESSION['user'] = $logged;` ...
2011/03/14
[ "https://Stackoverflow.com/questions/5294957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/348358/" ]
The only issue I can see with your existing framework (which I like otherwise) is that there is the possibility of collision for `$logged`. It is not mathematically impossible for two valid user log-ins to result in the same hash. So I would just make sure to start storing the User `id` or some other unique informatio...
In first point you have mentioned It create random SALT string when user logged in and clear it when user log out. 1. Main problem is you have to check SALT string is exist or not in each redirection of page. So it create heavy traffic in Database server. 2. Yes this is very useful for checkout user already logged in...
5,294,957
What is the best way to securely authenticate a user ? So far I was thinking of: * Generate a random `$SALT` for each successful login and store `$logged = md5($hashed_password.$SALT)` into database; delete on logout. * Store `$logged` into a cookie (If user checked "remember me"). Set `$_SESSION['user'] = $logged;` ...
2011/03/14
[ "https://Stackoverflow.com/questions/5294957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/348358/" ]
The only issue I can see with your existing framework (which I like otherwise) is that there is the possibility of collision for `$logged`. It is not mathematically impossible for two valid user log-ins to result in the same hash. So I would just make sure to start storing the User `id` or some other unique informatio...
First No need of doing ``` Store $logged into a cookie (If user checked "remember me") ``` Starting the session should be the first thing you should do place `session_start()` on top of your index.php (file which gets executed) . This way a cookie name "phpsessid" gets created on user browser by default independent ...
5,294,957
What is the best way to securely authenticate a user ? So far I was thinking of: * Generate a random `$SALT` for each successful login and store `$logged = md5($hashed_password.$SALT)` into database; delete on logout. * Store `$logged` into a cookie (If user checked "remember me"). Set `$_SESSION['user'] = $logged;` ...
2011/03/14
[ "https://Stackoverflow.com/questions/5294957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/348358/" ]
The only issue I can see with your existing framework (which I like otherwise) is that there is the possibility of collision for `$logged`. It is not mathematically impossible for two valid user log-ins to result in the same hash. So I would just make sure to start storing the User `id` or some other unique informatio...
One problem I can see - your solution sounds annoying for people who load your site in multiple browsers at the same time.
5,294,957
What is the best way to securely authenticate a user ? So far I was thinking of: * Generate a random `$SALT` for each successful login and store `$logged = md5($hashed_password.$SALT)` into database; delete on logout. * Store `$logged` into a cookie (If user checked "remember me"). Set `$_SESSION['user'] = $logged;` ...
2011/03/14
[ "https://Stackoverflow.com/questions/5294957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/348358/" ]
First No need of doing ``` Store $logged into a cookie (If user checked "remember me") ``` Starting the session should be the first thing you should do place `session_start()` on top of your index.php (file which gets executed) . This way a cookie name "phpsessid" gets created on user browser by default independent ...
In first point you have mentioned It create random SALT string when user logged in and clear it when user log out. 1. Main problem is you have to check SALT string is exist or not in each redirection of page. So it create heavy traffic in Database server. 2. Yes this is very useful for checkout user already logged in...
5,294,957
What is the best way to securely authenticate a user ? So far I was thinking of: * Generate a random `$SALT` for each successful login and store `$logged = md5($hashed_password.$SALT)` into database; delete on logout. * Store `$logged` into a cookie (If user checked "remember me"). Set `$_SESSION['user'] = $logged;` ...
2011/03/14
[ "https://Stackoverflow.com/questions/5294957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/348358/" ]
First No need of doing ``` Store $logged into a cookie (If user checked "remember me") ``` Starting the session should be the first thing you should do place `session_start()` on top of your index.php (file which gets executed) . This way a cookie name "phpsessid" gets created on user browser by default independent ...
One problem I can see - your solution sounds annoying for people who load your site in multiple browsers at the same time.
58,646,186
I have a problem where I'm having two arrays. Whenever I'm changing a value in one array with the code shown below, the other array do also get the same change which is not intended. If i copy and paste the code below in the javascript console in my browser I get the problem that originalArray is changed after I called...
2019/10/31
[ "https://Stackoverflow.com/questions/58646186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7425546/" ]
You should look at [`getchar()`](https://linux.die.net/man/3/getchar) ``` #include <stdio.h> int main() { int c1; while ((c1=getchar())!=EOF && c1!='*'){ printf("c1: %c \n", c1); } return 0; } ``` EDIT: and this way, there is no undefined behavior, because `c1` is always initialized (see @Bla...
You could switch the `scanf` and `printf` statements and put an initial `scanf` before the loop: ``` int main() { char c1 = '\0'; do { printf("c1: %c \n", c1); if (scanf(" %c", &c1) != 1) return -1; } while (c1 != '*'); return 0; } ``` Also note that as your program curren...
58,646,186
I have a problem where I'm having two arrays. Whenever I'm changing a value in one array with the code shown below, the other array do also get the same change which is not intended. If i copy and paste the code below in the javascript console in my browser I get the problem that originalArray is changed after I called...
2019/10/31
[ "https://Stackoverflow.com/questions/58646186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7425546/" ]
You could switch the `scanf` and `printf` statements and put an initial `scanf` before the loop: ``` int main() { char c1 = '\0'; do { printf("c1: %c \n", c1); if (scanf(" %c", &c1) != 1) return -1; } while (c1 != '*'); return 0; } ``` Also note that as your program curren...
Using `scanf()` *and* doing complete error checking and logging: ``` #include <stdlib.h> #include <stdio.h> #include <errno.h> int main(void) { int result = EXIT_SUCCESS; /* Be optimistic. */ { int r; { char c1 = 0; while (EOF != (r = fscanf(stdin, " %c", &c1)) && c1 != '*') { ...
58,646,186
I have a problem where I'm having two arrays. Whenever I'm changing a value in one array with the code shown below, the other array do also get the same change which is not intended. If i copy and paste the code below in the javascript console in my browser I get the problem that originalArray is changed after I called...
2019/10/31
[ "https://Stackoverflow.com/questions/58646186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7425546/" ]
You could switch the `scanf` and `printf` statements and put an initial `scanf` before the loop: ``` int main() { char c1 = '\0'; do { printf("c1: %c \n", c1); if (scanf(" %c", &c1) != 1) return -1; } while (c1 != '*'); return 0; } ``` Also note that as your program curren...
Use while or for when you want to check the condition at the start of the loop, do ... until if you want to check at the end. If you want to check in the middle, I prefer an infinite loop ("while(TRUE)" or "for(;;)") and using if/break in the middle. Taking your loop, that would be: ``` while (TRUE){ scanf("%c", &...
58,646,186
I have a problem where I'm having two arrays. Whenever I'm changing a value in one array with the code shown below, the other array do also get the same change which is not intended. If i copy and paste the code below in the javascript console in my browser I get the problem that originalArray is changed after I called...
2019/10/31
[ "https://Stackoverflow.com/questions/58646186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7425546/" ]
You could switch the `scanf` and `printf` statements and put an initial `scanf` before the loop: ``` int main() { char c1 = '\0'; do { printf("c1: %c \n", c1); if (scanf(" %c", &c1) != 1) return -1; } while (c1 != '*'); return 0; } ``` Also note that as your program curren...
``` #include<stdio.h> #include<ctype.h> int main() { char string; do { printf("String is :%c\n",string); if(scanf("%c",&string)!=1) { return 0; } }while(string!='*'); return 0 } ``` Here: --- Firs...
58,646,186
I have a problem where I'm having two arrays. Whenever I'm changing a value in one array with the code shown below, the other array do also get the same change which is not intended. If i copy and paste the code below in the javascript console in my browser I get the problem that originalArray is changed after I called...
2019/10/31
[ "https://Stackoverflow.com/questions/58646186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7425546/" ]
You should look at [`getchar()`](https://linux.die.net/man/3/getchar) ``` #include <stdio.h> int main() { int c1; while ((c1=getchar())!=EOF && c1!='*'){ printf("c1: %c \n", c1); } return 0; } ``` EDIT: and this way, there is no undefined behavior, because `c1` is always initialized (see @Bla...
Using `scanf()` *and* doing complete error checking and logging: ``` #include <stdlib.h> #include <stdio.h> #include <errno.h> int main(void) { int result = EXIT_SUCCESS; /* Be optimistic. */ { int r; { char c1 = 0; while (EOF != (r = fscanf(stdin, " %c", &c1)) && c1 != '*') { ...
58,646,186
I have a problem where I'm having two arrays. Whenever I'm changing a value in one array with the code shown below, the other array do also get the same change which is not intended. If i copy and paste the code below in the javascript console in my browser I get the problem that originalArray is changed after I called...
2019/10/31
[ "https://Stackoverflow.com/questions/58646186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7425546/" ]
You should look at [`getchar()`](https://linux.die.net/man/3/getchar) ``` #include <stdio.h> int main() { int c1; while ((c1=getchar())!=EOF && c1!='*'){ printf("c1: %c \n", c1); } return 0; } ``` EDIT: and this way, there is no undefined behavior, because `c1` is always initialized (see @Bla...
Use while or for when you want to check the condition at the start of the loop, do ... until if you want to check at the end. If you want to check in the middle, I prefer an infinite loop ("while(TRUE)" or "for(;;)") and using if/break in the middle. Taking your loop, that would be: ``` while (TRUE){ scanf("%c", &...
58,646,186
I have a problem where I'm having two arrays. Whenever I'm changing a value in one array with the code shown below, the other array do also get the same change which is not intended. If i copy and paste the code below in the javascript console in my browser I get the problem that originalArray is changed after I called...
2019/10/31
[ "https://Stackoverflow.com/questions/58646186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7425546/" ]
You should look at [`getchar()`](https://linux.die.net/man/3/getchar) ``` #include <stdio.h> int main() { int c1; while ((c1=getchar())!=EOF && c1!='*'){ printf("c1: %c \n", c1); } return 0; } ``` EDIT: and this way, there is no undefined behavior, because `c1` is always initialized (see @Bla...
``` #include<stdio.h> #include<ctype.h> int main() { char string; do { printf("String is :%c\n",string); if(scanf("%c",&string)!=1) { return 0; } }while(string!='*'); return 0 } ``` Here: --- Firs...
58,646,186
I have a problem where I'm having two arrays. Whenever I'm changing a value in one array with the code shown below, the other array do also get the same change which is not intended. If i copy and paste the code below in the javascript console in my browser I get the problem that originalArray is changed after I called...
2019/10/31
[ "https://Stackoverflow.com/questions/58646186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7425546/" ]
Using `scanf()` *and* doing complete error checking and logging: ``` #include <stdlib.h> #include <stdio.h> #include <errno.h> int main(void) { int result = EXIT_SUCCESS; /* Be optimistic. */ { int r; { char c1 = 0; while (EOF != (r = fscanf(stdin, " %c", &c1)) && c1 != '*') { ...
Use while or for when you want to check the condition at the start of the loop, do ... until if you want to check at the end. If you want to check in the middle, I prefer an infinite loop ("while(TRUE)" or "for(;;)") and using if/break in the middle. Taking your loop, that would be: ``` while (TRUE){ scanf("%c", &...
58,646,186
I have a problem where I'm having two arrays. Whenever I'm changing a value in one array with the code shown below, the other array do also get the same change which is not intended. If i copy and paste the code below in the javascript console in my browser I get the problem that originalArray is changed after I called...
2019/10/31
[ "https://Stackoverflow.com/questions/58646186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7425546/" ]
Using `scanf()` *and* doing complete error checking and logging: ``` #include <stdlib.h> #include <stdio.h> #include <errno.h> int main(void) { int result = EXIT_SUCCESS; /* Be optimistic. */ { int r; { char c1 = 0; while (EOF != (r = fscanf(stdin, " %c", &c1)) && c1 != '*') { ...
``` #include<stdio.h> #include<ctype.h> int main() { char string; do { printf("String is :%c\n",string); if(scanf("%c",&string)!=1) { return 0; } }while(string!='*'); return 0 } ``` Here: --- Firs...
4,028,536
What's the best way to make a select in this case, and output it without using nested queries in php? I would prefer to make it with a single query. My tables look like this: ``` table1 id | items | ---|-------| 1 | item1 | 2 | item2 | 3 | item3 | .. | .. | table2 id | itemid | comment | ---|--------|------...
2010/10/26
[ "https://Stackoverflow.com/questions/4028536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/488174/" ]
Checkout this JSON framework for Objective-C on [code.google.com](http://code.google.com/p/json-framework/) or on [Github](http://stig.github.com/json-framework/). It is pretty straightforward to use. You instantiate your SBJSON object then call *objectWithString* with your buffer: ``` SBJSON * parser = [[SBJSON allo...
There are a few out there, see: <http://code.google.com/p/json-framework/> <http://github.com/schwa/TouchJSON> for a big list: <http://www.json.org/> is a great reference site for JSON
4,028,536
What's the best way to make a select in this case, and output it without using nested queries in php? I would prefer to make it with a single query. My tables look like this: ``` table1 id | items | ---|-------| 1 | item1 | 2 | item2 | 3 | item3 | .. | .. | table2 id | itemid | comment | ---|--------|------...
2010/10/26
[ "https://Stackoverflow.com/questions/4028536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/488174/" ]
There are a few out there, see: <http://code.google.com/p/json-framework/> <http://github.com/schwa/TouchJSON> for a big list: <http://www.json.org/> is a great reference site for JSON
I'm using YAJLiOS parser,not bad and compatable with ARC, here's documentation <http://gabriel.github.com/yajl-objc/> and parser itself on github <https://github.com/gabriel/yajl-objc> ex. ``` NSData *JSONData = [NSData dataWithContentsOfFile:@"someJson.json"]; NSDictionary *JSONDictionary = [tempContainer...
4,028,536
What's the best way to make a select in this case, and output it without using nested queries in php? I would prefer to make it with a single query. My tables look like this: ``` table1 id | items | ---|-------| 1 | item1 | 2 | item2 | 3 | item3 | .. | .. | table2 id | itemid | comment | ---|--------|------...
2010/10/26
[ "https://Stackoverflow.com/questions/4028536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/488174/" ]
Checkout this JSON framework for Objective-C on [code.google.com](http://code.google.com/p/json-framework/) or on [Github](http://stig.github.com/json-framework/). It is pretty straightforward to use. You instantiate your SBJSON object then call *objectWithString* with your buffer: ``` SBJSON * parser = [[SBJSON allo...
I'm using YAJLiOS parser,not bad and compatable with ARC, here's documentation <http://gabriel.github.com/yajl-objc/> and parser itself on github <https://github.com/gabriel/yajl-objc> ex. ``` NSData *JSONData = [NSData dataWithContentsOfFile:@"someJson.json"]; NSDictionary *JSONDictionary = [tempContainer...
32,353,300
I need to search trough my data that is stored in my `UITableView`. I need one left bar button item and when the user clicked that, it should show like a search bar. How to do that?. Thanks in advance! **edited:** ok based on solution you provide.Here i have done some thing with search bar (bar button item). but sti...
2015/09/02
[ "https://Stackoverflow.com/questions/32353300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5203412/" ]
I had a similar problem. To fix it, I created an SSIS "Composant Script" in which I created a "guid" output. The script VS C# code was the following : ``` Row.guid = Guid.NewGuid(); ``` Finally, I routed the output as a derived column into my database "OLE DB Destination" to generate a guid for every new entry.
Simply do it in an Execute SQL Task. * Open the task * Under General -> SQL Statement, enter your query `Select NewID() MyID` in the "SQLStatement" field * Under General -> Result Set, choose "Single row" * Under Parameter Mapping, Enter your User::myID in Variable Name, "Input" as direction, 0 as Parameter Name, and...
23,697,956
I am developing a Windows Phone 8.0 App in VS2010 and in some point , i decided to make 2 classes (Player,Game) **Game.cs** ``` public class Game { public string Name { get; set; } public bool[] LevelsUnlocked { get; set; } public bool firstTimePlaying { get; set; } public Game(int numOfLevels) ...
2014/05/16
[ "https://Stackoverflow.com/questions/23697956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3264464/" ]
You must initialize a list before using it. This: ``` public List<Game> Games; ``` ..needs to be this: ``` public List<Game> Games = new List<Game>(); ``` I am surprised you are getting an `AccessViolationException`.. I would have expected a `NullReferenceException`.
You haven't set your Games to a new list. ``` public List<Game> Games = new List<Game>(); public Player() { Game HourGlass = new Game(6); Game CommonNumbers = new Game(11); Games.Add(HourGlass); Games.Add(CommonNumbers); } ```
106,477
I am writing a technical paper where I have described an experiment resulting in "x". Then I go on to describe the result of a second experiment whose result was expected since the reason was deduced in the previous experiment (x). I'm looking for a phrase to tie the two sentences together but I did not want to use "as...
2013/03/07
[ "https://english.stackexchange.com/questions/106477", "https://english.stackexchange.com", "https://english.stackexchange.com/users/38999/" ]
"**Confirming the hypothesis**" always sounds good in a technical paper. Or "**as hypothesized**". If you are noting agreement with previous results, you can say "**validating/confirming results from...**".
**Paralleled** > > a person or thing that is similar or analogous to another. > > > The experimental results **paralleled** the theoretically expected results outlined in Paper/Report/Experiment x/y/z Alternatively: * Corresponded * Analogous The correct word choice would also depend on the way the information...
106,477
I am writing a technical paper where I have described an experiment resulting in "x". Then I go on to describe the result of a second experiment whose result was expected since the reason was deduced in the previous experiment (x). I'm looking for a phrase to tie the two sentences together but I did not want to use "as...
2013/03/07
[ "https://english.stackexchange.com/questions/106477", "https://english.stackexchange.com", "https://english.stackexchange.com/users/38999/" ]
Consider [synonyms](http://thesaurus.com/browse/consistent) of *[consistent](http://en.wiktionary.org/wiki/consistent#Adjective)*, such as *[compatible](http://en.wiktionary.org/wiki/compatible#Adjective)* and *[congruent](http://en.wiktionary.org/wiki/congruent#Adjective)*; eg, “Results of experiment B were consistent...
If the results of your second experiment were predicted by the first experiment then there was no need to carry the former. Maybe you deduced from the first experiment's results that the second experiment might give certain results, or you had doubts about the reasons for the results of the first experiment. In this ca...
106,477
I am writing a technical paper where I have described an experiment resulting in "x". Then I go on to describe the result of a second experiment whose result was expected since the reason was deduced in the previous experiment (x). I'm looking for a phrase to tie the two sentences together but I did not want to use "as...
2013/03/07
[ "https://english.stackexchange.com/questions/106477", "https://english.stackexchange.com", "https://english.stackexchange.com/users/38999/" ]
"**Confirming the hypothesis**" always sounds good in a technical paper. Or "**as hypothesized**". If you are noting agreement with previous results, you can say "**validating/confirming results from...**".
If the results of your second experiment were predicted by the first experiment then there was no need to carry the former. Maybe you deduced from the first experiment's results that the second experiment might give certain results, or you had doubts about the reasons for the results of the first experiment. In this ca...
106,477
I am writing a technical paper where I have described an experiment resulting in "x". Then I go on to describe the result of a second experiment whose result was expected since the reason was deduced in the previous experiment (x). I'm looking for a phrase to tie the two sentences together but I did not want to use "as...
2013/03/07
[ "https://english.stackexchange.com/questions/106477", "https://english.stackexchange.com", "https://english.stackexchange.com/users/38999/" ]
Consider [synonyms](http://thesaurus.com/browse/consistent) of *[consistent](http://en.wiktionary.org/wiki/consistent#Adjective)*, such as *[compatible](http://en.wiktionary.org/wiki/compatible#Adjective)* and *[congruent](http://en.wiktionary.org/wiki/congruent#Adjective)*; eg, “Results of experiment B were consistent...
The primary question asks for a **linking phrase** for a discussion of "***expected***" results from a secondary experiment. You could say the results of the second experiment were "***anticipated***". > > The results of the second experiment were "**anticipated in support > of**" deductions made during the first ex...
106,477
I am writing a technical paper where I have described an experiment resulting in "x". Then I go on to describe the result of a second experiment whose result was expected since the reason was deduced in the previous experiment (x). I'm looking for a phrase to tie the two sentences together but I did not want to use "as...
2013/03/07
[ "https://english.stackexchange.com/questions/106477", "https://english.stackexchange.com", "https://english.stackexchange.com/users/38999/" ]
I think the word you are looking for is **corroborate**: > > [**corroborate**](http://www.merriam-webster.com/dictionary/corroborate): to > support or help prove (a statement, theory, etc.) by providing information or evidence > > > So, you performed a first experiment resulting in "x". The result "x" supports y...
If the results of your second experiment were predicted by the first experiment then there was no need to carry the former. Maybe you deduced from the first experiment's results that the second experiment might give certain results, or you had doubts about the reasons for the results of the first experiment. In this ca...
106,477
I am writing a technical paper where I have described an experiment resulting in "x". Then I go on to describe the result of a second experiment whose result was expected since the reason was deduced in the previous experiment (x). I'm looking for a phrase to tie the two sentences together but I did not want to use "as...
2013/03/07
[ "https://english.stackexchange.com/questions/106477", "https://english.stackexchange.com", "https://english.stackexchange.com/users/38999/" ]
"Corollary" is the usual technical/scientific term to describe the consequent or expected sets of derivative results or conclusions of a main theory, hypothesis or experiment. > > [cor·ol·lar·y](http://www.thefreedictionary.com/corollary) (kôr-lr, kr-) > n. pl. cor·ol·lar·ies > > > > 1. A proposition that follo...
"Therefore it proves that" also passes off in a technical paper.
106,477
I am writing a technical paper where I have described an experiment resulting in "x". Then I go on to describe the result of a second experiment whose result was expected since the reason was deduced in the previous experiment (x). I'm looking for a phrase to tie the two sentences together but I did not want to use "as...
2013/03/07
[ "https://english.stackexchange.com/questions/106477", "https://english.stackexchange.com", "https://english.stackexchange.com/users/38999/" ]
How about: clearly, apparently, obviously, evidently, patently? The word obviously can sometimes affect readers adversely, "well, it wasn't so obvious to me."
[Ergo](http://www.merriam-webster.com/dictionary/ergo) > > : therefore, hence > > > (definition from m-w.com)
106,477
I am writing a technical paper where I have described an experiment resulting in "x". Then I go on to describe the result of a second experiment whose result was expected since the reason was deduced in the previous experiment (x). I'm looking for a phrase to tie the two sentences together but I did not want to use "as...
2013/03/07
[ "https://english.stackexchange.com/questions/106477", "https://english.stackexchange.com", "https://english.stackexchange.com/users/38999/" ]
Consider [synonyms](http://thesaurus.com/browse/consistent) of *[consistent](http://en.wiktionary.org/wiki/consistent#Adjective)*, such as *[compatible](http://en.wiktionary.org/wiki/compatible#Adjective)* and *[congruent](http://en.wiktionary.org/wiki/congruent#Adjective)*; eg, “Results of experiment B were consistent...
"Corollary" is the usual technical/scientific term to describe the consequent or expected sets of derivative results or conclusions of a main theory, hypothesis or experiment. > > [cor·ol·lar·y](http://www.thefreedictionary.com/corollary) (kôr-lr, kr-) > n. pl. cor·ol·lar·ies > > > > 1. A proposition that follo...
106,477
I am writing a technical paper where I have described an experiment resulting in "x". Then I go on to describe the result of a second experiment whose result was expected since the reason was deduced in the previous experiment (x). I'm looking for a phrase to tie the two sentences together but I did not want to use "as...
2013/03/07
[ "https://english.stackexchange.com/questions/106477", "https://english.stackexchange.com", "https://english.stackexchange.com/users/38999/" ]
The primary question asks for a **linking phrase** for a discussion of "***expected***" results from a secondary experiment. You could say the results of the second experiment were "***anticipated***". > > The results of the second experiment were "**anticipated in support > of**" deductions made during the first ex...
"Therefore it proves that" also passes off in a technical paper.
106,477
I am writing a technical paper where I have described an experiment resulting in "x". Then I go on to describe the result of a second experiment whose result was expected since the reason was deduced in the previous experiment (x). I'm looking for a phrase to tie the two sentences together but I did not want to use "as...
2013/03/07
[ "https://english.stackexchange.com/questions/106477", "https://english.stackexchange.com", "https://english.stackexchange.com/users/38999/" ]
"**Confirming the hypothesis**" always sounds good in a technical paper. Or "**as hypothesized**". If you are noting agreement with previous results, you can say "**validating/confirming results from...**".
"Corollary" is the usual technical/scientific term to describe the consequent or expected sets of derivative results or conclusions of a main theory, hypothesis or experiment. > > [cor·ol·lar·y](http://www.thefreedictionary.com/corollary) (kôr-lr, kr-) > n. pl. cor·ol·lar·ies > > > > 1. A proposition that follo...
39,131,812
if I want to express something like [just a simple example]: ``` int a = 0; for (int x = 0; x < n; x += 1) a = 1 - a; ``` what should I do in Haskell, *since it doesn't have variable concept?* (maybe wrong, see: [Does Haskell have variables?](https://stackoverflow.com/questions/993124/does-haskell-have-variables...
2016/08/24
[ "https://Stackoverflow.com/questions/39131812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4280916/" ]
Often, repetition that you would perform with a loop in a procedural language is accomplished with [recursion](http://learnyouahaskell.com/recursion) in Haskell. In this case, you should think about what the result of the loop is. It appears to alternate between 0 and 1. There are several ways to do this in Haskell. On...
In Haskell instead of using loops, you combine standard library functions and/or your own recursive function to achieve the desired effect. In your example code you seem to be setting `a` to either 0 or 1 depending on whether or not `n` is even (in a rather confusing fashion if I'm honest). To achieve the same in Hask...
39,131,812
if I want to express something like [just a simple example]: ``` int a = 0; for (int x = 0; x < n; x += 1) a = 1 - a; ``` what should I do in Haskell, *since it doesn't have variable concept?* (maybe wrong, see: [Does Haskell have variables?](https://stackoverflow.com/questions/993124/does-haskell-have-variables...
2016/08/24
[ "https://Stackoverflow.com/questions/39131812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4280916/" ]
There are a few options. First, you can rewrite the problem with naive recursion: ``` loop :: Int -> Int loop n = loop' n 0 where loop' 0 a = a loop' n a = loop' (n - 1) (1 - a) ``` Next, you can restate recursion as a fold: ``` loop :: Int -> Int loop n = foldr (\a _ -> 1 - a) 0 [0..n] ``` Or you can u...
In Haskell instead of using loops, you combine standard library functions and/or your own recursive function to achieve the desired effect. In your example code you seem to be setting `a` to either 0 or 1 depending on whether or not `n` is even (in a rather confusing fashion if I'm honest). To achieve the same in Hask...