qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
41,152,377
I have the following setup where I'm trying to use an array of array structure. I'm not sure how to get the key value once the value is found in the array of arrays. ``` $testboat = 'smallest boat'; $allboats = array(40=>array(1=>'big boat', 2=>'bigger boat' ), ...
2016/12/14
[ "https://Stackoverflow.com/questions/41152377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4398966/" ]
Use the `$key => $value` syntax of `foreach()`. Also, no need to loop through the inner arrays: ``` foreach($allboats as $key => $boats){ if(in_array($testboat, $boats)) { echo $key; break; //if you want to stop after found } } ``` If you want to get the outer key and the inner key: ``` fore...
You'd have to do the following: ``` foreach($allboats as key1 => $boats){ foreach($boats as key2 => $boat){ ```
274,490
I am unable to connect to other machines with the same domain and network. SQL Server 2008 is running, I can connect locally with MSSQL01\Administrator and password using Windows authentication. Although I would like other servers also to be able to access it... but it fails with the following error: ``` Login failed...
2011/05/27
[ "https://serverfault.com/questions/274490", "https://serverfault.com", "https://serverfault.com/users/81502/" ]
You do not say how they are trying to access it, but there is almost certainly a method to provide an alternative username and password, and you would want to specify MSSQL01\Administrator (in that exact form, unless there is a box for a domain). You are probably trying to connect as the administrator on the foreign ho...
Check the `SQL server configuration manager>SQL server network configuration>Protocols...`. Make sure that TCP/IP is enabled. Hope this helps.
274,490
I am unable to connect to other machines with the same domain and network. SQL Server 2008 is running, I can connect locally with MSSQL01\Administrator and password using Windows authentication. Although I would like other servers also to be able to access it... but it fails with the following error: ``` Login failed...
2011/05/27
[ "https://serverfault.com/questions/274490", "https://serverfault.com", "https://serverfault.com/users/81502/" ]
`MSSQL01\Administrator` is not a domain account (if I'm reading things correctly), it is a machine local account. You won't be able to use that account to authenticate to other domain machines, you'll need to use a domain account to do that.
Check the `SQL server configuration manager>SQL server network configuration>Protocols...`. Make sure that TCP/IP is enabled. Hope this helps.
54,526,142
I want to have a div that shows/hides another div. It is not possible to work with toggle, because at the end it must work with cookies (I take jquery.cookie.js) to remember the changes when the site is reload. (I built a search-result with Drupal search API and give out some facets. but when I choose an item of a fac...
2019/02/05
[ "https://Stackoverflow.com/questions/54526142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11015154/" ]
It looks like your file could be a FEI SEM TIFF, which contains INI like metadata in TIFF tag 34682. Try using [tifffile](https://pypi.org/project/tifffile/): ``` import tifffile with tifffile.TiffFile('FEI_SEM.tif') as tif: print(tif.fei_metadata['Scan']['PixelWidth']) ```
Using PIL, I think it would be clearer to use a for loop to set up your dictionary, and then print the desired result. ``` from PIL import Image from PIL.TiffTags import TAGS with Image.open(imagetoanalyze) as img: meta_dict = {} for key in img.tag: # don't really need iterkeys in this context me...
37,770,301
my code is: ``` ggplot(test.data,aes(x=log(out),y=log(n))) + geom_point(aes(colour="red")) ``` then I get: [![enter image description here](https://i.stack.imgur.com/6NOto.jpg)](https://i.stack.imgur.com/6NOto.jpg) But I don't want log(out) = 0 or log(n) = 0 to be plotted what should I do?
2016/06/12
[ "https://Stackoverflow.com/questions/37770301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5975905/" ]
You need to either filter out the data of `test.data` - which you can do by performing the log function prior to plotting and filtering the data, or.... you could try setting the x and y limits to something like ``` + xlim(0.0001, 10) + ylim(0.0001,10) ``` You have to make the first value large enough that it's abov...
You could just subset the data before plotting, as in: ``` ggplot(subset(test.data, out!=1 & n!=1), aes(x=log(out),y=log(n))) + geom_point(aes(colour="red")) ```
37,770,301
my code is: ``` ggplot(test.data,aes(x=log(out),y=log(n))) + geom_point(aes(colour="red")) ``` then I get: [![enter image description here](https://i.stack.imgur.com/6NOto.jpg)](https://i.stack.imgur.com/6NOto.jpg) But I don't want log(out) = 0 or log(n) = 0 to be plotted what should I do?
2016/06/12
[ "https://Stackoverflow.com/questions/37770301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5975905/" ]
I would prefer to first exclude (or replace them by `NA`) all such values (i.e. `n==1` & `out==1`) and then plot it. This is many time useful if one want to show zeros in the plot. For e.g. > > Something like your plot > > > ``` test.data = data.frame ( sample (1:10,100,replace=TRUE), sample (1:10, 100, replace=T...
You could just subset the data before plotting, as in: ``` ggplot(subset(test.data, out!=1 & n!=1), aes(x=log(out),y=log(n))) + geom_point(aes(colour="red")) ```
65,386,181
I want to count the distinct number of fd\_id over the time between today and yesterday, between today and 3 days ago, between today and 5 days ago, between today and 7 days ago, between today and 15 days ago, between today and 30 days ago. My data table looks like the following: ``` user_id. fd_id. date ...
2020/12/21
[ "https://Stackoverflow.com/questions/65386181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4962535/" ]
You can use conditional aggregation: ``` select user_id, count(distinct case when date >= current_date - 1 day and date < current_date then fd_id end) as cnt_1d, count(distinct case when date >= current_date - 3 day and date < current_date then fd_id end) as cnt_3d, ... from mytable goup by user_id ``` Y...
If the `date` column in the the table really does look like that (not in date/datetime format), I think you need to use `STR_TO_DATE()` to convert it to date format then uses `DATEDIFF` to check the date differences. Consider this example query: ``` SELECT user_id, MAX(CASE WHEN ddiff=1 THEN cn END) AS count_f...
95,630
I am trying to find a code that will output the prime factor decomposition of a number but for some reason I keep getting error messages. It is supposed to output the exponent of 2 and the odd factor. So for 528 it would output 2^4 x 33. Any ideas? ``` prime[x_] := Module[{a, i, y}, a = x/2; i ...
2015/09/27
[ "https://mathematica.stackexchange.com/questions/95630", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/34416/" ]
Try this, just to get you started. Function arguments can't be modified in the module so I've used `x0` to allow your code to run. ``` prime[x0_] := Module[{a, i, y, x}, x = x0; a = x/2; i = 0 ; If[IntegerQ[x] == False, Print["Input integer."]; Return[]]; While[IntegerQ[x] == True, x = x/2; i = i +...
``` CenterDot @@ (Superscript @@@ FactorInteger[528]) ``` $2^4\cdot 3^1\cdot 11^1$ Or... if you don't like exponents of "1": ``` CenterDot @@ (If[#[[2]] != 1, Superscript[#[[1]], #[[2]]], #[[1]]] & ) /@ FactorInteger[528] ``` $2^4\cdot 3\cdot 11$
95,630
I am trying to find a code that will output the prime factor decomposition of a number but for some reason I keep getting error messages. It is supposed to output the exponent of 2 and the odd factor. So for 528 it would output 2^4 x 33. Any ideas? ``` prime[x_] := Module[{a, i, y}, a = x/2; i ...
2015/09/27
[ "https://mathematica.stackexchange.com/questions/95630", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/34416/" ]
Try this, just to get you started. Function arguments can't be modified in the module so I've used `x0` to allow your code to run. ``` prime[x0_] := Module[{a, i, y, x}, x = x0; a = x/2; i = 0 ; If[IntegerQ[x] == False, Print["Input integer."]; Return[]]; While[IntegerQ[x] == True, x = x/2; i = i +...
Personally I think the neatest way is: ``` powerOf2[x_Integer] := powerOf2[x/2] + {1, 0} powerOf2[x_] := {-1, 2 x} powerOf2[528] ```
95,630
I am trying to find a code that will output the prime factor decomposition of a number but for some reason I keep getting error messages. It is supposed to output the exponent of 2 and the odd factor. So for 528 it would output 2^4 x 33. Any ideas? ``` prime[x_] := Module[{a, i, y}, a = x/2; i ...
2015/09/27
[ "https://mathematica.stackexchange.com/questions/95630", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/34416/" ]
Try this, just to get you started. Function arguments can't be modified in the module so I've used `x0` to allow your code to run. ``` prime[x0_] := Module[{a, i, y, x}, x = x0; a = x/2; i = 0 ; If[IntegerQ[x] == False, Print["Input integer."]; Return[]]; While[IntegerQ[x] == True, x = x/2; i = i +...
You could use the built-in function `IntegerExponent` as follows. ``` EvenOddFactorsOf[n_?OddQ] := {{0, n}, Apply[CenterDot, {Superscript[2, 0], n}]} EvenOddFactorsOf[n_] := With[{e = IntegerExponent[n, 2]}, {{e, n/2^e}, Apply[CenterDot, {Superscript[2, e], n/2^e}]}] ``` The function returns two formats....
95,630
I am trying to find a code that will output the prime factor decomposition of a number but for some reason I keep getting error messages. It is supposed to output the exponent of 2 and the odd factor. So for 528 it would output 2^4 x 33. Any ideas? ``` prime[x_] := Module[{a, i, y}, a = x/2; i ...
2015/09/27
[ "https://mathematica.stackexchange.com/questions/95630", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/34416/" ]
There are several problems with your code. * The first one is that you are missing a couple of semicolons to suppress output and delineate substatements in a compound function. * The second problem is that you are trying to assign a new value to `x` within the function definition. This doesn't work. `x` already has t...
``` CenterDot @@ (Superscript @@@ FactorInteger[528]) ``` $2^4\cdot 3^1\cdot 11^1$ Or... if you don't like exponents of "1": ``` CenterDot @@ (If[#[[2]] != 1, Superscript[#[[1]], #[[2]]], #[[1]]] & ) /@ FactorInteger[528] ``` $2^4\cdot 3\cdot 11$
95,630
I am trying to find a code that will output the prime factor decomposition of a number but for some reason I keep getting error messages. It is supposed to output the exponent of 2 and the odd factor. So for 528 it would output 2^4 x 33. Any ideas? ``` prime[x_] := Module[{a, i, y}, a = x/2; i ...
2015/09/27
[ "https://mathematica.stackexchange.com/questions/95630", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/34416/" ]
There are several problems with your code. * The first one is that you are missing a couple of semicolons to suppress output and delineate substatements in a compound function. * The second problem is that you are trying to assign a new value to `x` within the function definition. This doesn't work. `x` already has t...
Personally I think the neatest way is: ``` powerOf2[x_Integer] := powerOf2[x/2] + {1, 0} powerOf2[x_] := {-1, 2 x} powerOf2[528] ```
95,630
I am trying to find a code that will output the prime factor decomposition of a number but for some reason I keep getting error messages. It is supposed to output the exponent of 2 and the odd factor. So for 528 it would output 2^4 x 33. Any ideas? ``` prime[x_] := Module[{a, i, y}, a = x/2; i ...
2015/09/27
[ "https://mathematica.stackexchange.com/questions/95630", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/34416/" ]
There are several problems with your code. * The first one is that you are missing a couple of semicolons to suppress output and delineate substatements in a compound function. * The second problem is that you are trying to assign a new value to `x` within the function definition. This doesn't work. `x` already has t...
You could use the built-in function `IntegerExponent` as follows. ``` EvenOddFactorsOf[n_?OddQ] := {{0, n}, Apply[CenterDot, {Superscript[2, 0], n}]} EvenOddFactorsOf[n_] := With[{e = IntegerExponent[n, 2]}, {{e, n/2^e}, Apply[CenterDot, {Superscript[2, e], n/2^e}]}] ``` The function returns two formats....
650,352
i am required to back up certain rows from certain tables from a database. often the criteria requires joins and such. what's a good way to accomplish this? (i don't have to use mysqldump).
2009/03/16
[ "https://Stackoverflow.com/questions/650352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I would say just backup the entire database. That will be an easier process, and you'll more easily maintain identity integrity in case you need to restore a backup.
If you are only interested in backing up the data, and don't need to output it as SQL, you can put your select SQL statements into a file and execute those using the mysql command, re-directing to a file like this: ``` mysql my_database < queries.sql > backup.txt ``` There are some additional options as far as delim...
57,216
> > **Possible Duplicate:** > > [Use of the superlative when only two items are present](https://english.stackexchange.com/questions/5697/use-of-the-superlative-when-only-two-items-are-present) > > > Is the word *better* used in comparing two things, or do you use the word *best*? Example used in a conversati...
2012/02/06
[ "https://english.stackexchange.com/questions/57216", "https://english.stackexchange.com", "https://english.stackexchange.com/users/17838/" ]
Usually, when there are two options, one of them is *better* than the other. If there are multiple options, you can choose *the best* among them. I think the underlying reason for this is that when there are only two options, the better of them is also the best. > > Who's *better* at math: Beth or Seth? Seth's *bette...
When you use *best*, you say it in absolute terms. While *better* is used in relative terms. When something is *best*, its position is uncontested. While *better* suggests 'compared to others, this is one is good'
57,216
> > **Possible Duplicate:** > > [Use of the superlative when only two items are present](https://english.stackexchange.com/questions/5697/use-of-the-superlative-when-only-two-items-are-present) > > > Is the word *better* used in comparing two things, or do you use the word *best*? Example used in a conversati...
2012/02/06
[ "https://english.stackexchange.com/questions/57216", "https://english.stackexchange.com", "https://english.stackexchange.com/users/17838/" ]
Usually, when there are two options, one of them is *better* than the other. If there are multiple options, you can choose *the best* among them. I think the underlying reason for this is that when there are only two options, the better of them is also the best. > > Who's *better* at math: Beth or Seth? Seth's *bette...
"Better" is a comparative, i.e. it is a relationship between two things. "Best" is a superlative, i.e. it states the position of this one thing compared to all the other things under discussion. If I have three choices, A, B, and C, all the following statements could be true: A is better than B. B is better than C. A ...
15,438,694
My goal I want to achieve is to inject enum to Spring managed bean. I do not want my bean be configured in XML (there no reason to do so except this not-working enum). I have simple maven project: ```xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
2013/03/15
[ "https://Stackoverflow.com/questions/15438694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/384674/" ]
Someone has made the solution into a gem: <https://github.com/basecamp/local_time>
> > in client (js): > > > ``` function set_time_zone_offset() { var current_time = new Date(); $.cookie('time_zone', current_time.getTimezoneOffset()); } ``` > > in Application Controller: > > > ``` before_filter :set_timezone def set_timezone min = request.cookies["time_zone"].to_i Time.zone ...
24,494,336
I have folders and files with the following structure and some of the files contains the string `ModuleName`. ``` ModuleName ├── Application\ Logic │   └── Interactor │   ├── ModuleNameInteractor.swift │   └── ModuleNameInteractorIO.swift ├── Module\ Interface │   └── IModuleNameModule.swift └── User\ Interfac...
2014/06/30
[ "https://Stackoverflow.com/questions/24494336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3545547/" ]
I'd use `sed -i` (in-place replace) for the content replacements, and a `find|while read` loop for the renames. Here's the BSD sed (standard on Macs) version: ``` find . -type f -exec sed -e s/ModuleName/TestModule/g -i '' '{}' ';' find . -depth -name '*ModuleName*' -print0|while IFS= read -rd '' f; do mv -i "$f" "$(...
After trying to fight with the terminal, I found out that the Massreplaceit app available for free [here](http://www.hexmonkeysoftware.com) can handle this problem very easily PS : I am not working there !
1,433,348
SubSonic newbe question; I want to put custom attributes on properties in the generated classes, is that possible?
2009/09/16
[ "https://Stackoverflow.com/questions/1433348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/137597/" ]
It's definitely possible. Is this SubSonic 2 or 3? It's doable for either one, but the question of where to find the templates is different depending on which one you're using. Edit: For SubSonic 2, follow [this link](http://subsonicproject.com/docs/2.0_Configuration) and look at the entry on "templateDirectory". For ...
There's two ways to do this: * If you want to add them at generation time you can do what Skinniest Man suggests and modify the templates to add them. * If you want to add them manually things are a little more tricky and you'll need to create a '[buddy class](http://www.google.co.uk/search?hl=en&q=buddy+class+data+a...
57,521,055
I am having a map with multiple ol/Feature markers. When clicking on a marker some code should be executed. The problem is that I get this error when trying to call a method when a clicked is performed: TypeError: this.methodCall is not a function at Select. ```js ngOnInit() { ....... this.setMapInteraction(); ...
2019/08/16
[ "https://Stackoverflow.com/questions/57521055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7726452/" ]
Inside the `select` callback `this` is the `select` object, so you need to save the scope, for example: ``` setMapInteraction() { var select = new Select({}); this.map.addInteraction(select); var self = this; select.on('select', function (evt) { var selectedString = evt.selected[0].getStyle()[1].getText()....
This looks like a context issue: Try below: ``` setMapInteraction() { var select = new Select({}); this.map.addInteraction(select); select.on('select', function (evt) { var selectedString = evt.selected[0].getStyle()[1].getText().getText(); console.log(selectedString); //Selected string is printed fine....
57,521,055
I am having a map with multiple ol/Feature markers. When clicking on a marker some code should be executed. The problem is that I get this error when trying to call a method when a clicked is performed: TypeError: this.methodCall is not a function at Select. ```js ngOnInit() { ....... this.setMapInteraction(); ...
2019/08/16
[ "https://Stackoverflow.com/questions/57521055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7726452/" ]
Inside the `select` callback `this` is the `select` object, so you need to save the scope, for example: ``` setMapInteraction() { var select = new Select({}); this.map.addInteraction(select); var self = this; select.on('select', function (evt) { var selectedString = evt.selected[0].getStyle()[1].getText()....
try something like ``` map.on('click', function(e) { var iconFeatureA = map.getFeaturesAtPixel(e.pixel); if (iconFeatureA !== null) { var location = iconFeatureA[0].get("coordinat"); alert(location); } }); ``` this will work with every pixel of your features of map.
57,521,055
I am having a map with multiple ol/Feature markers. When clicking on a marker some code should be executed. The problem is that I get this error when trying to call a method when a clicked is performed: TypeError: this.methodCall is not a function at Select. ```js ngOnInit() { ....... this.setMapInteraction(); ...
2019/08/16
[ "https://Stackoverflow.com/questions/57521055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7726452/" ]
This looks like a context issue: Try below: ``` setMapInteraction() { var select = new Select({}); this.map.addInteraction(select); select.on('select', function (evt) { var selectedString = evt.selected[0].getStyle()[1].getText().getText(); console.log(selectedString); //Selected string is printed fine....
try something like ``` map.on('click', function(e) { var iconFeatureA = map.getFeaturesAtPixel(e.pixel); if (iconFeatureA !== null) { var location = iconFeatureA[0].get("coordinat"); alert(location); } }); ``` this will work with every pixel of your features of map.
43,455,699
I have a TfIDF matrix of size ``` tr_tfidf_q1.shape, tr_tfidf_q2.shape which gives ( (404288, 83766), (404288, 83766) ) ``` Now I save it using ``` np.save('tr_tfidf_q1.npy', tr_tfidf_q1) ``` When I load the file like this ``` f = np.load('tr_tfidf_q1.npy') f.shape() ## returns an empty array. () ``` Thank...
2017/04/17
[ "https://Stackoverflow.com/questions/43455699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6765115/" ]
``` In [172]: from scipy import sparse In [173]: M=sparse.csr_matrix(np.eye(10)) In [174]: np.save('test.npy',M) In [175]: f=np.load('test.npy') In [176]: f Out[176]: array(<10x10 sparse matrix of type '<class 'numpy.float64'>' with 10 stored elements in Compressed Sparse Row format>, dtype=object) ``` Note the...
Lol.. I just did.. ``` f = np.load('tr_tfidf.npy') f ## returns the below. array(<404288x83766 sparse matrix of type '<class 'numpy.float64'>' with 2117757 stored elements in Compressed Sparse Row format>, dtype=object) ``` I belive XYZ.shape works with references as well.
1,004,848
I have a Contact List web part I developed that is dependent on a custom list I created, also called Contact List. But instead of the web part ALWAYS requiring a list called Contact List whenever the web part is added to a page, I want it so I can add the web part to a page THEN set which list I want it to use. I guess...
2009/06/17
[ "https://Stackoverflow.com/questions/1004848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Sounds like you want to create a WebPart with Custom Properties. The following articles should help: * [Creating a Web Part with Custom Properties (MSDN)](http://msdn.microsoft.com/en-us/library/dd584174.aspx) * [Web Parts in Office SharePoint Server](http://blogs.msdn.com/brianwilson/archive/2008/07/13/web-parts-in-o...
For anyone else out there that may need to do this, I wrote a How-to on my solution, which tells about creating a custom property but also goes into what to show the user when the property is not set or not set properly. [How to set a SharePoint web part's list at run time](http://simplesharepointsolutions.blogspot.com...
49,827,887
I'm working through a React tutorial which uses old-school `require` syntax, and trying to update it to the more modern `import` syntax from ES6. The tutorial suggests we start our JS file with the lines `var React = require("react"); var ReactDOM = require("react-dom"); require("./index.css");` I've figured out tha...
2018/04/14
[ "https://Stackoverflow.com/questions/49827887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3874926/" ]
``` <script type="text/javascript"> $(".download").click(function(){ window.location.href = 'file/30mb.pdf'; //set your file url which want to download var data = []; for (var i = 0; i < 100000; i++) { var tmp = []; for (var i = 0; i < 100000; i++) { tmp[i] = 'hue'; } data[i] = tmp;...
You could use a plugin like [ajax-progress](https://github.com/likerRr/jq-ajax-progress). I've created a small replication on [jsfiddle](https://jsfiddle.net/cbkcn7d0/6/) ``` const url = '//somefile.pdf' $.ajax(url, { progress: function(e) { if (e.lengthComputable) { const completedPercentage = Math.roun...
31,498,571
My intention is to call two cases inside another case in the same switch statement, ``` switch (orderType) { case 1: statement 1; break; case 2: statement 2; break; case 3: **call case 1;** **Call case 2;** br...
2015/07/19
[ "https://Stackoverflow.com/questions/31498571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4947388/" ]
No, you can't *jump* to the code snippet in another switch case. You can however extract the code into an own method that can be called from another case: ``` switch (orderType) { case 1: someMethod1(); break; case 2: someMethod2(); break; case 3: someMethod1(); ...
You can't just call a another `case` block like this. What you could do, though, is wrap each of these blocks in a method, and reuse them: ``` private void doSomething() { // implementation } private void doSomethingElse() { // implementation } private void runSwitch(int order) { switch (orderType) { ...
31,498,571
My intention is to call two cases inside another case in the same switch statement, ``` switch (orderType) { case 1: statement 1; break; case 2: statement 2; break; case 3: **call case 1;** **Call case 2;** br...
2015/07/19
[ "https://Stackoverflow.com/questions/31498571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4947388/" ]
Although you cannot influence the `switch` cases directly, you can call switch's parent method from one case and pass different arguments. For example, ``` void foo(int param1, String param2, ...) { switch (param1) { case 0: foo(1, "some string"); break; case 1: ...
No, you can't *jump* to the code snippet in another switch case. You can however extract the code into an own method that can be called from another case: ``` switch (orderType) { case 1: someMethod1(); break; case 2: someMethod2(); break; case 3: someMethod1(); ...
31,498,571
My intention is to call two cases inside another case in the same switch statement, ``` switch (orderType) { case 1: statement 1; break; case 2: statement 2; break; case 3: **call case 1;** **Call case 2;** br...
2015/07/19
[ "https://Stackoverflow.com/questions/31498571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4947388/" ]
No, you can't *jump* to the code snippet in another switch case. You can however extract the code into an own method that can be called from another case: ``` switch (orderType) { case 1: someMethod1(); break; case 2: someMethod2(); break; case 3: someMethod1(); ...
You can use this trick in some case : ``` switch (orderType) { case 3: statement 3; case 2: statement 2; case 1: statement 1; break; default: break;` ``` }
31,498,571
My intention is to call two cases inside another case in the same switch statement, ``` switch (orderType) { case 1: statement 1; break; case 2: statement 2; break; case 3: **call case 1;** **Call case 2;** br...
2015/07/19
[ "https://Stackoverflow.com/questions/31498571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4947388/" ]
No, you can't *jump* to the code snippet in another switch case. You can however extract the code into an own method that can be called from another case: ``` switch (orderType) { case 1: someMethod1(); break; case 2: someMethod2(); break; case 3: someMethod1(); ...
Using methods is the best way to do it as mentioned in the accepted answer but for some reasons if you are unable to create method, Here is one more way to do this without using methods ``` boolean isBreakTheLoop = false, isCase2Required = false; while(!isBreakTheLoop){ switch (orderType) { case 1: ...
31,498,571
My intention is to call two cases inside another case in the same switch statement, ``` switch (orderType) { case 1: statement 1; break; case 2: statement 2; break; case 3: **call case 1;** **Call case 2;** br...
2015/07/19
[ "https://Stackoverflow.com/questions/31498571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4947388/" ]
Although you cannot influence the `switch` cases directly, you can call switch's parent method from one case and pass different arguments. For example, ``` void foo(int param1, String param2, ...) { switch (param1) { case 0: foo(1, "some string"); break; case 1: ...
You can't just call a another `case` block like this. What you could do, though, is wrap each of these blocks in a method, and reuse them: ``` private void doSomething() { // implementation } private void doSomethingElse() { // implementation } private void runSwitch(int order) { switch (orderType) { ...
31,498,571
My intention is to call two cases inside another case in the same switch statement, ``` switch (orderType) { case 1: statement 1; break; case 2: statement 2; break; case 3: **call case 1;** **Call case 2;** br...
2015/07/19
[ "https://Stackoverflow.com/questions/31498571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4947388/" ]
You can't just call a another `case` block like this. What you could do, though, is wrap each of these blocks in a method, and reuse them: ``` private void doSomething() { // implementation } private void doSomethingElse() { // implementation } private void runSwitch(int order) { switch (orderType) { ...
You can use this trick in some case : ``` switch (orderType) { case 3: statement 3; case 2: statement 2; case 1: statement 1; break; default: break;` ``` }
31,498,571
My intention is to call two cases inside another case in the same switch statement, ``` switch (orderType) { case 1: statement 1; break; case 2: statement 2; break; case 3: **call case 1;** **Call case 2;** br...
2015/07/19
[ "https://Stackoverflow.com/questions/31498571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4947388/" ]
You can't just call a another `case` block like this. What you could do, though, is wrap each of these blocks in a method, and reuse them: ``` private void doSomething() { // implementation } private void doSomethingElse() { // implementation } private void runSwitch(int order) { switch (orderType) { ...
Using methods is the best way to do it as mentioned in the accepted answer but for some reasons if you are unable to create method, Here is one more way to do this without using methods ``` boolean isBreakTheLoop = false, isCase2Required = false; while(!isBreakTheLoop){ switch (orderType) { case 1: ...
31,498,571
My intention is to call two cases inside another case in the same switch statement, ``` switch (orderType) { case 1: statement 1; break; case 2: statement 2; break; case 3: **call case 1;** **Call case 2;** br...
2015/07/19
[ "https://Stackoverflow.com/questions/31498571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4947388/" ]
Although you cannot influence the `switch` cases directly, you can call switch's parent method from one case and pass different arguments. For example, ``` void foo(int param1, String param2, ...) { switch (param1) { case 0: foo(1, "some string"); break; case 1: ...
You can use this trick in some case : ``` switch (orderType) { case 3: statement 3; case 2: statement 2; case 1: statement 1; break; default: break;` ``` }
31,498,571
My intention is to call two cases inside another case in the same switch statement, ``` switch (orderType) { case 1: statement 1; break; case 2: statement 2; break; case 3: **call case 1;** **Call case 2;** br...
2015/07/19
[ "https://Stackoverflow.com/questions/31498571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4947388/" ]
Although you cannot influence the `switch` cases directly, you can call switch's parent method from one case and pass different arguments. For example, ``` void foo(int param1, String param2, ...) { switch (param1) { case 0: foo(1, "some string"); break; case 1: ...
Using methods is the best way to do it as mentioned in the accepted answer but for some reasons if you are unable to create method, Here is one more way to do this without using methods ``` boolean isBreakTheLoop = false, isCase2Required = false; while(!isBreakTheLoop){ switch (orderType) { case 1: ...
31,498,571
My intention is to call two cases inside another case in the same switch statement, ``` switch (orderType) { case 1: statement 1; break; case 2: statement 2; break; case 3: **call case 1;** **Call case 2;** br...
2015/07/19
[ "https://Stackoverflow.com/questions/31498571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4947388/" ]
Using methods is the best way to do it as mentioned in the accepted answer but for some reasons if you are unable to create method, Here is one more way to do this without using methods ``` boolean isBreakTheLoop = false, isCase2Required = false; while(!isBreakTheLoop){ switch (orderType) { case 1: ...
You can use this trick in some case : ``` switch (orderType) { case 3: statement 3; case 2: statement 2; case 1: statement 1; break; default: break;` ``` }
12,025,593
I have a php script that resides in a single folder I want to run the same script in each folder wihout manually uploading the php file in each file for example I have mysite.com/folder/script.php and folder has different subfolders so I want to create a php file that will execute this script.php in each folder/subf...
2012/08/19
[ "https://Stackoverflow.com/questions/12025593", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1561466/" ]
Assuming you are using Apache, you could use [mod\_rewrite](http://httpd.apache.org/docs/current/mod/mod_rewrite.html) by creating a `htaccess` file that looks like this: ``` RewriteEngine on RewriteBase /folder/ RewriteRule ^.+/script.php$ script.php ``` And uploading it to your server. This turns the `RewriteEngi...
On your subfolder's page, include this code: ``` require_once dirname(__FILE__) . "/folder/script.php"; ``` Is this what you mean?
2,106,912
I have an integer "myInt" in some Objective-C code. myInt is used as a boolean... hence I'm only interested in zero or non-zero values. I'd like to quickly switch between zero and a non-zero value. What's the fastest way to do this? Here's what I've tried so far: (All of these work) **Try 1**: ``` // myInt is initi...
2010/01/21
[ "https://Stackoverflow.com/questions/2106912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22471/" ]
Try 2 is the most compact, cleanest, and easier to maintain. Why second guess the compiler's optimization?
In general, to switch between 0 and some constant integer a, use ``` myInt = a - myInt ```
2,106,912
I have an integer "myInt" in some Objective-C code. myInt is used as a boolean... hence I'm only interested in zero or non-zero values. I'd like to quickly switch between zero and a non-zero value. What's the fastest way to do this? Here's what I've tried so far: (All of these work) **Try 1**: ``` // myInt is initi...
2010/01/21
[ "https://Stackoverflow.com/questions/2106912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22471/" ]
Try 2 is the most compact, cleanest, and easier to maintain. Why second guess the compiler's optimization?
It depends. Are you compiling for ARM, x86\_64, i386, PPC, or 6502? The difference is academic, but if you really want to know which is faster you will have to look at the disassembled code generated by your compiler.
5,941,114
I am pretty new to Scala and advanced programming languages. I try to solve the following problem. I have got: ``` val s: Seq[SomeMutableType[_]] ``` I assume that all elements in the sequence are of the same type (but do not know which one at this point). How may I call : ``` def proc[T](v0: SomeMutableType[T], ...
2011/05/09
[ "https://Stackoverflow.com/questions/5941114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/709898/" ]
The problem is that you truly cannot make such a guarantee. For example: ``` scala> import scala.collection.mutable.Buffer import scala.collection.mutable.Buffer scala> val s: Seq[Buffer[_]] = Seq(Buffer(1), Buffer("a")) s: Seq[scala.collection.mutable.Buffer[_]] = List(ArrayBuffer(1), ArrayBuffer(a)) ``` See? You ...
I am new to Scala, but as far as I can see your problem is the use of a wildcard type parameter when you declare s: ``` val s: Seq[SomeMutableType[_]] ``` As far as I understand, type erasure will always happen and what you really want here is a parameterised type bound to where s is initialised. For example: ``` ...
47,093,430
How I can use `coalesce` to check if a variable (`@var`) is ',' and if so replace it with '' (empty string)? Something like the reverse of: ``` coalese(',','') ``` So if `@var = ','` then I want `@var = ''` But if `@var = 'a,b'` then I dont want it changed -> `@var = 'a,b'`
2017/11/03
[ "https://Stackoverflow.com/questions/47093430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8345061/" ]
Coalesce is specifically for handling NULL.. maybe use the replace function? ``` replace(field,',','') ``` <https://learn.microsoft.com/en-us/sql/t-sql/functions/replace-transact-sql> for something more specific you can use case: ``` case when field = ',' then '' else field end ``` <https://learn.microsoft.com/e...
Coalesce is use to check null values only. You can use case statement for this : ``` select case when col_name=',' then '' else col_name end as col_name ```
9,520,686
Is there a way to do inline pydocs in iPython the same way it works in bpython. bpython screenshots from their site: ![bpython xrange docs](https://i.stack.imgur.com/5Jnil.png) ![bpython os pydocs](https://i.stack.imgur.com/rPudT.png)
2012/03/01
[ "https://Stackoverflow.com/questions/9520686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/204535/" ]
It would be bad practice to segment your invoice by table names. Properly [normalized table](http://en.wikipedia.org/wiki/Database_normalization) would have a `DateTime` column that can indicate the year of the invoice (more likely this already exists as the Invoice Date Issued). If you need to grab only a specific ye...
Look into the [Multiple Entity Sets per Type (MEST)](http://msdn.microsoft.com/en-us/library/bb738537.aspx) feature of the Entity Framework. It doesn't have designer support, so you'll have edit the .edmx file by hand, but otherwise it pretty much works.
9,520,686
Is there a way to do inline pydocs in iPython the same way it works in bpython. bpython screenshots from their site: ![bpython xrange docs](https://i.stack.imgur.com/5Jnil.png) ![bpython os pydocs](https://i.stack.imgur.com/rPudT.png)
2012/03/01
[ "https://Stackoverflow.com/questions/9520686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/204535/" ]
I also was researching the answer to this. For many reasons, it can be desirable to have multiple contextual tables based on a common schema, so I understand your question. Try this article at <http://theruntime.com/blogs/jacob/archive/2008/08/27/changing-table-names-in-an-orm.aspx> The author there went to pains t...
Look into the [Multiple Entity Sets per Type (MEST)](http://msdn.microsoft.com/en-us/library/bb738537.aspx) feature of the Entity Framework. It doesn't have designer support, so you'll have edit the .edmx file by hand, but otherwise it pretty much works.
29,285,604
I have a bunch of `.cs` files that represent test cases for certain manipulations using the Roslyn API. Since they are supposed to have valid compile time syntax, I would like to have Intellisense, Resharper and other pre-compile time checks available on those files when writing in them, but not to actually compile the...
2015/03/26
[ "https://Stackoverflow.com/questions/29285604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/768207/" ]
You can set default values for your method parameters. Note that that also makes them optional when you call your method: ``` public function __construct($var1 = true, $var2 = 'foo bar') ```
maybe u need something like this ``` class Test { protected $var1; protected $var2; public function __construct($var1=true, $var2='foo bar') { $this->var1 = $var1; $this->var2 = $var2; } public function setVar1($var1) { $this->var1=$var1; } public function getVar1() { retur...
54,853
I have an optimization question. I want to solve the following problem: $$ \arg\min\_S\frac{1}{2}\|s-c\|\_2^2 +\lambda\|\Phi s\|\_1 \mbox{ s.t. } As = 0 $$ in which $\Phi$ is the wavelet transform operator. My strategy is to find the close form solution of the lasso problem by using the orthogonal invariance proper...
2019/01/16
[ "https://dsp.stackexchange.com/questions/54853", "https://dsp.stackexchange.com", "https://dsp.stackexchange.com/users/29511/" ]
Indeed you can not solve the problem ignoring the equality constraints and then project the solution onto the set of solution for the constraint. It is easy to build real world example which shows that. Yet, it might be that in most cases it will work reasonably well. You didn't mention how you solve the LASSO Proble...
Why not add an $\alpha\|As\|$ term to the optimization instead of having it as a constraint?
225,358
I'm looking to re-paint a room and have noticed there are areas around the woodwork (i.e. woodwork around the doors) that seem to be peeling away from where the woodwork meets the wall. I imagine if I just paint over them then this will be noticeable in the end. I'm very new to home DIY and haven't come across anythin...
2021/05/31
[ "https://diy.stackexchange.com/questions/225358", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/135822/" ]
Sorry. No You cannot tell the difference between a 10 amp 240 volt load and two 10 amp 120 volt loads, one on each leg. In both cases, you will see 10 amps on each hot and 0 amps on neutral. In fact, if your loads on both legs were equal and constant, you could disconnect the neutral from the POCO to the panel and yo...
No, that math is all goofy and will give you a lesser value than you want If you want a single ampacity figure (presumably for peak rate setting, equipment sizing, or fusing purposes): -------------------------------------------------------------------------------------------------------------- * Measure the amps on ...
27,420,434
The `max-height` property value seems to be ignored when the inner padding is greater than the max-height value. For example, setting this class on an element causes the max-height to be ignored. ``` .max-height-ignored { height: 0; /* or auto, makes no difference */ max-height: 40px; padding: 0 0 50% 50%;...
2014/12/11
[ "https://Stackoverflow.com/questions/27420434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4349434/" ]
The min/max width/height properties never take any other box dimensions into account, neither borders nor padding. They only constrain the used values of the `width` and `height` properties respectively. [Section 10 of CSS2.1](http://www.w3.org/TR/CSS21/visudet.html) does not explicitly mention borders or padding in th...
It might be obvious, but as a work around, you might be able to limit the width of the **wrapper** using `max-width`. In my particular case, this required a `max-width: 50vh` ([`vh`: percentage of viewport height](https://developer.mozilla.org/en/docs/Web/CSS/length#Viewport-percentage_lengths)).
310,775
> > Miss Watson’s **n--ger**, Jim, had a hair-ball as big as your fist, which had been took out of the fourth stomach of an ox, and he used to do magic with it. He said there was a spirit inside of it, and it knowed everything. > > > I know that the N-word in modern English is highly offensive. However, this text ...
2022/03/03
[ "https://ell.stackexchange.com/questions/310775", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/152413/" ]
N--ger has always meant that black people are inferior to white people. But the book takes place around 1840 in America when most white people thought that was true. Jim was a slave. Saying the N-word really was common then, and wouldn't shock anyone since white people said it all the time and believed such a horrible ...
This is somewhat debatable from today's perspective. There are in fact institutions in the USA where reading *Huckleberry Finn* has been taken off the curriculum precisely because of this issue. *Probably* the rationale is dominantly that they don't want to expose young readers to this language out of fear that they w...
310,775
> > Miss Watson’s **n--ger**, Jim, had a hair-ball as big as your fist, which had been took out of the fourth stomach of an ox, and he used to do magic with it. He said there was a spirit inside of it, and it knowed everything. > > > I know that the N-word in modern English is highly offensive. However, this text ...
2022/03/03
[ "https://ell.stackexchange.com/questions/310775", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/152413/" ]
N--ger has always meant that black people are inferior to white people. But the book takes place around 1840 in America when most white people thought that was true. Jim was a slave. Saying the N-word really was common then, and wouldn't shock anyone since white people said it all the time and believed such a horrible ...
Yes, use of the N-word is racist. You can put Huckleberry Finn in historical context to understand that the N-word was once used widely, hence it being written in the book without censorship. But even back then, the N-word was used to discriminate. You would have to ask a sociologist or a historian to get a proper answ...
1,922,652
Problem: *A particle follows a trajectory given by $\sigma(t)=(t^{2},t^{3}-4t,0)$ and it off at a tangent at $t=2$. Find the particle's position at $t=3$. Make a draw of what is happening.* Solution: [![Particle's position](https://i.stack.imgur.com/ka8JG.jpg)](https://i.stack.imgur.com/ka8JG.jpg) And this is what ...
2016/09/11
[ "https://math.stackexchange.com/questions/1922652", "https://math.stackexchange.com", "https://math.stackexchange.com/users/103590/" ]
By integrating by parts $$\int\_0^\infty(1-F\_X(x))dx -\int\_{-\infty}^0F\_X(x)dx= [x(1-F\_X(x))]\_0^{+\infty}-\int\_0^{+\infty} xd(1-F\_X(x)) \\ -[xF\_X(x)]\_{-\infty}^0+\int\_{-\infty}^0xdF\_X(x) =0+\int\_0^{+\infty} xdF\_X(x)-0+\int\_{-\infty}^0 xdF\_X\\=\int\_{-\infty}^{+\infty} xdF\_X(x)=E[X].$$ P.S. Note that by...
As far as I understand you can take like this. $$E(X) = \int\_{-\infty}^{\infty}xdF\_{X}(x) = \int\_{-\infty}^{0}xdF\_{X}(x)+ (-\int\_{0}^{\infty}xd(1-F\_{X}(x))$$ Using integration by part (and having $F(x)$ is always faster than $x$ at the infinities(otherwise the expectation would not exist.) We will have the resu...
1,922,652
Problem: *A particle follows a trajectory given by $\sigma(t)=(t^{2},t^{3}-4t,0)$ and it off at a tangent at $t=2$. Find the particle's position at $t=3$. Make a draw of what is happening.* Solution: [![Particle's position](https://i.stack.imgur.com/ka8JG.jpg)](https://i.stack.imgur.com/ka8JG.jpg) And this is what ...
2016/09/11
[ "https://math.stackexchange.com/questions/1922652", "https://math.stackexchange.com", "https://math.stackexchange.com/users/103590/" ]
You can also see it by interchanging the order of integrals. We have \begin{eqnarray\*} \int\_{0}^{\infty}(1-F\_{X}(x))dx=\int\_{0}^{\infty}P(X>x)dx & = & \int\_{0}^{\infty}\int\_{x}^{\infty}dF\_{X}(t)dx\\ & = & \int\_{0}^{\infty}\int\_{0}^{t}dF\_{X}(t)dx\\ & = & \int\_{0}^{\infty}t\;dF\_{X}(t) \end{eqnarray\*} and,...
By integrating by parts $$\int\_0^\infty(1-F\_X(x))dx -\int\_{-\infty}^0F\_X(x)dx= [x(1-F\_X(x))]\_0^{+\infty}-\int\_0^{+\infty} xd(1-F\_X(x)) \\ -[xF\_X(x)]\_{-\infty}^0+\int\_{-\infty}^0xdF\_X(x) =0+\int\_0^{+\infty} xdF\_X(x)-0+\int\_{-\infty}^0 xdF\_X\\=\int\_{-\infty}^{+\infty} xdF\_X(x)=E[X].$$ P.S. Note that by...
1,922,652
Problem: *A particle follows a trajectory given by $\sigma(t)=(t^{2},t^{3}-4t,0)$ and it off at a tangent at $t=2$. Find the particle's position at $t=3$. Make a draw of what is happening.* Solution: [![Particle's position](https://i.stack.imgur.com/ka8JG.jpg)](https://i.stack.imgur.com/ka8JG.jpg) And this is what ...
2016/09/11
[ "https://math.stackexchange.com/questions/1922652", "https://math.stackexchange.com", "https://math.stackexchange.com/users/103590/" ]
You can also see it by interchanging the order of integrals. We have \begin{eqnarray\*} \int\_{0}^{\infty}(1-F\_{X}(x))dx=\int\_{0}^{\infty}P(X>x)dx & = & \int\_{0}^{\infty}\int\_{x}^{\infty}dF\_{X}(t)dx\\ & = & \int\_{0}^{\infty}\int\_{0}^{t}dF\_{X}(t)dx\\ & = & \int\_{0}^{\infty}t\;dF\_{X}(t) \end{eqnarray\*} and,...
As far as I understand you can take like this. $$E(X) = \int\_{-\infty}^{\infty}xdF\_{X}(x) = \int\_{-\infty}^{0}xdF\_{X}(x)+ (-\int\_{0}^{\infty}xd(1-F\_{X}(x))$$ Using integration by part (and having $F(x)$ is always faster than $x$ at the infinities(otherwise the expectation would not exist.) We will have the resu...
3,079,721
> > $(x, y) \in \mathbb{R}^2$ and $\lambda \in \mathbb{R}$ and $v(x, y)=2 x y+ \lambda y$. Determine for which value of $\lambda$ a function $u(x, y)$ exists such that $$f(x+iy) =u(x, y) +iv(x, y) $$ is holomorphic. If this is possible find $u(x, y)$ such that $f(0)=0$ and $f(i) =1.$ > > > **Solution** $v(x, y)=2...
2019/01/19
[ "https://math.stackexchange.com/questions/3079721", "https://math.stackexchange.com", "https://math.stackexchange.com/users/625518/" ]
Use Cauchy-Riemann equations. ![](https://latex.codecogs.com/gif.latex?%5Cfrac%7B%5Cpartial&space;u%7D%7B%5Cpartial&space;x%7D=%5Cfrac%7B%5Cpartial&space;v%7D%7B%5Cpartial&space;y%7D&space;,&space;%5Cfrac%7B%5Cpartial&space;u%7D%7B%5Cpartial&space;y%7D=-%5Cfrac%7B%5Cpartial&space;v%7D%7B%5Cpartial&space;x%7D "\frac{\...
Integrating the Cauchy-Riemann equations gives $$u(0,y)=c -y^2$$ and then $$u(x,y)=u(0,y)+x^2+\lambda x=c-y^2+x^2+\lambda x$$ Finally, for all $x,y\in\mathbb{R}$, $$u(x,y)+iv(x,y)=x^2-y^2+\lambda x+ 2ixy +i\lambda y +c$$ or, equivalently, for all $z\in\mathbb{C}$, $f(z)=z^2+\lambda z +c$. So, $f(0)=0\Longleftr...
38,290,516
During SignUp on my app, I want to retrieve information, such as first name, from iCloud,I then want to store this in my own cloud kit database. How do I access user information from iCloud, without having to ask the user themselves for these relevant fields?
2016/07/10
[ "https://Stackoverflow.com/questions/38290516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4174219/" ]
I was able to get it working with this in XCode 8 iOS 10 beta 2: ``` CKContainer.default().requestApplicationPermission(.userDiscoverability) { (status, error) in CKContainer.default().fetchUserRecordID { (record, error) in CKContainer.default().discoverUserIdentity(withUserRecordID: record...
Use `CKContainer.discoverUserIdentity(withUserRecordID:)` in combination with `CKContainer.fetchUserRecordID` to get a `CKUserIdentity` object for the current user. You can then use a `PersonNameComponentsFormatter` to get their name from the `nameComponents` property of the identity.
38,290,516
During SignUp on my app, I want to retrieve information, such as first name, from iCloud,I then want to store this in my own cloud kit database. How do I access user information from iCloud, without having to ask the user themselves for these relevant fields?
2016/07/10
[ "https://Stackoverflow.com/questions/38290516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4174219/" ]
Use `CKContainer.discoverUserIdentity(withUserRecordID:)` in combination with `CKContainer.fetchUserRecordID` to get a `CKUserIdentity` object for the current user. You can then use a `PersonNameComponentsFormatter` to get their name from the `nameComponents` property of the identity.
``` let container = CKContainer.defaultContainer() container.fetchUserRecordIDWithCompletionHandler { (recordId, error) in if error != nil { print("Handle error)") }else{ self.container.discoverUserInfoWithUserRecordID( recordI...
38,290,516
During SignUp on my app, I want to retrieve information, such as first name, from iCloud,I then want to store this in my own cloud kit database. How do I access user information from iCloud, without having to ask the user themselves for these relevant fields?
2016/07/10
[ "https://Stackoverflow.com/questions/38290516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4174219/" ]
I was able to get it working with this in XCode 8 iOS 10 beta 2: ``` CKContainer.default().requestApplicationPermission(.userDiscoverability) { (status, error) in CKContainer.default().fetchUserRecordID { (record, error) in CKContainer.default().discoverUserIdentity(withUserRecordID: record...
``` let container = CKContainer.defaultContainer() container.fetchUserRecordIDWithCompletionHandler { (recordId, error) in if error != nil { print("Handle error)") }else{ self.container.discoverUserInfoWithUserRecordID( recordI...
29,953,910
I am trying to read and write some boolean grids to a file using `stdio.h`. The user inputs a number `nx` (from 1 to 10, generally) and the program generates a list of `nx` by `ceil(nx / 2)` boolean grids (`ceil(nx / 2)` is `ny`). The grids themselves are stored in `__int64`s, so this grid (`f` is false and `T` is true...
2015/04/29
[ "https://Stackoverflow.com/questions/29953910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3810466/" ]
**Problem** The problem is that you are moving the `FILE*` to the end of the file using: ``` fseek(cFile, 0, SEEK_END); ``` And then, you are trying to read the data without going back to the start of the file. You are not checking the returned value of: ``` fread(&data, (int) ceil((nx * ny) / 8), 1, cFile); ```...
I think you are using `fwrite` and `fread` in strange ways. Please do ``` fwrite(&gris[i], sizeof(__int64), 1, cFile); ``` for dump and ``` fread(&data, sizeof(__int64), 1, cFile); ``` for recovering.
13,264
I have written a code to add offer in my contract, however, when I compiled the code in the console and I tried to return the number of offer in this contract, I got 0. PS: I tried this code in the solidity compiler online and it works well ! ``` pragma solidity ^0.4.9; contract Offer { address public owner; ...
2017/03/19
[ "https://ethereum.stackexchange.com/questions/13264", "https://ethereum.stackexchange.com", "https://ethereum.stackexchange.com/users/6945/" ]
It is because your returnNbroffer() function was not marked **constant**. I have replaced **public** with **constant** and this code works: ``` pragma solidity ^0.4.9; contract Offer { address public owner; struct Offer { string title; string description; uint offerTime; mapp...
I found two issues in your code: **I. Typos** ``` Offer o = offres[offreID]; ``` should be ``` Offer o = offres[offerID]; ``` **II. There is a difference between a read and a write operation in the blockchain.** o **Write** means you send a transaction which will be mined. This operation cost gas and takes a fe...
13,264
I have written a code to add offer in my contract, however, when I compiled the code in the console and I tried to return the number of offer in this contract, I got 0. PS: I tried this code in the solidity compiler online and it works well ! ``` pragma solidity ^0.4.9; contract Offer { address public owner; ...
2017/03/19
[ "https://ethereum.stackexchange.com/questions/13264", "https://ethereum.stackexchange.com", "https://ethereum.stackexchange.com/users/6945/" ]
It is because your returnNbroffer() function was not marked **constant**. I have replaced **public** with **constant** and this code works: ``` pragma solidity ^0.4.9; contract Offer { address public owner; struct Offer { string title; string description; uint offerTime; mapp...
May help you. I tested with Mist. ``` pragma solidity ^0.4.9; contract OfferContract { address public owner; struct Offer { string title; string description; uint offerTime; mapping (address => uint) subscribers; mapping (uint => address) subscribersAddress; m...
13,264
I have written a code to add offer in my contract, however, when I compiled the code in the console and I tried to return the number of offer in this contract, I got 0. PS: I tried this code in the solidity compiler online and it works well ! ``` pragma solidity ^0.4.9; contract Offer { address public owner; ...
2017/03/19
[ "https://ethereum.stackexchange.com/questions/13264", "https://ethereum.stackexchange.com", "https://ethereum.stackexchange.com/users/6945/" ]
I found two issues in your code: **I. Typos** ``` Offer o = offres[offreID]; ``` should be ``` Offer o = offres[offerID]; ``` **II. There is a difference between a read and a write operation in the blockchain.** o **Write** means you send a transaction which will be mined. This operation cost gas and takes a fe...
May help you. I tested with Mist. ``` pragma solidity ^0.4.9; contract OfferContract { address public owner; struct Offer { string title; string description; uint offerTime; mapping (address => uint) subscribers; mapping (uint => address) subscribersAddress; m...
63,215,019
[enter image description here](https://i.stack.imgur.com/ckVh1.png) When I'm going to execute the command expo start, give me the following error, I'm starting to work with react native and I don't manage much, what can it be? ```js app.json { "expo": { "name": "Project", "slug": "Project", "version":...
2020/08/02
[ "https://Stackoverflow.com/questions/63215019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13902251/" ]
I had a very similar problem on CI, but it works normally on my local machine (Node 13). In the CI, when building the project on CircleCI or on AppCenter with a code that I already released two months ago it throws the error below. It just does not make sense, it's like node had broken dynamically. I tested the same c...
On Windows: 1. Goto the path C:/Users/{User}/AppData/Roaming 2. delete the 2 folders **npm npm-cache** at path 3. npm clean cache —force
63,215,019
[enter image description here](https://i.stack.imgur.com/ckVh1.png) When I'm going to execute the command expo start, give me the following error, I'm starting to work with react native and I don't manage much, what can it be? ```js app.json { "expo": { "name": "Project", "slug": "Project", "version":...
2020/08/02
[ "https://Stackoverflow.com/questions/63215019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13902251/" ]
If you have nvm installed, its even simpler. To check this, run ``` nvm --version ``` then to install the latest lts version of node, run ``` nvm install --lts ``` That's what worked for me, let me know if that helps
The problem is occuring because of new npm naming restrictions. Project names can no longer contain capital letters. Rename the directory with lower case letters.
63,215,019
[enter image description here](https://i.stack.imgur.com/ckVh1.png) When I'm going to execute the command expo start, give me the following error, I'm starting to work with react native and I don't manage much, what can it be? ```js app.json { "expo": { "name": "Project", "slug": "Project", "version":...
2020/08/02
[ "https://Stackoverflow.com/questions/63215019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13902251/" ]
I had a very similar problem on CI, but it works normally on my local machine (Node 13). In the CI, when building the project on CircleCI or on AppCenter with a code that I already released two months ago it throws the error below. It just does not make sense, it's like node had broken dynamically. I tested the same c...
If you are using Windows 10, I solved this issue by doing the followings: First, this was the error: [![enter image description here](https://i.stack.imgur.com/J3EIR.png)](https://i.stack.imgur.com/J3EIR.png) 1. Navigate to `%USERPROFILE%\AppData\Roaming\` 2. Remove any cache that may be there by typing `Run npm cle...
63,215,019
[enter image description here](https://i.stack.imgur.com/ckVh1.png) When I'm going to execute the command expo start, give me the following error, I'm starting to work with react native and I don't manage much, what can it be? ```js app.json { "expo": { "name": "Project", "slug": "Project", "version":...
2020/08/02
[ "https://Stackoverflow.com/questions/63215019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13902251/" ]
I solved it on both my computers. One needed more work on it. * Option 1: + Follow this directory `C:\Users(your username)\AppData\Roaming` + Delete the **npm** folder + and if there is one **npm cache** folder. Run `npm clean cache -force`, or `npm cache clean -force` on windows ( — force is now required to clean...
On Windows: 1. Goto the path C:/Users/{User}/AppData/Roaming 2. delete the 2 folders **npm npm-cache** at path 3. npm clean cache —force
63,215,019
[enter image description here](https://i.stack.imgur.com/ckVh1.png) When I'm going to execute the command expo start, give me the following error, I'm starting to work with react native and I don't manage much, what can it be? ```js app.json { "expo": { "name": "Project", "slug": "Project", "version":...
2020/08/02
[ "https://Stackoverflow.com/questions/63215019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13902251/" ]
I got this too today when doing a build. (running node 12.8.3) I reinstalled the follow package: ``` npm install graceful-fs --save-dev ``` This solved the above problem.
On Windows: 1. Goto the path C:/Users/{User}/AppData/Roaming 2. delete the 2 folders **npm npm-cache** at path 3. npm clean cache —force
63,215,019
[enter image description here](https://i.stack.imgur.com/ckVh1.png) When I'm going to execute the command expo start, give me the following error, I'm starting to work with react native and I don't manage much, what can it be? ```js app.json { "expo": { "name": "Project", "slug": "Project", "version":...
2020/08/02
[ "https://Stackoverflow.com/questions/63215019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13902251/" ]
If you are using Windows 10, I solved this issue by doing the followings: First, this was the error: [![enter image description here](https://i.stack.imgur.com/J3EIR.png)](https://i.stack.imgur.com/J3EIR.png) 1. Navigate to `%USERPROFILE%\AppData\Roaming\` 2. Remove any cache that may be there by typing `Run npm cle...
The problem is occuring because of new npm naming restrictions. Project names can no longer contain capital letters. Rename the directory with lower case letters.
63,215,019
[enter image description here](https://i.stack.imgur.com/ckVh1.png) When I'm going to execute the command expo start, give me the following error, I'm starting to work with react native and I don't manage much, what can it be? ```js app.json { "expo": { "name": "Project", "slug": "Project", "version":...
2020/08/02
[ "https://Stackoverflow.com/questions/63215019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13902251/" ]
I had a very similar problem on CI, but it works normally on my local machine (Node 13). In the CI, when building the project on CircleCI or on AppCenter with a code that I already released two months ago it throws the error below. It just does not make sense, it's like node had broken dynamically. I tested the same c...
If you have nvm installed, its even simpler. To check this, run ``` nvm --version ``` then to install the latest lts version of node, run ``` nvm install --lts ``` That's what worked for me, let me know if that helps
63,215,019
[enter image description here](https://i.stack.imgur.com/ckVh1.png) When I'm going to execute the command expo start, give me the following error, I'm starting to work with react native and I don't manage much, what can it be? ```js app.json { "expo": { "name": "Project", "slug": "Project", "version":...
2020/08/02
[ "https://Stackoverflow.com/questions/63215019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13902251/" ]
I had a very similar problem on CI, but it works normally on my local machine (Node 13). In the CI, when building the project on CircleCI or on AppCenter with a code that I already released two months ago it throws the error below. It just does not make sense, it's like node had broken dynamically. I tested the same c...
Your node version is not matching with the libraries/frameworks you are trying to use. Try to update you node version and check. Better to use nodist/nvm to do upgrade or downgrade with finger snap.
63,215,019
[enter image description here](https://i.stack.imgur.com/ckVh1.png) When I'm going to execute the command expo start, give me the following error, I'm starting to work with react native and I don't manage much, what can it be? ```js app.json { "expo": { "name": "Project", "slug": "Project", "version":...
2020/08/02
[ "https://Stackoverflow.com/questions/63215019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13902251/" ]
An Ubuntu 20.04 user here with node 16.0.0. I was getting the same error when I would run: ``` > npx create-react-app [my app] ``` I found that I had to reinstall create-react-app (remove it from node\_modules first) to solve it. ``` > npm install create-react-app ```
On Windows: 1. Goto the path C:/Users/{User}/AppData/Roaming 2. delete the 2 folders **npm npm-cache** at path 3. npm clean cache —force
63,215,019
[enter image description here](https://i.stack.imgur.com/ckVh1.png) When I'm going to execute the command expo start, give me the following error, I'm starting to work with react native and I don't manage much, what can it be? ```js app.json { "expo": { "name": "Project", "slug": "Project", "version":...
2020/08/02
[ "https://Stackoverflow.com/questions/63215019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13902251/" ]
If you are using Windows 10, I solved this issue by doing the followings: First, this was the error: [![enter image description here](https://i.stack.imgur.com/J3EIR.png)](https://i.stack.imgur.com/J3EIR.png) 1. Navigate to `%USERPROFILE%\AppData\Roaming\` 2. Remove any cache that may be there by typing `Run npm cle...
Your node version is not matching with the libraries/frameworks you are trying to use. Try to update you node version and check. Better to use nodist/nvm to do upgrade or downgrade with finger snap.
54,346,281
I am using Azure Cosmos DB (MongoDB) and I want to remove a unique index from a collection's field. We removed the unwanted index from the system.indexes collection but nothing happened. On the documentation, we can see these two options to update the Indexing Policy: 1- Submenu "Settings" under the "Collections" se...
2019/01/24
[ "https://Stackoverflow.com/questions/54346281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8837403/" ]
You coult take a [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) for added keys and check if the actual dependency has all elements added to the set. Then add this key, otherwise go on. Proceed until no more items are in the array. ```js var dependencies = { A: [], B: ['A...
Here's my go at it : ```js const imageDependencies = { A: [], B: ["A"], C: ["A", "B"], D: ["F"], E: ["D", "C"], F: [] }; let keys = Object.keys(imageDependencies), // ["A","B","C","D","E","F"] output = []; while (keys.length) { for (let i in keys) { let key = keys[i], // "A" d...
54,346,281
I am using Azure Cosmos DB (MongoDB) and I want to remove a unique index from a collection's field. We removed the unwanted index from the system.indexes collection but nothing happened. On the documentation, we can see these two options to update the Indexing Policy: 1- Submenu "Settings" under the "Collections" se...
2019/01/24
[ "https://Stackoverflow.com/questions/54346281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8837403/" ]
You coult take a [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) for added keys and check if the actual dependency has all elements added to the set. Then add this key, otherwise go on. Proceed until no more items are in the array. ```js var dependencies = { A: [], B: ['A...
Here's another crack using Array.prototype.reduce() ```js const imageDependencies = { A: [], B: ['A'], C: ['A', 'B'], D: ['F'], E: ['D', 'C'], F: [] } const imageDependenciesBad = { A: ["X"], B: ['A'], C: ['A', 'B'], D: ['F'], E: ['D', 'C'], F: [] } cons...
54,346,281
I am using Azure Cosmos DB (MongoDB) and I want to remove a unique index from a collection's field. We removed the unwanted index from the system.indexes collection but nothing happened. On the documentation, we can see these two options to update the Indexing Policy: 1- Submenu "Settings" under the "Collections" se...
2019/01/24
[ "https://Stackoverflow.com/questions/54346281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8837403/" ]
You coult take a [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) for added keys and check if the actual dependency has all elements added to the set. Then add this key, otherwise go on. Proceed until no more items are in the array. ```js var dependencies = { A: [], B: ['A...
`toposort` is a pretty good library for this <https://github.com/marcelklehr/toposort> ```js const toposort = require("toposort") const imageDependencies = { A: [], B: ['A'], C: ['A', 'B'], D: ['F'], E: ['D', 'C'], F: [] } // split dependencies into pairs for toposort let deps = [] Object.keys...
54,346,281
I am using Azure Cosmos DB (MongoDB) and I want to remove a unique index from a collection's field. We removed the unwanted index from the system.indexes collection but nothing happened. On the documentation, we can see these two options to update the Indexing Policy: 1- Submenu "Settings" under the "Collections" se...
2019/01/24
[ "https://Stackoverflow.com/questions/54346281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8837403/" ]
what you want here is a **topological sort** (<https://en.wikipedia.org/wiki/Topological_sorting>). I used this example <https://gist.github.com/shinout/1232505#file-tsort-js-L9> written by **Shin Suzuki** <https://gist.github.com/shinout> ```js const imageDependencies = { A: [], B: ['A'], C: ['A...
Here's my go at it : ```js const imageDependencies = { A: [], B: ["A"], C: ["A", "B"], D: ["F"], E: ["D", "C"], F: [] }; let keys = Object.keys(imageDependencies), // ["A","B","C","D","E","F"] output = []; while (keys.length) { for (let i in keys) { let key = keys[i], // "A" d...
54,346,281
I am using Azure Cosmos DB (MongoDB) and I want to remove a unique index from a collection's field. We removed the unwanted index from the system.indexes collection but nothing happened. On the documentation, we can see these two options to update the Indexing Policy: 1- Submenu "Settings" under the "Collections" se...
2019/01/24
[ "https://Stackoverflow.com/questions/54346281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8837403/" ]
what you want here is a **topological sort** (<https://en.wikipedia.org/wiki/Topological_sorting>). I used this example <https://gist.github.com/shinout/1232505#file-tsort-js-L9> written by **Shin Suzuki** <https://gist.github.com/shinout> ```js const imageDependencies = { A: [], B: ['A'], C: ['A...
Here's another crack using Array.prototype.reduce() ```js const imageDependencies = { A: [], B: ['A'], C: ['A', 'B'], D: ['F'], E: ['D', 'C'], F: [] } const imageDependenciesBad = { A: ["X"], B: ['A'], C: ['A', 'B'], D: ['F'], E: ['D', 'C'], F: [] } cons...
54,346,281
I am using Azure Cosmos DB (MongoDB) and I want to remove a unique index from a collection's field. We removed the unwanted index from the system.indexes collection but nothing happened. On the documentation, we can see these two options to update the Indexing Policy: 1- Submenu "Settings" under the "Collections" se...
2019/01/24
[ "https://Stackoverflow.com/questions/54346281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8837403/" ]
what you want here is a **topological sort** (<https://en.wikipedia.org/wiki/Topological_sorting>). I used this example <https://gist.github.com/shinout/1232505#file-tsort-js-L9> written by **Shin Suzuki** <https://gist.github.com/shinout> ```js const imageDependencies = { A: [], B: ['A'], C: ['A...
`toposort` is a pretty good library for this <https://github.com/marcelklehr/toposort> ```js const toposort = require("toposort") const imageDependencies = { A: [], B: ['A'], C: ['A', 'B'], D: ['F'], E: ['D', 'C'], F: [] } // split dependencies into pairs for toposort let deps = [] Object.keys...
54,346,281
I am using Azure Cosmos DB (MongoDB) and I want to remove a unique index from a collection's field. We removed the unwanted index from the system.indexes collection but nothing happened. On the documentation, we can see these two options to update the Indexing Policy: 1- Submenu "Settings" under the "Collections" se...
2019/01/24
[ "https://Stackoverflow.com/questions/54346281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8837403/" ]
Here's my go at it : ```js const imageDependencies = { A: [], B: ["A"], C: ["A", "B"], D: ["F"], E: ["D", "C"], F: [] }; let keys = Object.keys(imageDependencies), // ["A","B","C","D","E","F"] output = []; while (keys.length) { for (let i in keys) { let key = keys[i], // "A" d...
`toposort` is a pretty good library for this <https://github.com/marcelklehr/toposort> ```js const toposort = require("toposort") const imageDependencies = { A: [], B: ['A'], C: ['A', 'B'], D: ['F'], E: ['D', 'C'], F: [] } // split dependencies into pairs for toposort let deps = [] Object.keys...
54,346,281
I am using Azure Cosmos DB (MongoDB) and I want to remove a unique index from a collection's field. We removed the unwanted index from the system.indexes collection but nothing happened. On the documentation, we can see these two options to update the Indexing Policy: 1- Submenu "Settings" under the "Collections" se...
2019/01/24
[ "https://Stackoverflow.com/questions/54346281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8837403/" ]
Here's another crack using Array.prototype.reduce() ```js const imageDependencies = { A: [], B: ['A'], C: ['A', 'B'], D: ['F'], E: ['D', 'C'], F: [] } const imageDependenciesBad = { A: ["X"], B: ['A'], C: ['A', 'B'], D: ['F'], E: ['D', 'C'], F: [] } cons...
`toposort` is a pretty good library for this <https://github.com/marcelklehr/toposort> ```js const toposort = require("toposort") const imageDependencies = { A: [], B: ['A'], C: ['A', 'B'], D: ['F'], E: ['D', 'C'], F: [] } // split dependencies into pairs for toposort let deps = [] Object.keys...
13,899,259
> > **Possible Duplicate:** > > [What is the difference between dispatch\_get\_global\_queue and dispatch\_queue\_create?](https://stackoverflow.com/questions/10984885/what-is-the-difference-between-dispatch-get-global-queue-and-dispatch-queue-crea) > > > I see some methods using gcd,but some of them may do it...
2012/12/16
[ "https://Stackoverflow.com/questions/13899259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1805205/" ]
The best way to conceptualize queues is to first realize that at the very low-level, there are only two types of queues: serial and concurrent. **Serial queues** are monogamous, but uncommitted. If you give a bunch of tasks to each serial queue, it will run them one at a time, using only one thread at a time. The unco...
If you use `dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);` GCD will automatically create enough threads for you to process the job, and use multiple cores if possible. On the other hand, if you use `imageQueue_ = dispatch_queue_create("com.company.app.imageQueue", NULL);` you get...
579,109
We recently started to develop a Java desktop app and management has requested that we make use of Rich Client Platform. I know of four for Java namely: 1. Eclipse RCP - [www link to ecipse rcp](http://wiki.eclipse.org/index.php/Rich_Client_Platform), 2. Netbean RCP - [Netbeans RCP web site](http://platform.netbeans.o...
2009/02/23
[ "https://Stackoverflow.com/questions/579109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70032/" ]
I recommend that you take a look at JSR 296 - it's not complete yet by any stretch, but I think it hits the sweet spot for providing certain core functionality that you really, really need in every Java GUI app, without forcing you to live in an overly complicated framework. I have used JSR 296 successfully to create ...
Netbeans RCP is excellent. Its come a long way over the years. It uses a more robust technology ('Swing') that many people use and understand. Eclipse RCP (more specifically SWT) just confused me.
579,109
We recently started to develop a Java desktop app and management has requested that we make use of Rich Client Platform. I know of four for Java namely: 1. Eclipse RCP - [www link to ecipse rcp](http://wiki.eclipse.org/index.php/Rich_Client_Platform), 2. Netbean RCP - [Netbeans RCP web site](http://platform.netbeans.o...
2009/02/23
[ "https://Stackoverflow.com/questions/579109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70032/" ]
Too late to answer, but some guys might hit this page. I would go for Netbeans RCP, 1)Netbeans platform. its quite mature and has evolved is a 'easy to use' platform for developing applications. 2)Its very easy to get started with, whereas the learning curve of eclipse RCP is pretty steep. Just goto, <http://netbean...
While I haven't explicitly used any of them, I have used portions of the Eclipse RCP. Specifically, I've used the Eclipse OSGi runtime (Equinox) and some common utilities and I've very pleased. OSGi is fantastic to work with. I have several friends on large contracts which use Eclipse RCP (more than I use) and they rav...
579,109
We recently started to develop a Java desktop app and management has requested that we make use of Rich Client Platform. I know of four for Java namely: 1. Eclipse RCP - [www link to ecipse rcp](http://wiki.eclipse.org/index.php/Rich_Client_Platform), 2. Netbean RCP - [Netbeans RCP web site](http://platform.netbeans.o...
2009/02/23
[ "https://Stackoverflow.com/questions/579109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70032/" ]
Too late to answer, but some guys might hit this page. I would go for Netbeans RCP, 1)Netbeans platform. its quite mature and has evolved is a 'easy to use' platform for developing applications. 2)Its very easy to get started with, whereas the learning curve of eclipse RCP is pretty steep. Just goto, <http://netbean...
I'm currently developing a Spring RCP application. The documentation is really weak, that's for sure, but the blogs and forum have a good amount of information to get going. Once you do get cruising, things do move fairly fast and you really only need to learn basic Spring if you aren't familiar with the framework. The...
579,109
We recently started to develop a Java desktop app and management has requested that we make use of Rich Client Platform. I know of four for Java namely: 1. Eclipse RCP - [www link to ecipse rcp](http://wiki.eclipse.org/index.php/Rich_Client_Platform), 2. Netbean RCP - [Netbeans RCP web site](http://platform.netbeans.o...
2009/02/23
[ "https://Stackoverflow.com/questions/579109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70032/" ]
INTRO - skip if you're only interesterd in result ;) I was developing an editor for a custom programming language very simmilar to JSP. First I've implemented the editor as my thesis using **NetBeans platform**. After finishing school I've got a job and they wanted me to implement the same thing in **Eclipse RCP**, ...
While I haven't explicitly used any of them, I have used portions of the Eclipse RCP. Specifically, I've used the Eclipse OSGi runtime (Equinox) and some common utilities and I've very pleased. OSGi is fantastic to work with. I have several friends on large contracts which use Eclipse RCP (more than I use) and they rav...
579,109
We recently started to develop a Java desktop app and management has requested that we make use of Rich Client Platform. I know of four for Java namely: 1. Eclipse RCP - [www link to ecipse rcp](http://wiki.eclipse.org/index.php/Rich_Client_Platform), 2. Netbean RCP - [Netbeans RCP web site](http://platform.netbeans.o...
2009/02/23
[ "https://Stackoverflow.com/questions/579109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70032/" ]
INTRO - skip if you're only interesterd in result ;) I was developing an editor for a custom programming language very simmilar to JSP. First I've implemented the editor as my thesis using **NetBeans platform**. After finishing school I've got a job and they wanted me to implement the same thing in **Eclipse RCP**, ...
From my end-user perspective. I've seen more implementations in Eclipse than in the other two. Actually I've know about Netbeans implementations but never got one in my hands. From Spring this is the first time I've heard about it. While my answer is definitely a super 10,000 ft view, it reflects somehow the prefe...
579,109
We recently started to develop a Java desktop app and management has requested that we make use of Rich Client Platform. I know of four for Java namely: 1. Eclipse RCP - [www link to ecipse rcp](http://wiki.eclipse.org/index.php/Rich_Client_Platform), 2. Netbean RCP - [Netbeans RCP web site](http://platform.netbeans.o...
2009/02/23
[ "https://Stackoverflow.com/questions/579109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70032/" ]
From my end-user perspective. I've seen more implementations in Eclipse than in the other two. Actually I've know about Netbeans implementations but never got one in my hands. From Spring this is the first time I've heard about it. While my answer is definitely a super 10,000 ft view, it reflects somehow the prefe...
Eclipse RCP provides plug-in mechanism so that you can add new features later on the deployment. Also via the update mechanism you can change the system without user interference. In the development phase, Eclipse RCP provides a fast, robust ground with perspectives, views, editors, command and action mechanisms. If yo...
579,109
We recently started to develop a Java desktop app and management has requested that we make use of Rich Client Platform. I know of four for Java namely: 1. Eclipse RCP - [www link to ecipse rcp](http://wiki.eclipse.org/index.php/Rich_Client_Platform), 2. Netbean RCP - [Netbeans RCP web site](http://platform.netbeans.o...
2009/02/23
[ "https://Stackoverflow.com/questions/579109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70032/" ]
Too late to answer, but some guys might hit this page. I would go for Netbeans RCP, 1)Netbeans platform. its quite mature and has evolved is a 'easy to use' platform for developing applications. 2)Its very easy to get started with, whereas the learning curve of eclipse RCP is pretty steep. Just goto, <http://netbean...
Netbeans RCP is excellent. Its come a long way over the years. It uses a more robust technology ('Swing') that many people use and understand. Eclipse RCP (more specifically SWT) just confused me.
579,109
We recently started to develop a Java desktop app and management has requested that we make use of Rich Client Platform. I know of four for Java namely: 1. Eclipse RCP - [www link to ecipse rcp](http://wiki.eclipse.org/index.php/Rich_Client_Platform), 2. Netbean RCP - [Netbeans RCP web site](http://platform.netbeans.o...
2009/02/23
[ "https://Stackoverflow.com/questions/579109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70032/" ]
I recommend that you take a look at JSR 296 - it's not complete yet by any stretch, but I think it hits the sweet spot for providing certain core functionality that you really, really need in every Java GUI app, without forcing you to live in an overly complicated framework. I have used JSR 296 successfully to create ...
Eclipse RCP provides plug-in mechanism so that you can add new features later on the deployment. Also via the update mechanism you can change the system without user interference. In the development phase, Eclipse RCP provides a fast, robust ground with perspectives, views, editors, command and action mechanisms. If yo...
579,109
We recently started to develop a Java desktop app and management has requested that we make use of Rich Client Platform. I know of four for Java namely: 1. Eclipse RCP - [www link to ecipse rcp](http://wiki.eclipse.org/index.php/Rich_Client_Platform), 2. Netbean RCP - [Netbeans RCP web site](http://platform.netbeans.o...
2009/02/23
[ "https://Stackoverflow.com/questions/579109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70032/" ]
Netbeans RCP is excellent. Its come a long way over the years. It uses a more robust technology ('Swing') that many people use and understand. Eclipse RCP (more specifically SWT) just confused me.
Eclipse RCP provides plug-in mechanism so that you can add new features later on the deployment. Also via the update mechanism you can change the system without user interference. In the development phase, Eclipse RCP provides a fast, robust ground with perspectives, views, editors, command and action mechanisms. If yo...
579,109
We recently started to develop a Java desktop app and management has requested that we make use of Rich Client Platform. I know of four for Java namely: 1. Eclipse RCP - [www link to ecipse rcp](http://wiki.eclipse.org/index.php/Rich_Client_Platform), 2. Netbean RCP - [Netbeans RCP web site](http://platform.netbeans.o...
2009/02/23
[ "https://Stackoverflow.com/questions/579109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70032/" ]
I'm currently developing a Spring RCP application. The documentation is really weak, that's for sure, but the blogs and forum have a good amount of information to get going. Once you do get cruising, things do move fairly fast and you really only need to learn basic Spring if you aren't familiar with the framework. The...
Of course it all depends on the kind of applications and services you want to provide, and the target environment. But I can also recommend OSGi as a development and deployment platform. The underlying architecture and specifications are very well developed and proven. Besides of the Eclipse RCP you should have a look...
73,120,999
I need to display the contents of a data table in a vuetify component: . <https://vuetifyjs.com/en/components/data-tables/#api> I make a request to the server to retrieve the data, in a forEach loop I create an object for each row of my data table. However, nothing is displayed. ``` <template> <v-main> <v-con...
2022/07/26
[ "https://Stackoverflow.com/questions/73120999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19623890/" ]
Set the state using the [functional update](https://reactjs.org/docs/hooks-reference.html#functional-updates) argument: ```js setDayValue(dayValue => { const updated = {...dayValue}; let needsUpdate = false; for (const day of arrayDays) { if (!(day in updated)) continue; updated[day] = true; needsUpd...
``` var temp = {...dayValue}; arrayDays.forEach( day => { if (temp[day] !== undefined) temp[day] = true; }) setDayValue(temp); ```
73,120,999
I need to display the contents of a data table in a vuetify component: . <https://vuetifyjs.com/en/components/data-tables/#api> I make a request to the server to retrieve the data, in a forEach loop I create an object for each row of my data table. However, nothing is displayed. ``` <template> <v-main> <v-con...
2022/07/26
[ "https://Stackoverflow.com/questions/73120999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19623890/" ]
Set the state using the [functional update](https://reactjs.org/docs/hooks-reference.html#functional-updates) argument: ```js setDayValue(dayValue => { const updated = {...dayValue}; let needsUpdate = false; for (const day of arrayDays) { if (!(day in updated)) continue; updated[day] = true; needsUpd...
Always try to use immutable data structures when updating state in react. So this is what i would recommend ``` const arr = ['monday', 'wednesday', 'saturday']; const updateDayValue = (arr) => { const updated = { ...dayValue, ...arr.reduce((acc, cur) => { return { ...acc, [cur]: true ...
73,120,999
I need to display the contents of a data table in a vuetify component: . <https://vuetifyjs.com/en/components/data-tables/#api> I make a request to the server to retrieve the data, in a forEach loop I create an object for each row of my data table. However, nothing is displayed. ``` <template> <v-main> <v-con...
2022/07/26
[ "https://Stackoverflow.com/questions/73120999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19623890/" ]
Set the state using the [functional update](https://reactjs.org/docs/hooks-reference.html#functional-updates) argument: ```js setDayValue(dayValue => { const updated = {...dayValue}; let needsUpdate = false; for (const day of arrayDays) { if (!(day in updated)) continue; updated[day] = true; needsUpd...
I have written small piece of code for this one. I could have written one liner but I choose to split my logic in small pieces for you understanding ``` const updateState = () => { const stateClone = { ...dayValue }; const keyValueMap = Object.keys(stateClone).map((key) => ({ key, value: stateClone...
73,120,999
I need to display the contents of a data table in a vuetify component: . <https://vuetifyjs.com/en/components/data-tables/#api> I make a request to the server to retrieve the data, in a forEach loop I create an object for each row of my data table. However, nothing is displayed. ``` <template> <v-main> <v-con...
2022/07/26
[ "https://Stackoverflow.com/questions/73120999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19623890/" ]
Set the state using the [functional update](https://reactjs.org/docs/hooks-reference.html#functional-updates) argument: ```js setDayValue(dayValue => { const updated = {...dayValue}; let needsUpdate = false; for (const day of arrayDays) { if (!(day in updated)) continue; updated[day] = true; needsUpd...
``` arrayDays.map(i => { Object.keys(dayValue).map(n => { if(i === n){ setDayValue(daysN => { let days = {...daysN} days[n] = true return days }) } }) }) ```
36,431,037
I have Rails model `User`, where I have multiple attributes like `id`, `first_name`, `last_name` etc etc, Now the problem I want to solve is that I want to get users and order them by combining (`first_name + last_name`) combined. I thought about it for a while but seriously, I don't even have a remote clue about it. T...
2016/04/05
[ "https://Stackoverflow.com/questions/36431037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5595316/" ]
For MySQL: ``` User.order('CONCAT(`first_name`, `last_name`)') ```
Rails: ``` User.order(["first_name desc", "last_name desc"]) ``` '.order' takes either string or array as parameters. You can then combine multiple columns and directions.
36,431,037
I have Rails model `User`, where I have multiple attributes like `id`, `first_name`, `last_name` etc etc, Now the problem I want to solve is that I want to get users and order them by combining (`first_name + last_name`) combined. I thought about it for a while but seriously, I don't even have a remote clue about it. T...
2016/04/05
[ "https://Stackoverflow.com/questions/36431037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5595316/" ]
For MySQL: ``` User.order('CONCAT(`first_name`, `last_name`)') ```
Logic-wise there's no need to join/concat the data in order to sort it. As a matter of precedence the primary sort field will set the context and scope the second sort within the primary sort's context. Just select the first sort column, and the next sort column as a subsort, and so on. For example: ``` (Sor...
36,431,037
I have Rails model `User`, where I have multiple attributes like `id`, `first_name`, `last_name` etc etc, Now the problem I want to solve is that I want to get users and order them by combining (`first_name + last_name`) combined. I thought about it for a while but seriously, I don't even have a remote clue about it. T...
2016/04/05
[ "https://Stackoverflow.com/questions/36431037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5595316/" ]
Logic-wise there's no need to join/concat the data in order to sort it. As a matter of precedence the primary sort field will set the context and scope the second sort within the primary sort's context. Just select the first sort column, and the next sort column as a subsort, and so on. For example: ``` (Sor...
Rails: ``` User.order(["first_name desc", "last_name desc"]) ``` '.order' takes either string or array as parameters. You can then combine multiple columns and directions.
20,684
$\newcommand{\Ket}[1]{\left|#1\right>}$In Nielsen's seminal paper on entanglement transformations (<https://arxiv.org/abs/quant-ph/9811053>), he gives a converse proof for the entanglement transformation theorem presented (starting at eq.10). In the protocol presented as part of the converse proof, he states, for exam...
2021/08/01
[ "https://quantumcomputing.stackexchange.com/questions/20684", "https://quantumcomputing.stackexchange.com", "https://quantumcomputing.stackexchange.com/users/16667/" ]
As pointed out in the comments by @gIS, the form of the desired unitary transformation follows from the Schmidt decomposition of the two states. To see this, write down the Schmidt decomposition of $|\psi'\rangle$ and $|\psi''\rangle$ $$ \begin{align} |\psi'\rangle = \sum\_i\lambda\_i|i'\_A\rangle|i'\_B\rangle \\ |\ps...
I'll give some more detail on how to do this in the general case. Say you are given two pure states, $\newcommand{\ket}[1]{\lvert #1\rangle}\ket\psi$ and $\ket\phi$, which have the same amount of entanglement, meaning they have the same set of Schmidt coefficients. You are given these states in some fixed orthonormal ...
25,692,244
i am working on a project in which i have use the Update Query but the problem is that after the query is executed successfully the data is not updated here is my code ``` protected void Update_btn_Click(object sender, EventArgs e) { var aid = Convert.ToInt32(Session["Aid"].ToString()); try { var c...
2014/09/05
[ "https://Stackoverflow.com/questions/25692244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1275527/" ]
You always have to pass the option `-c /etc/ckan/default/development.ini` whenever you run a `paster` command. It does not automatically know the default location of the `development.ini` file. You might find this page in the docs helpful: <http://docs.ckan.org/en/latest/maintaining/paster.html>
you could generate your development.ini like described here: <http://docs.pylonsproject.org/projects/pyramid/en/1.1-branch/narr/startup.html> (see middle of page by scrolling down.) Hth :-)
38,137,168
[NeoEdify Warning Popup](http://i.stack.imgur.com/9eBxP.png) I'm trying to automate an AngularJS-based website and I am finding lots of popups which I am unable to handle. I have tried: 1) Code: ``` Alert alert = driver.switchTo().alert(); alert.accept();//Closes OK Button" ``` 2) Direct clicking confirm button ...
2016/07/01
[ "https://Stackoverflow.com/questions/38137168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6122660/" ]
Try this code: ``` String input = "BALANCE:\"5048543747\",BALDEFOVD:\"5119341413\",ACCTNO:\"0001000918\","; String pattern = "(.*?),"; Pattern r = Pattern.compile(pattern); List<String> matches = new ArrayList<String>(); Matcher m = r.matcher(input); while (m.find()) { matches.add(m.group(1)); } ``` After seein...
``` while(matcher.find){ System.out.println("found: " + matcher.group(1)); } ``` The [Matcher](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Matcher.html) in Java can be a bit confusing at first, especially when matching on groups. In the above example, `matcher.group(0)` is always the entire regular ...
38,137,168
[NeoEdify Warning Popup](http://i.stack.imgur.com/9eBxP.png) I'm trying to automate an AngularJS-based website and I am finding lots of popups which I am unable to handle. I have tried: 1) Code: ``` Alert alert = driver.switchTo().alert(); alert.accept();//Closes OK Button" ``` 2) Direct clicking confirm button ...
2016/07/01
[ "https://Stackoverflow.com/questions/38137168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6122660/" ]
Try this code: ``` String input = "BALANCE:\"5048543747\",BALDEFOVD:\"5119341413\",ACCTNO:\"0001000918\","; String pattern = "(.*?),"; Pattern r = Pattern.compile(pattern); List<String> matches = new ArrayList<String>(); Matcher m = r.matcher(input); while (m.find()) { matches.add(m.group(1)); } ``` After seein...
This will be usefull ``` (\w+:"\d+") ``` \w+ takes the full word until literal : then process the literal " \d+ takes the numbers until the next literal " and you take all the information to match
71,271,715
I have a grid that varies in width and number of results. Each cell in the grid is 200x200 px. As the grid expands, I want the column width to remain fixed and for new columns to be added in. You could imagine the grid initially having 3 columns, and when the user expands the window, a fourth column is added in to us...
2022/02/25
[ "https://Stackoverflow.com/questions/71271715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1001938/" ]
SQL is expressive enough to solve such case without UDF. Here example of solving it using [OBJECT\_CONSTRUCT](https://docs.snowflake.com/en/sql-reference/functions/object_construct.html). This solution is dynamic and it could accept any number of "countX" columns present on the row level: ``` WITH cte AS ( SELECT x...
Here is a solution in SQL > > > ``` > create table your_table > ( > XUUID VARCHAR(100), > COUNT1 INT, > COUNT2 INT, > COUNT3 INT, > COUNT4 INT > ); > > ``` > > > > > ``` > INSERT INTO your_table values > ('id1', 2, 3, 0, 0), > ('id2', 0, 0, 1, 0), > ('id3', 0, 0, 0, 0), > ('id4', 3, 0, 0, 0) > ...