qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
50,211,357
i am using this code in order to get persons info by email to post it on web page In API documentation (<https://dashboard.clearbit.com/docs?shell#oauth>) http request looks like this ```html HTTP REQUEST GET https://person.clearbit.com/v2/combined/find?email=:email ``` I am try to do this in PHP (p.s. I hid my ke...
2018/05/07
[ "https://Stackoverflow.com/questions/50211357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9752002/" ]
The answer working in Angular 5: ``` [ngStyle]="{'background': 'url('+artist.images[2].url+')'}" ```
This is probably what you're looking for: ``` <div *ngIf="artist.images.length > 0"> <div ng-style="{'background-image': 'url('+artist.images[2].url+')'}"></div> </div> ```
50,211,357
i am using this code in order to get persons info by email to post it on web page In API documentation (<https://dashboard.clearbit.com/docs?shell#oauth>) http request looks like this ```html HTTP REQUEST GET https://person.clearbit.com/v2/combined/find?email=:email ``` I am try to do this in PHP (p.s. I hid my ke...
2018/05/07
[ "https://Stackoverflow.com/questions/50211357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9752002/" ]
The answer working in Angular 5: ``` [ngStyle]="{'background': 'url('+artist.images[2].url+')'}" ```
Have you tried: ``` <div *ngIf="artist.images.length > 0"> <img [src]="url"> </div> ``` Where `url` is your image url.
50,211,357
i am using this code in order to get persons info by email to post it on web page In API documentation (<https://dashboard.clearbit.com/docs?shell#oauth>) http request looks like this ```html HTTP REQUEST GET https://person.clearbit.com/v2/combined/find?email=:email ``` I am try to do this in PHP (p.s. I hid my ke...
2018/05/07
[ "https://Stackoverflow.com/questions/50211357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9752002/" ]
The answer working in Angular 5: ``` [ngStyle]="{'background': 'url('+artist.images[2].url+')'}" ```
beside the double curly braces enguerranws mentioned ... according to the [spotify docs](https://beta.developer.spotify.com/console/get-several-artists/) it should state: ``` <div *ngIf="artist.images.length > 0"> <div style="background-image: url("{{ data.artists[0].images[0].url }}")"> </div> </div> ```
18,477,596
I looked at [this answer](https://stackoverflow.com/a/9735891/404623) already, and it's quite close to what I have. Here is my PHP code: ``` $start = new DateTime('0:00 first day of previous month', new DateTimeZone('UTC')); /* if (isset($_GET['year']) && isset($_GET['month']) && checkdate($_GET['month'], 1, $_GET['y...
2013/08/28
[ "https://Stackoverflow.com/questions/18477596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/404623/" ]
### this part irrelevant - question was edited Because of the timezone difference. $start is calculated in the 'Rainy River timezone', while $middle and $end are in UTC time. The 'Rainy River timezone has a [-06:00 hour offset](http://en.wikipedia.org/wiki/America/Rainy_River) from UTC (exactly the difference in hours...
After reading [the answer here](https://stackoverflow.com/questions/3602405/php-datetimemodify-adding-and-subtracting-months), I had a better idea: ``` $start = new DateTime('0:00 first day of previous month'); /* if (isset($_GET['year']) && isset($_GET['month']) && checkdate($_GET['month'], 1, $_GET['year'])) { $...
36,469,397
I need to add some CSS class based on some condition using JavaScript but facing issue in case my string contains a forward slash (`/`). This is what my use case is ``` <div id="div_product-size-icon-121NM/L" class="disabled"></div> <script> var newProductCode = '121NM/L'; if( newProductCode.contains('/') ){ ...
2016/04/07
[ "https://Stackoverflow.com/questions/36469397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/471607/" ]
I have first replaced the if statement with `indexOf()` and changed the `.replace` function as `.replace('/', '\\/');` ```js var newProductCode = '121NM/L'; if (newProductCode.indexOf('/') > 0) { alert('Once you click OK, the text will disappear!!'); newProductCode = newProductCode.replace('/', '\\/'); $('#'...
@Pugazh probably has the correct way of doing it, but you could just isolate the `string` in `"` by searching using an `attribute` in jQuery. Here's a [link](https://api.jquery.com/attribute-equals-selector/) to the API documentation. It avoids having to do the replace altogether. It's a hacky way of doing it. ``` va...
45,545,547
I don't understand this simple code: ``` #!/usr/bin/env python # -*- coding: utf-8 -*- import time for val in "cacatcaca": try: if val == "c": print(val) time.sleep(0.5) if val == "a": print(val) time.sleep(0.5) except val == "t": print(...
2017/08/07
[ "https://Stackoverflow.com/questions/45545547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4652358/" ]
This code will print "We are stock at the letter t" until the end of time. ``` import time for val in 'cacatcaca': if val == 'c' or val == 'a': print(val) time.sleep(0.5) elif val == 't': while val == 't': print('We are stock at letter t') ```
You are using try-catch block wrongly here. You should put all you conditions in if-else statements under try block and if any exceptions then print those. ``` for val in "cacatcaca": try: if val == "c": print(val) time.sleep(0.5) elif val == "a": print(val) ...
45,545,547
I don't understand this simple code: ``` #!/usr/bin/env python # -*- coding: utf-8 -*- import time for val in "cacatcaca": try: if val == "c": print(val) time.sleep(0.5) if val == "a": print(val) time.sleep(0.5) except val == "t": print(...
2017/08/07
[ "https://Stackoverflow.com/questions/45545547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4652358/" ]
This code will print "We are stock at the letter t" until the end of time. ``` import time for val in 'cacatcaca': if val == 'c' or val == 'a': print(val) time.sleep(0.5) elif val == 't': while val == 't': print('We are stock at letter t') ```
For a reusable design, I would prefer using a solution based on such code: ``` def fetch_google_api_until_works(*args, **kwargs): ok = False while not ok: response = legacy_fetch_google_api(*args, **kwargs) ok = response.get('status', False) != 'OVER_QUERY_LIMIT' if not ok: ...
44,399,947
I'm very new to PHP, and I can't solve an issue even I read a lot of tutorials and SO posts. I've a custom class (user), and I'd like to instantiate it in php code, but even I include it, I get this error. > > Fatal error: Class 'User' not found in D:\wamp64\www\MyFirstPhp\formPhp.php on line 17 > > > Please help...
2017/06/06
[ "https://Stackoverflow.com/questions/44399947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3057944/" ]
`addJob()` is for adding jobs with no triggers attached: if that is what you want, just add a call to [`storeDurably()`](http://www.quartz-scheduler.org/api/2.1.7/org/quartz/JobBuilder.html#storeDurably()) to the JobBuilder; if, as I can only guess, you want to otherwise update the job while retaining the old trigger, ...
With non durable jobs, you must use [`scheduler.addJob(job, true, true)`](http://www.quartz-scheduler.org/api/2.2.1/org/quartz/Scheduler.html#addJob(org.quartz.JobDetail,%20boolean,%20boolean)) instead, with 3 parameters. The third parameter tells Quartz to store the job (in RAM) until it gets scheduled, that is until ...
44,399,947
I'm very new to PHP, and I can't solve an issue even I read a lot of tutorials and SO posts. I've a custom class (user), and I'd like to instantiate it in php code, but even I include it, I get this error. > > Fatal error: Class 'User' not found in D:\wamp64\www\MyFirstPhp\formPhp.php on line 17 > > > Please help...
2017/06/06
[ "https://Stackoverflow.com/questions/44399947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3057944/" ]
`addJob()` is for adding jobs with no triggers attached: if that is what you want, just add a call to [`storeDurably()`](http://www.quartz-scheduler.org/api/2.1.7/org/quartz/JobBuilder.html#storeDurably()) to the JobBuilder; if, as I can only guess, you want to otherwise update the job while retaining the old trigger, ...
In addition to the job-specific settings, if you are using Spring you should also make sure that your `SchedulerFactoryBean` has `overwriteExistingjobs = true`. Otherwise only the initial trigger/settings of a job will be persisted (if you are persisting them).
44,399,947
I'm very new to PHP, and I can't solve an issue even I read a lot of tutorials and SO posts. I've a custom class (user), and I'd like to instantiate it in php code, but even I include it, I get this error. > > Fatal error: Class 'User' not found in D:\wamp64\www\MyFirstPhp\formPhp.php on line 17 > > > Please help...
2017/06/06
[ "https://Stackoverflow.com/questions/44399947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3057944/" ]
`addJob()` is for adding jobs with no triggers attached: if that is what you want, just add a call to [`storeDurably()`](http://www.quartz-scheduler.org/api/2.1.7/org/quartz/JobBuilder.html#storeDurably()) to the JobBuilder; if, as I can only guess, you want to otherwise update the job while retaining the old trigger, ...
This will help to bypass traditional way of updating job. > > 1. Delete *existing job* first using *scheduler.**deleteJob(jobKey(name,group))***. > 2. Then Schedule new job using *scheduler.**scheduleJob(jobDetail,trigger,true)***. > > > surround your code with try/catch(SchedulerEception se) NOTE: Add this prop...
44,399,947
I'm very new to PHP, and I can't solve an issue even I read a lot of tutorials and SO posts. I've a custom class (user), and I'd like to instantiate it in php code, but even I include it, I get this error. > > Fatal error: Class 'User' not found in D:\wamp64\www\MyFirstPhp\formPhp.php on line 17 > > > Please help...
2017/06/06
[ "https://Stackoverflow.com/questions/44399947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3057944/" ]
With non durable jobs, you must use [`scheduler.addJob(job, true, true)`](http://www.quartz-scheduler.org/api/2.2.1/org/quartz/Scheduler.html#addJob(org.quartz.JobDetail,%20boolean,%20boolean)) instead, with 3 parameters. The third parameter tells Quartz to store the job (in RAM) until it gets scheduled, that is until ...
This will help to bypass traditional way of updating job. > > 1. Delete *existing job* first using *scheduler.**deleteJob(jobKey(name,group))***. > 2. Then Schedule new job using *scheduler.**scheduleJob(jobDetail,trigger,true)***. > > > surround your code with try/catch(SchedulerEception se) NOTE: Add this prop...
44,399,947
I'm very new to PHP, and I can't solve an issue even I read a lot of tutorials and SO posts. I've a custom class (user), and I'd like to instantiate it in php code, but even I include it, I get this error. > > Fatal error: Class 'User' not found in D:\wamp64\www\MyFirstPhp\formPhp.php on line 17 > > > Please help...
2017/06/06
[ "https://Stackoverflow.com/questions/44399947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3057944/" ]
In addition to the job-specific settings, if you are using Spring you should also make sure that your `SchedulerFactoryBean` has `overwriteExistingjobs = true`. Otherwise only the initial trigger/settings of a job will be persisted (if you are persisting them).
This will help to bypass traditional way of updating job. > > 1. Delete *existing job* first using *scheduler.**deleteJob(jobKey(name,group))***. > 2. Then Schedule new job using *scheduler.**scheduleJob(jobDetail,trigger,true)***. > > > surround your code with try/catch(SchedulerEception se) NOTE: Add this prop...
1,367,901
***Update.*** The answer to the main question for $d\geq 3$ is positive. For $d=1$, it is easy to show that the answer is negative. What is the answer for $d=2$? > > **Main Question.** Let $\mathbb{N}$ be the set of positive integers. Do there exist $d\in\mathbb{N}$ such that there are pairwise distinct > points $x\_...
2015/07/20
[ "https://math.stackexchange.com/questions/1367901", "https://math.stackexchange.com", "https://math.stackexchange.com/users/72152/" ]
*Main Question.* An answer is affirmative already for $d=3$. Indeed, for each $n$ put $$x\_n=\left(\frac 12\cos\frac{\pi}{n+1}, \frac 12\sin\frac{\pi}{n+1}, 0\right)$$ and $$y\_n=\left(-\frac 12\cos\frac{\pi}{n+1}, -\frac 12\sin\frac{\pi}{n+1}, \sin\frac{\pi}{2(n+1)(n+2)+1}\right).$$ Thus $\{x\_n\}$ is a sequence of po...
Regarding the $\ell^2$ version, here is an easy argument you can find these points for $J$ countable, even on a sphere. Note that if $(e\_n)\_n$ is the standard basis, then $d(\pm re\_n,\pm re\_m)=r^2\sqrt 2$ for $n\neq m$, and $d(re\_n,-re\_n)=2r$. So if we take any $r\in (\frac{1}{2},\frac{1}{\sqrt 2})$, then the se...
14,416,982
In my WPF application I use the Console Window as a debug/message window - I have options setup to show and hide the window as the user desires and all that works great. The only issue is that when the user closes the Console window it exits the entire program. How can I override this so that when the user click on the...
2013/01/19
[ "https://Stackoverflow.com/questions/14416982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/649382/" ]
So as has been discussed there is no way to prevent the Console Window from closing the WPF/Application Window. Prior to Windows Vista there were some workarounds, but since then they have been removed (probably for security reasons). The work around I was able to come up with was to disable the Exit button on the Cons...
I think you should look into creating the console using [AllocConsole](http://msdn.microsoft.com/en-us/library/windows/desktop/ms681944%28v=vs.85%29.aspx) and releasing it using [FreeConsole](http://msdn.microsoft.com/en-us/library/windows/desktop/ms683150%28v=vs.85%29.aspx). That way you may be able to give the user t...
1,194,532
Let $d \geq 4$. I'm interested by know if there is a surface $S$ of degree $d$ in $\mathbb P^3\_{\mathbb C}$ such that $S$ does not contains a line. I know I have no idea how to do it.
2015/03/17
[ "https://math.stackexchange.com/questions/1194532", "https://math.stackexchange.com", "https://math.stackexchange.com/users/224427/" ]
This is the famous Noether-Lefschetz theorem. The answer is that for a "very general" such surface -- meaning away from a countable union of proper closed subsets in the parameter space of all degree-d surfaces -- the only algebraic curves are complete intersections with other surfaces. In particular, there are no line...
I think that $$f(x,y,z) = x^4-3 x y+x^2 z+z^3+y^2+5$$ provides an example of a surface in ${\mathbb A}^3$ that does not contain a line in in ${\mathbb A}^3$. Substitute $x=u\_0 + t p\_0$, $y = v\_0 + t q\_0$ and $z = w\_0 + t r\_0$ in $f(x,y,z)$. Collect coefficients of powers of $t$: $$C\_4 t^4 + C\_3 t^3 + C\_2 t...
9,117,851
how can I possibly add a value to a 2 dimensional dynamic arrays? ``` String emp[][] = { {"001","Superman","Manda","123-1233","02-14-1970","Male","Manager","20,000","Regular"}, {"002","Batman","Manda","33-1233","07-14-2007","Male","Clerk","20,000","Regular"}, }; ``` I try this code ``` int arrLen = emp.lenght; emp[...
2012/02/02
[ "https://Stackoverflow.com/questions/9117851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033600/" ]
You can't *add* to an array - after creation, the size is fixed. You should consider using a [`List<E>`](http://docs.oracle.com/javase/7/docs/api/java/util/List.html) implementation such as [ArrayList](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html)... ideally having created a type to encapsulate thi...
You have a typo ``` lenght ``` Also, statements have to end in ``` ; ``` Finally, what your actual problem is: the length of an array is fixed at creation; array[array.length] will always point outside the array.
9,117,851
how can I possibly add a value to a 2 dimensional dynamic arrays? ``` String emp[][] = { {"001","Superman","Manda","123-1233","02-14-1970","Male","Manager","20,000","Regular"}, {"002","Batman","Manda","33-1233","07-14-2007","Male","Clerk","20,000","Regular"}, }; ``` I try this code ``` int arrLen = emp.lenght; emp[...
2012/02/02
[ "https://Stackoverflow.com/questions/9117851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033600/" ]
You can't *add* to an array - after creation, the size is fixed. You should consider using a [`List<E>`](http://docs.oracle.com/javase/7/docs/api/java/util/List.html) implementation such as [ArrayList](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html)... ideally having created a type to encapsulate thi...
Java arrays have fixed length. If you want resizable array use [ArrayList](http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html). Example: ``` ArrayList<String[]> list = new ArrayList<String[]>(); list.add(new String[]{"Superman","Manda","..."}); list.add(new String[]{"Superwoman","Manda","..."}); ```
9,117,851
how can I possibly add a value to a 2 dimensional dynamic arrays? ``` String emp[][] = { {"001","Superman","Manda","123-1233","02-14-1970","Male","Manager","20,000","Regular"}, {"002","Batman","Manda","33-1233","07-14-2007","Male","Clerk","20,000","Regular"}, }; ``` I try this code ``` int arrLen = emp.lenght; emp[...
2012/02/02
[ "https://Stackoverflow.com/questions/9117851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033600/" ]
You can't *add* to an array - after creation, the size is fixed. You should consider using a [`List<E>`](http://docs.oracle.com/javase/7/docs/api/java/util/List.html) implementation such as [ArrayList](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html)... ideally having created a type to encapsulate thi...
The array.length returns a number that is 1 higher than your index.
9,117,851
how can I possibly add a value to a 2 dimensional dynamic arrays? ``` String emp[][] = { {"001","Superman","Manda","123-1233","02-14-1970","Male","Manager","20,000","Regular"}, {"002","Batman","Manda","33-1233","07-14-2007","Male","Clerk","20,000","Regular"}, }; ``` I try this code ``` int arrLen = emp.lenght; emp[...
2012/02/02
[ "https://Stackoverflow.com/questions/9117851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033600/" ]
You can't *add* to an array - after creation, the size is fixed. You should consider using a [`List<E>`](http://docs.oracle.com/javase/7/docs/api/java/util/List.html) implementation such as [ArrayList](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html)... ideally having created a type to encapsulate thi...
Array objects are of fixed size. You can allocate a new, larger `String[][]` object and move the subarrays over to it -- i.e., ``` String[][] tmp = new String[emp.length + 1][]; for (int i=0; i<emp.length; ++i) tmp[i] = emp[i]; emp = tmp; ``` After this, there's an empty spot at the end of your main array. Fill i...
9,117,851
how can I possibly add a value to a 2 dimensional dynamic arrays? ``` String emp[][] = { {"001","Superman","Manda","123-1233","02-14-1970","Male","Manager","20,000","Regular"}, {"002","Batman","Manda","33-1233","07-14-2007","Male","Clerk","20,000","Regular"}, }; ``` I try this code ``` int arrLen = emp.lenght; emp[...
2012/02/02
[ "https://Stackoverflow.com/questions/9117851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033600/" ]
You can't *add* to an array - after creation, the size is fixed. You should consider using a [`List<E>`](http://docs.oracle.com/javase/7/docs/api/java/util/List.html) implementation such as [ArrayList](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html)... ideally having created a type to encapsulate thi...
You have two big issues with your current code. 1) Arrays aren't dynamic, and have fixed size. You should instead use the ArrayLists data structure, where you can add values. 2) Your array.Length returns some length n, but your array is indexed from 0 to (n-1). Hence, referencing to the length, will give you an index...
9,117,851
how can I possibly add a value to a 2 dimensional dynamic arrays? ``` String emp[][] = { {"001","Superman","Manda","123-1233","02-14-1970","Male","Manager","20,000","Regular"}, {"002","Batman","Manda","33-1233","07-14-2007","Male","Clerk","20,000","Regular"}, }; ``` I try this code ``` int arrLen = emp.lenght; emp[...
2012/02/02
[ "https://Stackoverflow.com/questions/9117851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033600/" ]
Java arrays have fixed length. If you want resizable array use [ArrayList](http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html). Example: ``` ArrayList<String[]> list = new ArrayList<String[]>(); list.add(new String[]{"Superman","Manda","..."}); list.add(new String[]{"Superwoman","Manda","..."}); ```
You have a typo ``` lenght ``` Also, statements have to end in ``` ; ``` Finally, what your actual problem is: the length of an array is fixed at creation; array[array.length] will always point outside the array.
9,117,851
how can I possibly add a value to a 2 dimensional dynamic arrays? ``` String emp[][] = { {"001","Superman","Manda","123-1233","02-14-1970","Male","Manager","20,000","Regular"}, {"002","Batman","Manda","33-1233","07-14-2007","Male","Clerk","20,000","Regular"}, }; ``` I try this code ``` int arrLen = emp.lenght; emp[...
2012/02/02
[ "https://Stackoverflow.com/questions/9117851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033600/" ]
Java arrays have fixed length. If you want resizable array use [ArrayList](http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html). Example: ``` ArrayList<String[]> list = new ArrayList<String[]>(); list.add(new String[]{"Superman","Manda","..."}); list.add(new String[]{"Superwoman","Manda","..."}); ```
The array.length returns a number that is 1 higher than your index.
9,117,851
how can I possibly add a value to a 2 dimensional dynamic arrays? ``` String emp[][] = { {"001","Superman","Manda","123-1233","02-14-1970","Male","Manager","20,000","Regular"}, {"002","Batman","Manda","33-1233","07-14-2007","Male","Clerk","20,000","Regular"}, }; ``` I try this code ``` int arrLen = emp.lenght; emp[...
2012/02/02
[ "https://Stackoverflow.com/questions/9117851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033600/" ]
Java arrays have fixed length. If you want resizable array use [ArrayList](http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html). Example: ``` ArrayList<String[]> list = new ArrayList<String[]>(); list.add(new String[]{"Superman","Manda","..."}); list.add(new String[]{"Superwoman","Manda","..."}); ```
Array objects are of fixed size. You can allocate a new, larger `String[][]` object and move the subarrays over to it -- i.e., ``` String[][] tmp = new String[emp.length + 1][]; for (int i=0; i<emp.length; ++i) tmp[i] = emp[i]; emp = tmp; ``` After this, there's an empty spot at the end of your main array. Fill i...
9,117,851
how can I possibly add a value to a 2 dimensional dynamic arrays? ``` String emp[][] = { {"001","Superman","Manda","123-1233","02-14-1970","Male","Manager","20,000","Regular"}, {"002","Batman","Manda","33-1233","07-14-2007","Male","Clerk","20,000","Regular"}, }; ``` I try this code ``` int arrLen = emp.lenght; emp[...
2012/02/02
[ "https://Stackoverflow.com/questions/9117851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033600/" ]
Java arrays have fixed length. If you want resizable array use [ArrayList](http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html). Example: ``` ArrayList<String[]> list = new ArrayList<String[]>(); list.add(new String[]{"Superman","Manda","..."}); list.add(new String[]{"Superwoman","Manda","..."}); ```
You have two big issues with your current code. 1) Arrays aren't dynamic, and have fixed size. You should instead use the ArrayLists data structure, where you can add values. 2) Your array.Length returns some length n, but your array is indexed from 0 to (n-1). Hence, referencing to the length, will give you an index...
30,220,145
I am using Expressionengine 2. I would like to check to see if the file description is not empty so that if there is any content it will be used instead of the entry title in the alt tag. Currently I have the code below which brings in the entry title but I can't work out how I get the logic in place to check the exi...
2015/05/13
[ "https://Stackoverflow.com/questions/30220145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4896481/" ]
We could use `dcast` from the devel version of `data.table`, ie. `v1.9.5`. We can install it from [`here`](https://github.com/Rdatatable/data.table/wiki/Installation) ``` library(data.table)#v1.9.5+ dcast(setDT(df.in)[order(when),action:= paste0('action', 1:.N) ,who], who~action, value.var='...
I see that you have tagged plyr, but you can also do this with dplyr. Something like the below should work: ``` df.in %>% group_by(who) %>% arrange(when) %>% summarise(action1 = first(what), action2 = nth(what, 2), action3 = nth(what, 3), action4 = last(what)) ``...
30,220,145
I am using Expressionengine 2. I would like to check to see if the file description is not empty so that if there is any content it will be used instead of the entry title in the alt tag. Currently I have the code below which brings in the entry title but I can't work out how I get the logic in place to check the exi...
2015/05/13
[ "https://Stackoverflow.com/questions/30220145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4896481/" ]
We could use `dcast` from the devel version of `data.table`, ie. `v1.9.5`. We can install it from [`here`](https://github.com/Rdatatable/data.table/wiki/Installation) ``` library(data.table)#v1.9.5+ dcast(setDT(df.in)[order(when),action:= paste0('action', 1:.N) ,who], who~action, value.var='...
You can also you use the combo `dplyr` + `tidyr` ``` library(dplyr) library(tidyr) df.in %>% group_by(who) %>% mutate(when = rank(when), when = paste0("action", when)) %>% spread(key = when, value = what) ## who action1 action2 action3 action4 ## 1 George sleep run NA NA ## 2 John sl...
30,220,145
I am using Expressionengine 2. I would like to check to see if the file description is not empty so that if there is any content it will be used instead of the entry title in the alt tag. Currently I have the code below which brings in the entry title but I can't work out how I get the logic in place to check the exi...
2015/05/13
[ "https://Stackoverflow.com/questions/30220145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4896481/" ]
We could use `dcast` from the devel version of `data.table`, ie. `v1.9.5`. We can install it from [`here`](https://github.com/Rdatatable/data.table/wiki/Installation) ``` library(data.table)#v1.9.5+ dcast(setDT(df.in)[order(when),action:= paste0('action', 1:.N) ,who], who~action, value.var='...
Here is a method using a more traditional `split-apply-combine`. It's more idiomatic R code than the `for` loop, though {dplyr} and {data.table} solutions seem to more common than this type of {base} R solution. This method uses `dcast` from {reshape2} but it could also use `reshape()` for a purely {base} R solution. ...
30,220,145
I am using Expressionengine 2. I would like to check to see if the file description is not empty so that if there is any content it will be used instead of the entry title in the alt tag. Currently I have the code below which brings in the entry title but I can't work out how I get the logic in place to check the exi...
2015/05/13
[ "https://Stackoverflow.com/questions/30220145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4896481/" ]
You can also you use the combo `dplyr` + `tidyr` ``` library(dplyr) library(tidyr) df.in %>% group_by(who) %>% mutate(when = rank(when), when = paste0("action", when)) %>% spread(key = when, value = what) ## who action1 action2 action3 action4 ## 1 George sleep run NA NA ## 2 John sl...
I see that you have tagged plyr, but you can also do this with dplyr. Something like the below should work: ``` df.in %>% group_by(who) %>% arrange(when) %>% summarise(action1 = first(what), action2 = nth(what, 2), action3 = nth(what, 3), action4 = last(what)) ``...
30,220,145
I am using Expressionengine 2. I would like to check to see if the file description is not empty so that if there is any content it will be used instead of the entry title in the alt tag. Currently I have the code below which brings in the entry title but I can't work out how I get the logic in place to check the exi...
2015/05/13
[ "https://Stackoverflow.com/questions/30220145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4896481/" ]
You can also you use the combo `dplyr` + `tidyr` ``` library(dplyr) library(tidyr) df.in %>% group_by(who) %>% mutate(when = rank(when), when = paste0("action", when)) %>% spread(key = when, value = what) ## who action1 action2 action3 action4 ## 1 George sleep run NA NA ## 2 John sl...
Here is a method using a more traditional `split-apply-combine`. It's more idiomatic R code than the `for` loop, though {dplyr} and {data.table} solutions seem to more common than this type of {base} R solution. This method uses `dcast` from {reshape2} but it could also use `reshape()` for a purely {base} R solution. ...
14,294,083
I am trying to evaluate an expression taken as a character array and return the result of the expression. eg: ``` char *myeExpression []= "(1+2) * 3" ``` should return result 9. Here is my code: ``` struct node { double element; struct node *next; } *head; void push(int c); // function to push a node onto t...
2013/01/12
[ "https://Stackoverflow.com/questions/14294083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242599/" ]
Your code doesn't explicitly ignore or otherwise handle blanks; this is one cause of trouble? The compiler indicates that: * `k` is not initialized * `l` is not initialized These uninitialized values are used as indexes into arrays. You use `for (i = 0; i < 10; i++)` to scan the string, regardless of its actual lengt...
You could learn lex and yacc as they take much of the difficulty out of building lexers and parsers. "calc" is a standard example which can calculate simple arithmetic expressions. You can find it, for example, [here](http://www.cs.man.ac.uk/~pjj/cs2121/ho/node4.html).
59,381,962
I installed the new Unity UI Builder. Everything works just fine... But how do I add the uxml to my scene or how do I attache it to camera? I tried to drag and drop the uxml to camera and I searched for a component, but I couldn't find anything... Is there any official documentation?
2019/12/17
[ "https://Stackoverflow.com/questions/59381962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You must use an gameObject with PanelRenderer.cs attached to it: [![Panel renderer in order to use uxml in runtime](https://i.stack.imgur.com/bgp8C.png)](https://i.stack.imgur.com/bgp8C.png) For now, I only know you have to set UXML file and USS file. In play mode, by magic (I still don't understand how unity does it)...
Runtime support is still not available using the packet manager. You can add the preview version to your project by adding the following line to your `manifest.json` (it's located in the projects `Packages`-folder) ``` "com.unity.ui.runtime": "0.0.4-preview" ``` You may want to [check whether a newer version is ava...
59,381,962
I installed the new Unity UI Builder. Everything works just fine... But how do I add the uxml to my scene or how do I attache it to camera? I tried to drag and drop the uxml to camera and I searched for a component, but I couldn't find anything... Is there any official documentation?
2019/12/17
[ "https://Stackoverflow.com/questions/59381962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You must use an gameObject with PanelRenderer.cs attached to it: [![Panel renderer in order to use uxml in runtime](https://i.stack.imgur.com/bgp8C.png)](https://i.stack.imgur.com/bgp8C.png) For now, I only know you have to set UXML file and USS file. In play mode, by magic (I still don't understand how unity does it)...
1. Even though the UI Builder offers a preview of the menu over the actual game scene, there is no way to use that menu in a game using Unity's functionality or packages. To do that we need to use the code that comes with the demo by Damian Campeanu from Unite Copenhagen 2019 that you can find here: <https://github.com...
59,381,962
I installed the new Unity UI Builder. Everything works just fine... But how do I add the uxml to my scene or how do I attache it to camera? I tried to drag and drop the uxml to camera and I searched for a component, but I couldn't find anything... Is there any official documentation?
2019/12/17
[ "https://Stackoverflow.com/questions/59381962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You must use an gameObject with PanelRenderer.cs attached to it: [![Panel renderer in order to use uxml in runtime](https://i.stack.imgur.com/bgp8C.png)](https://i.stack.imgur.com/bgp8C.png) For now, I only know you have to set UXML file and USS file. In play mode, by magic (I still don't understand how unity does it)...
In Unity 2021.2, when you add a UI Document to the hierarchy, a PanelSettings asset is automatically created and assigned to the that UI Document. Simply add your uxml file to the UI Document -- there is no Panel Renderer component anymore.
59,381,962
I installed the new Unity UI Builder. Everything works just fine... But how do I add the uxml to my scene or how do I attache it to camera? I tried to drag and drop the uxml to camera and I searched for a component, but I couldn't find anything... Is there any official documentation?
2019/12/17
[ "https://Stackoverflow.com/questions/59381962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Runtime support is still not available using the packet manager. You can add the preview version to your project by adding the following line to your `manifest.json` (it's located in the projects `Packages`-folder) ``` "com.unity.ui.runtime": "0.0.4-preview" ``` You may want to [check whether a newer version is ava...
1. Even though the UI Builder offers a preview of the menu over the actual game scene, there is no way to use that menu in a game using Unity's functionality or packages. To do that we need to use the code that comes with the demo by Damian Campeanu from Unite Copenhagen 2019 that you can find here: <https://github.com...
59,381,962
I installed the new Unity UI Builder. Everything works just fine... But how do I add the uxml to my scene or how do I attache it to camera? I tried to drag and drop the uxml to camera and I searched for a component, but I couldn't find anything... Is there any official documentation?
2019/12/17
[ "https://Stackoverflow.com/questions/59381962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Runtime support is still not available using the packet manager. You can add the preview version to your project by adding the following line to your `manifest.json` (it's located in the projects `Packages`-folder) ``` "com.unity.ui.runtime": "0.0.4-preview" ``` You may want to [check whether a newer version is ava...
In Unity 2021.2, when you add a UI Document to the hierarchy, a PanelSettings asset is automatically created and assigned to the that UI Document. Simply add your uxml file to the UI Document -- there is no Panel Renderer component anymore.
59,381,962
I installed the new Unity UI Builder. Everything works just fine... But how do I add the uxml to my scene or how do I attache it to camera? I tried to drag and drop the uxml to camera and I searched for a component, but I couldn't find anything... Is there any official documentation?
2019/12/17
[ "https://Stackoverflow.com/questions/59381962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
In Unity 2021.2, when you add a UI Document to the hierarchy, a PanelSettings asset is automatically created and assigned to the that UI Document. Simply add your uxml file to the UI Document -- there is no Panel Renderer component anymore.
1. Even though the UI Builder offers a preview of the menu over the actual game scene, there is no way to use that menu in a game using Unity's functionality or packages. To do that we need to use the code that comes with the demo by Damian Campeanu from Unite Copenhagen 2019 that you can find here: <https://github.com...
26,737,634
I am new to Sails and facing a small issue with models. I have defined a user model as follows: ``` module.exports = { attributes: { firstName: { type: 'string' }, lastName: { type: 'string' }, email: { type: 'email', required: true }, password: { type: 'String' ...
2014/11/04
[ "https://Stackoverflow.com/questions/26737634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1355500/" ]
Overriding `Equals` in this situation seems a little overkill here, why not just do ``` currentPerson.Vessels.Any(x => x.ID == currentVessel.ID) ```
change ``` if (currentPerson.Vessels.Contains(currentVessel)) { return true; } else return false; ``` to ``` return currentPerson.Vessels.Any(x => x.ID == currentVessel.ID) ```
26,737,634
I am new to Sails and facing a small issue with models. I have defined a user model as follows: ``` module.exports = { attributes: { firstName: { type: 'string' }, lastName: { type: 'string' }, email: { type: 'email', required: true }, password: { type: 'String' ...
2014/11/04
[ "https://Stackoverflow.com/questions/26737634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1355500/" ]
Overriding `Equals` in this situation seems a little overkill here, why not just do ``` currentPerson.Vessels.Any(x => x.ID == currentVessel.ID) ```
The solution suggested by @james is not the best practice. here why if you have a long list of Vessels that should be added to a `Hashset<Vessel>` contains method will cost only `O(1)` since it will be indexed on `GetHashCode` while `.Any` is an extension method that should iterate through all elements to find the rig...
26,737,634
I am new to Sails and facing a small issue with models. I have defined a user model as follows: ``` module.exports = { attributes: { firstName: { type: 'string' }, lastName: { type: 'string' }, email: { type: 'email', required: true }, password: { type: 'String' ...
2014/11/04
[ "https://Stackoverflow.com/questions/26737634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1355500/" ]
The solution suggested by @james is not the best practice. here why if you have a long list of Vessels that should be added to a `Hashset<Vessel>` contains method will cost only `O(1)` since it will be indexed on `GetHashCode` while `.Any` is an extension method that should iterate through all elements to find the rig...
change ``` if (currentPerson.Vessels.Contains(currentVessel)) { return true; } else return false; ``` to ``` return currentPerson.Vessels.Any(x => x.ID == currentVessel.ID) ```
45,205,375
So, I have an `'is_abandoned'` boolean on one of my tables, where if it's `true`, I'd like the model to be automatically excluded from any query - just like softDeletes does. Is there something I can set in the model that'd achieve this? I'm leaning towards maybe a mutator?
2017/07/20
[ "https://Stackoverflow.com/questions/45205375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6448335/" ]
**These are called [Global Query Scopes](https://laravel.com/docs/5.4/eloquent#query-scopes).** > > Writing a global scope is simple. Define a class that implements the `Illuminate\Database\Eloquent\Scope` interface. This interface requires you to implement one method: `apply`. The `apply` method may add `where` cons...
You can just exclude the record using eloquent where function ``` $lists = List::where('is_abandoned',false); ```
45,205,375
So, I have an `'is_abandoned'` boolean on one of my tables, where if it's `true`, I'd like the model to be automatically excluded from any query - just like softDeletes does. Is there something I can set in the model that'd achieve this? I'm leaning towards maybe a mutator?
2017/07/20
[ "https://Stackoverflow.com/questions/45205375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6448335/" ]
**These are called [Global Query Scopes](https://laravel.com/docs/5.4/eloquent#query-scopes).** > > Writing a global scope is simple. Define a class that implements the `Illuminate\Database\Eloquent\Scope` interface. This interface requires you to implement one method: `apply`. The `apply` method may add `where` cons...
Here's an example: Create a function within the `Eloquent` ``` class User extends Eloquent { public function scopeAbandoned($query) { return $query->where('is_abandoned', '=', 1/*true*/); } } ``` Then simply use it like this: ``` $approvedPosts = Post::abandoned()-><put_your_own_condition>; ...
40,304,298
Java code should download source code from facebook graph api, but is not working. Code output is `htmlCode = ""` This is java code: ``` package cz.apps; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; import org.json.JSONArray; import org.json.JSONExceptio...
2016/10/28
[ "https://Stackoverflow.com/questions/40304298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6760087/" ]
You have to use this code not in mainUI Thread. So, ``` new Thread(new Runnable() { public void run() { try { ziskatdata(); } catch (Exception e) { e.printStackTrace(); } } }).start(); ``` and inside your method update all UI view using this: ``` runOnUiThread...
The error says that you are trying to make a network call on the main thread of the application, which is not permitted. You need to spawn another thread to make a network call. You can do something like: ``` new Thread() { @Override public void run() { // do your work here } }.start(); ``` But y...
61,328,815
I have a db with records like the following structure in the table; ``` id,msg,date,fid 19 ,"start","2012-02",NULL 20 ,"end","2012-03",19 21 , "start",2012-04,NULL ``` I have and entire db set up like this where the fid in some cases matches the id of another record. Id like to return all records that have matc...
2020/04/20
[ "https://Stackoverflow.com/questions/61328815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11343245/" ]
It is Probably because of JDK version as mention above. You can verify by running react native doctor ``` npx @react-native-community/cli doctor ```
your problem can be resolved just follow these steps: To jetify / convert node\_modules dependencies to AndroidX Imagine you have a react-native project. One of your library dependencies converts to AndroidX., and you need to use the new version. So now you need to convert your app to AndroidX, but many of your react-...
61,328,815
I have a db with records like the following structure in the table; ``` id,msg,date,fid 19 ,"start","2012-02",NULL 20 ,"end","2012-03",19 21 , "start",2012-04,NULL ``` I have and entire db set up like this where the fid in some cases matches the id of another record. Id like to return all records that have matc...
2020/04/20
[ "https://Stackoverflow.com/questions/61328815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11343245/" ]
It is Probably because of JDK version as mention above. You can verify by running react native doctor ``` npx @react-native-community/cli doctor ```
Please make changes as per below to resolve this error. > > Install **Java SDK** version: 14 or above. > > > JDK Download link: <https://www.oracle.com/java/technologies/javase-jdk14-downloads.html> > > In `gradle-wrapper.properties` please use grade version 6.3 or above. > > > For e.g:`distributionUrl=http...
61,328,815
I have a db with records like the following structure in the table; ``` id,msg,date,fid 19 ,"start","2012-02",NULL 20 ,"end","2012-03",19 21 , "start",2012-04,NULL ``` I have and entire db set up like this where the fid in some cases matches the id of another record. Id like to return all records that have matc...
2020/04/20
[ "https://Stackoverflow.com/questions/61328815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11343245/" ]
It is Probably because of JDK version as mention above. You can verify by running react native doctor ``` npx @react-native-community/cli doctor ```
This link is the complete solution but here is a little problem if you have win32 but if you have win64 you are good to go. ``` **https://www.npmjs.com/package/jetifier#do_you_need_this** ``` hope this answer will be useful for you feel free for any problem.
61,328,815
I have a db with records like the following structure in the table; ``` id,msg,date,fid 19 ,"start","2012-02",NULL 20 ,"end","2012-03",19 21 , "start",2012-04,NULL ``` I have and entire db set up like this where the fid in some cases matches the id of another record. Id like to return all records that have matc...
2020/04/20
[ "https://Stackoverflow.com/questions/61328815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11343245/" ]
Install JDK 1.8 and setup $JAVA\_HOME env variable and try to run the app again. The error is due to lower version of JDK or JDK not installed.
Please make changes as per below to resolve this error. > > Install **Java SDK** version: 14 or above. > > > JDK Download link: <https://www.oracle.com/java/technologies/javase-jdk14-downloads.html> > > In `gradle-wrapper.properties` please use grade version 6.3 or above. > > > For e.g:`distributionUrl=http...
61,328,815
I have a db with records like the following structure in the table; ``` id,msg,date,fid 19 ,"start","2012-02",NULL 20 ,"end","2012-03",19 21 , "start",2012-04,NULL ``` I have and entire db set up like this where the fid in some cases matches the id of another record. Id like to return all records that have matc...
2020/04/20
[ "https://Stackoverflow.com/questions/61328815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11343245/" ]
your problem can be resolved just follow these steps: To jetify / convert node\_modules dependencies to AndroidX Imagine you have a react-native project. One of your library dependencies converts to AndroidX., and you need to use the new version. So now you need to convert your app to AndroidX, but many of your react-...
The error is due to the version of JDK or JDK not installed. i think you need to solve in the section: open the androind folder with android studio then file-> project structure -> SDK location and in here you can change, in my case i change the version [![enter image description here](https://i.stack.imgur.com/4fAe...
61,328,815
I have a db with records like the following structure in the table; ``` id,msg,date,fid 19 ,"start","2012-02",NULL 20 ,"end","2012-03",19 21 , "start",2012-04,NULL ``` I have and entire db set up like this where the fid in some cases matches the id of another record. Id like to return all records that have matc...
2020/04/20
[ "https://Stackoverflow.com/questions/61328815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11343245/" ]
your problem can be resolved just follow these steps: To jetify / convert node\_modules dependencies to AndroidX Imagine you have a react-native project. One of your library dependencies converts to AndroidX., and you need to use the new version. So now you need to convert your app to AndroidX, but many of your react-...
This link is the complete solution but here is a little problem if you have win32 but if you have win64 you are good to go. ``` **https://www.npmjs.com/package/jetifier#do_you_need_this** ``` hope this answer will be useful for you feel free for any problem.
61,328,815
I have a db with records like the following structure in the table; ``` id,msg,date,fid 19 ,"start","2012-02",NULL 20 ,"end","2012-03",19 21 , "start",2012-04,NULL ``` I have and entire db set up like this where the fid in some cases matches the id of another record. Id like to return all records that have matc...
2020/04/20
[ "https://Stackoverflow.com/questions/61328815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11343245/" ]
Install JDK 1.8 and setup $JAVA\_HOME env variable and try to run the app again. The error is due to lower version of JDK or JDK not installed.
This link is the complete solution but here is a little problem if you have win32 but if you have win64 you are good to go. ``` **https://www.npmjs.com/package/jetifier#do_you_need_this** ``` hope this answer will be useful for you feel free for any problem.
61,328,815
I have a db with records like the following structure in the table; ``` id,msg,date,fid 19 ,"start","2012-02",NULL 20 ,"end","2012-03",19 21 , "start",2012-04,NULL ``` I have and entire db set up like this where the fid in some cases matches the id of another record. Id like to return all records that have matc...
2020/04/20
[ "https://Stackoverflow.com/questions/61328815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11343245/" ]
Install JDK 1.8 and setup $JAVA\_HOME env variable and try to run the app again. The error is due to lower version of JDK or JDK not installed.
The error is due to the version of JDK or JDK not installed. i think you need to solve in the section: open the androind folder with android studio then file-> project structure -> SDK location and in here you can change, in my case i change the version [![enter image description here](https://i.stack.imgur.com/4fAe...
61,328,815
I have a db with records like the following structure in the table; ``` id,msg,date,fid 19 ,"start","2012-02",NULL 20 ,"end","2012-03",19 21 , "start",2012-04,NULL ``` I have and entire db set up like this where the fid in some cases matches the id of another record. Id like to return all records that have matc...
2020/04/20
[ "https://Stackoverflow.com/questions/61328815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11343245/" ]
It is Probably because of JDK version as mention above. You can verify by running react native doctor ``` npx @react-native-community/cli doctor ```
The error is due to the version of JDK or JDK not installed. i think you need to solve in the section: open the androind folder with android studio then file-> project structure -> SDK location and in here you can change, in my case i change the version [![enter image description here](https://i.stack.imgur.com/4fAe...
61,328,815
I have a db with records like the following structure in the table; ``` id,msg,date,fid 19 ,"start","2012-02",NULL 20 ,"end","2012-03",19 21 , "start",2012-04,NULL ``` I have and entire db set up like this where the fid in some cases matches the id of another record. Id like to return all records that have matc...
2020/04/20
[ "https://Stackoverflow.com/questions/61328815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11343245/" ]
your problem can be resolved just follow these steps: To jetify / convert node\_modules dependencies to AndroidX Imagine you have a react-native project. One of your library dependencies converts to AndroidX., and you need to use the new version. So now you need to convert your app to AndroidX, but many of your react-...
Please make changes as per below to resolve this error. > > Install **Java SDK** version: 14 or above. > > > JDK Download link: <https://www.oracle.com/java/technologies/javase-jdk14-downloads.html> > > In `gradle-wrapper.properties` please use grade version 6.3 or above. > > > For e.g:`distributionUrl=http...
64,207,910
I have a Stateless widget called ToggleButtonsList and one of my instance fields, isSelectedType, is not set to final. This is the warning I am receiving because of this: "This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: ToggleButtons...
2020/10/05
[ "https://Stackoverflow.com/questions/64207910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3932449/" ]
I think your mixing `State` and `StatefulWidget` class. The `Widget` class itself is `immutable` and both `StatelessWidget` and `StatefulWidget` extends from `Widget`class. In your specific case, `isSelectedType` variable can be `final`, because final collections can grow or shrink. Only constant collections won't all...
Both stateful and stateless widgets need to be immutable. This is enforced by `@immutable` on `Widget` class. See [Flutter: Mutable fields in stateless widgets](https://stackoverflow.com/questions/53192469/flutter-mutable-fields-in-stateless-widgets): > > Stateless widgets should only have final fields, with **no ex...
33,099
I am looking for an example of two random variables $X,Y$ such that (a) $X,Y$ are not independent. (b) At least one of $X,Y$ is not normal. (c) $E(X|y)$ (expected value of $X$ given $Y=y$) is linear in $y$, i.e. of the form $a+by$, and $E(Y|x)$ is linear in $x$. (d) The correlation coefficient $\rho\neq \pm 1$.
2011/04/15
[ "https://math.stackexchange.com/questions/33099", "https://math.stackexchange.com", "https://math.stackexchange.com/users/3249/" ]
A general method to get such $X, Y$ is as follows: Let $Y,Z$ be independent identically distributed random variables. Let $X=Y+Z$. Then as noted above $E(X|y)=y+E(Z)$ is linear in $y$. And intuitively, $E(Y|x)=E(Z|x)=x/2$. This can be proved rigorously (for continuous case) as follows: Suppose the density function...
Let $Y$ be any discrete random variable, choose constants $a$ and $b$, and just set $X=aY+b$. They are not independent, not Gaussian, and the conditional expectations are linear as you wanted.
33,099
I am looking for an example of two random variables $X,Y$ such that (a) $X,Y$ are not independent. (b) At least one of $X,Y$ is not normal. (c) $E(X|y)$ (expected value of $X$ given $Y=y$) is linear in $y$, i.e. of the form $a+by$, and $E(Y|x)$ is linear in $x$. (d) The correlation coefficient $\rho\neq \pm 1$.
2011/04/15
[ "https://math.stackexchange.com/questions/33099", "https://math.stackexchange.com", "https://math.stackexchange.com/users/3249/" ]
Let $Y$ be any discrete random variable, choose constants $a$ and $b$, and just set $X=aY+b$. They are not independent, not Gaussian, and the conditional expectations are linear as you wanted.
Note that if Y is a binary random variable, then *any* function of Y is linear in Y. For example $$ \sin(Y)\;=\;\sin(0)\;+\;(\sin(1)-\sin(0))\cdot Y. $$ This means that any generic distribution over $\{0,1\}^2$ satisfies your conditions. By the way, in general, if $E(X|Y)$ is linear in $Y$, then it must be necessari...
33,099
I am looking for an example of two random variables $X,Y$ such that (a) $X,Y$ are not independent. (b) At least one of $X,Y$ is not normal. (c) $E(X|y)$ (expected value of $X$ given $Y=y$) is linear in $y$, i.e. of the form $a+by$, and $E(Y|x)$ is linear in $x$. (d) The correlation coefficient $\rho\neq \pm 1$.
2011/04/15
[ "https://math.stackexchange.com/questions/33099", "https://math.stackexchange.com", "https://math.stackexchange.com/users/3249/" ]
A general method to get such $X, Y$ is as follows: Let $Y,Z$ be independent identically distributed random variables. Let $X=Y+Z$. Then as noted above $E(X|y)=y+E(Z)$ is linear in $y$. And intuitively, $E(Y|x)=E(Z|x)=x/2$. This can be proved rigorously (for continuous case) as follows: Suppose the density function...
$Y, Z$ are r.v.'s. Let $X=aY+bZ$. Then the correlation should not be $\pm1$.
33,099
I am looking for an example of two random variables $X,Y$ such that (a) $X,Y$ are not independent. (b) At least one of $X,Y$ is not normal. (c) $E(X|y)$ (expected value of $X$ given $Y=y$) is linear in $y$, i.e. of the form $a+by$, and $E(Y|x)$ is linear in $x$. (d) The correlation coefficient $\rho\neq \pm 1$.
2011/04/15
[ "https://math.stackexchange.com/questions/33099", "https://math.stackexchange.com", "https://math.stackexchange.com/users/3249/" ]
$Y, Z$ are r.v.'s. Let $X=aY+bZ$. Then the correlation should not be $\pm1$.
Note that if Y is a binary random variable, then *any* function of Y is linear in Y. For example $$ \sin(Y)\;=\;\sin(0)\;+\;(\sin(1)-\sin(0))\cdot Y. $$ This means that any generic distribution over $\{0,1\}^2$ satisfies your conditions. By the way, in general, if $E(X|Y)$ is linear in $Y$, then it must be necessari...
33,099
I am looking for an example of two random variables $X,Y$ such that (a) $X,Y$ are not independent. (b) At least one of $X,Y$ is not normal. (c) $E(X|y)$ (expected value of $X$ given $Y=y$) is linear in $y$, i.e. of the form $a+by$, and $E(Y|x)$ is linear in $x$. (d) The correlation coefficient $\rho\neq \pm 1$.
2011/04/15
[ "https://math.stackexchange.com/questions/33099", "https://math.stackexchange.com", "https://math.stackexchange.com/users/3249/" ]
A general method to get such $X, Y$ is as follows: Let $Y,Z$ be independent identically distributed random variables. Let $X=Y+Z$. Then as noted above $E(X|y)=y+E(Z)$ is linear in $y$. And intuitively, $E(Y|x)=E(Z|x)=x/2$. This can be proved rigorously (for continuous case) as follows: Suppose the density function...
Note that if Y is a binary random variable, then *any* function of Y is linear in Y. For example $$ \sin(Y)\;=\;\sin(0)\;+\;(\sin(1)-\sin(0))\cdot Y. $$ This means that any generic distribution over $\{0,1\}^2$ satisfies your conditions. By the way, in general, if $E(X|Y)$ is linear in $Y$, then it must be necessari...
44,140,269
I'm trying to find the most effective pattern for binding a control in an ASP.Net form to a database tables that contains a couple of enums as integer values. For example, if I have these enums defined in code: ``` [Flags] public enum VisibleTo { None = 0, Customers = 1, Employees = 2, Managers = 4 } ...
2017/05/23
[ "https://Stackoverflow.com/questions/44140269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4017643/" ]
You can cast the value from the database directly to the Enum and get it's string value. ``` <asp:TemplateField HeaderText="Link Type"> <ItemTemplate> <%# (LinkType)Convert.ToInt32(Eval("LinkType")) %> </ItemTemplate> </asp:TemplateField> ```
What I do is: ``` [Flags] public enum VisibleTo { [Description("None")] None = 0, [Description("Customers")] Customers = 1, [Description("Employees")] Employees = 2, [Description("Managers")] Managers = 4 } ``` Then I have this ``` public static string GetEnumDescription(Enum en) { ...
30,593,358
I have a PHP Code ``` $brandNames = array(); foreach ($maufacturers as $manu) { array_push($brandNames, array($manu->getTitle() => $manu->getUrl())); } print_r($brandNames); ``` I am getting output as ``` Array ( [0] => Array ( [key0] => val0 ) [1] => Array ( ...
2015/06/02
[ "https://Stackoverflow.com/questions/30593358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3817669/" ]
``` $brandNames = array(); foreach ($maufacturers as $manu) { $brandNames[$manu->getTitle()] = $manu->getUrl(); } print_r($brandNames); ```
Change your code to: ``` $brandNames = array(); foreach ($maufacturers as $key => $manu) { $brandNames[$manu->getTitle()] = $manu->getUrl(); } print_r($brandNames); ```
3,827,558
My application handles with files of type `*.mndl` which is not more than a customized `*.plist`. Up until now I've been using `*.plist` files but now I want to associate the extension and be able to open `*.mndl` files from any other app I have realized that renaming `file.plist` to `file.mndl` does not work. (Hence, ...
2010/09/30
[ "https://Stackoverflow.com/questions/3827558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/149008/" ]
At least for a Cocoa (desktop) app, you'd want to add the following information to your application's Info.plist. <http://www.markdouma.com/developer/nacho.plist> Obviously, you should change the uniform type identifier to something appropriate. (I usually do com.markdouma.something, since that's my website). Note t...
Eventually I found this which could be used as a reference too: I found this on Google's cache and it shows how to add several extensions with different properties :) ``` <key>UTImportedTypeDeclarations</key> <array> <dict> <key>UTTypeConformsTo</key> <string>public.audio</string> <key>UTTypeIdentifier</ke...
838,061
I just started out with Flex, and while I have worked with Actionscript2 for a few years, I'm still getting my head around Actionscript3. I've been diving into Flex for the past week, and can't figure this one thing out. I am looking into the best way (or 'a' way) to allow me and other folks working on this project to...
2009/05/08
[ "https://Stackoverflow.com/questions/838061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You'd be surprised to what degree a Flex application can change its appearance through styling. Check out the following project: <http://www.fillcolors.com/> If you need more flexibility still, you could have an application with multiple views, one for each theme you want to show. An easy way to do this in Flex is to...
I'm not an expert on Flex. But I've seen a tutorial on skins in Flex on [gotoAndLearn.com](http://www.gotoandlearn.com). Maybe that kan give you some hints: [Introduction to Flex: Part 3](http://www.gotoandlearn.com/play?id=101)
22,257,784
I am reading a book called C for Java Programmers. It gives an example about nameless structs that I do not undestand. It says that this is valid: ``` struct{ int val1, val2; double val3; } s1,s2; s1.val1 = 5; s2.val3 = 4.6; ``` If structs are similar to objects in Java, why can't I just say val1 = 5 and val...
2014/03/07
[ "https://Stackoverflow.com/questions/22257784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1896016/" ]
To initialise a `struct` variable you need to add an appropriate initialiser: ``` struct { int val1, val2; double val3; } s1 = { 1, 2, 3. }; ```
By writing: ``` struct { int val1, val2; double val3; } s1, s2; ``` inside, let's say, the `main` function; you declare two variables named `s1` and `s2`, which have the type `struct { int val1, val2; double val3; }` . This `struct { int val1, val2; double val3; }` is really similar to `int` or `char` or `fl...
22,257,784
I am reading a book called C for Java Programmers. It gives an example about nameless structs that I do not undestand. It says that this is valid: ``` struct{ int val1, val2; double val3; } s1,s2; s1.val1 = 5; s2.val3 = 4.6; ``` If structs are similar to objects in Java, why can't I just say val1 = 5 and val...
2014/03/07
[ "https://Stackoverflow.com/questions/22257784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1896016/" ]
Coming from java you can think of a C struct like a class without member functions: ``` //java: class SomeData1 { public int val1; public int val2; public double val3; } ``` So then you'd do: ``` // java: SomeData1 s1= new SomeData1(); s1.val1 = 5; ``` In C you can use a struct like this by naming the...
That is a nice and elegant way of doing so: ``` struct s { int val1, val2; double val3; }; struct s s1 = { .val1 = 1, .val3 = 3.1444 }; ``` `s1.val2` will be set to `0` by the compiler. It is commonly used in [linux kernel source code](http://lxr.free-electrons.com/source/arch/arm/mach-mmp/aspenite.c#L185).
22,257,784
I am reading a book called C for Java Programmers. It gives an example about nameless structs that I do not undestand. It says that this is valid: ``` struct{ int val1, val2; double val3; } s1,s2; s1.val1 = 5; s2.val3 = 4.6; ``` If structs are similar to objects in Java, why can't I just say val1 = 5 and val...
2014/03/07
[ "https://Stackoverflow.com/questions/22257784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1896016/" ]
`struct`s are similar to classes in the sense that you can view the members of a `struct` as public fields of a class. Because this struct has no name you only have the instances at the end of the `struct`'s declaration (`s1` and `s2`) because you'd need the `struct`'s name to make instances in other places. In order ...
By writing: ``` struct { int val1, val2; double val3; } s1, s2; ``` inside, let's say, the `main` function; you declare two variables named `s1` and `s2`, which have the type `struct { int val1, val2; double val3; }` . This `struct { int val1, val2; double val3; }` is really similar to `int` or `char` or `fl...
22,257,784
I am reading a book called C for Java Programmers. It gives an example about nameless structs that I do not undestand. It says that this is valid: ``` struct{ int val1, val2; double val3; } s1,s2; s1.val1 = 5; s2.val3 = 4.6; ``` If structs are similar to objects in Java, why can't I just say val1 = 5 and val...
2014/03/07
[ "https://Stackoverflow.com/questions/22257784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1896016/" ]
`struct`s are similar to classes in the sense that you can view the members of a `struct` as public fields of a class. Because this struct has no name you only have the instances at the end of the `struct`'s declaration (`s1` and `s2`) because you'd need the `struct`'s name to make instances in other places. In order ...
A `struct` in C is like an object in Java. But C has no classes, so there really isn't a need to name the type. I.e., you could say: ``` struct something { int a, b; double c; }; ``` and later say: ``` struct something s1, s2; s1.a = 42; s1.c = 2.14; s2 = s1; ``` In the common case that you only define a f...
22,257,784
I am reading a book called C for Java Programmers. It gives an example about nameless structs that I do not undestand. It says that this is valid: ``` struct{ int val1, val2; double val3; } s1,s2; s1.val1 = 5; s2.val3 = 4.6; ``` If structs are similar to objects in Java, why can't I just say val1 = 5 and val...
2014/03/07
[ "https://Stackoverflow.com/questions/22257784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1896016/" ]
With this code you are creating (or instantiating in OO terms) two distinct nameless struct "objects". It is equivalent to: ``` struct name{ int val1, val2; double val3; } struct name s1; struct name s2; s1.val1 = 5; s2.val3 = 4.6; ``` if you want to give a name to the struct. Alternatively, you can create str...
By writing: ``` struct { int val1, val2; double val3; } s1, s2; ``` inside, let's say, the `main` function; you declare two variables named `s1` and `s2`, which have the type `struct { int val1, val2; double val3; }` . This `struct { int val1, val2; double val3; }` is really similar to `int` or `char` or `fl...
22,257,784
I am reading a book called C for Java Programmers. It gives an example about nameless structs that I do not undestand. It says that this is valid: ``` struct{ int val1, val2; double val3; } s1,s2; s1.val1 = 5; s2.val3 = 4.6; ``` If structs are similar to objects in Java, why can't I just say val1 = 5 and val...
2014/03/07
[ "https://Stackoverflow.com/questions/22257784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1896016/" ]
`struct`s are similar to classes in the sense that you can view the members of a `struct` as public fields of a class. Because this struct has no name you only have the instances at the end of the `struct`'s declaration (`s1` and `s2`) because you'd need the `struct`'s name to make instances in other places. In order ...
Coming from java you can think of a C struct like a class without member functions: ``` //java: class SomeData1 { public int val1; public int val2; public double val3; } ``` So then you'd do: ``` // java: SomeData1 s1= new SomeData1(); s1.val1 = 5; ``` In C you can use a struct like this by naming the...
22,257,784
I am reading a book called C for Java Programmers. It gives an example about nameless structs that I do not undestand. It says that this is valid: ``` struct{ int val1, val2; double val3; } s1,s2; s1.val1 = 5; s2.val3 = 4.6; ``` If structs are similar to objects in Java, why can't I just say val1 = 5 and val...
2014/03/07
[ "https://Stackoverflow.com/questions/22257784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1896016/" ]
To initialise a `struct` variable you need to add an appropriate initialiser: ``` struct { int val1, val2; double val3; } s1 = { 1, 2, 3. }; ```
A `struct` in C is like an object in Java. But C has no classes, so there really isn't a need to name the type. I.e., you could say: ``` struct something { int a, b; double c; }; ``` and later say: ``` struct something s1, s2; s1.a = 42; s1.c = 2.14; s2 = s1; ``` In the common case that you only define a f...
22,257,784
I am reading a book called C for Java Programmers. It gives an example about nameless structs that I do not undestand. It says that this is valid: ``` struct{ int val1, val2; double val3; } s1,s2; s1.val1 = 5; s2.val3 = 4.6; ``` If structs are similar to objects in Java, why can't I just say val1 = 5 and val...
2014/03/07
[ "https://Stackoverflow.com/questions/22257784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1896016/" ]
`struct`s are similar to classes in the sense that you can view the members of a `struct` as public fields of a class. Because this struct has no name you only have the instances at the end of the `struct`'s declaration (`s1` and `s2`) because you'd need the `struct`'s name to make instances in other places. In order ...
To initialise a `struct` variable you need to add an appropriate initialiser: ``` struct { int val1, val2; double val3; } s1 = { 1, 2, 3. }; ```
22,257,784
I am reading a book called C for Java Programmers. It gives an example about nameless structs that I do not undestand. It says that this is valid: ``` struct{ int val1, val2; double val3; } s1,s2; s1.val1 = 5; s2.val3 = 4.6; ``` If structs are similar to objects in Java, why can't I just say val1 = 5 and val...
2014/03/07
[ "https://Stackoverflow.com/questions/22257784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1896016/" ]
Coming from java you can think of a C struct like a class without member functions: ``` //java: class SomeData1 { public int val1; public int val2; public double val3; } ``` So then you'd do: ``` // java: SomeData1 s1= new SomeData1(); s1.val1 = 5; ``` In C you can use a struct like this by naming the...
By writing: ``` struct { int val1, val2; double val3; } s1, s2; ``` inside, let's say, the `main` function; you declare two variables named `s1` and `s2`, which have the type `struct { int val1, val2; double val3; }` . This `struct { int val1, val2; double val3; }` is really similar to `int` or `char` or `fl...
22,257,784
I am reading a book called C for Java Programmers. It gives an example about nameless structs that I do not undestand. It says that this is valid: ``` struct{ int val1, val2; double val3; } s1,s2; s1.val1 = 5; s2.val3 = 4.6; ``` If structs are similar to objects in Java, why can't I just say val1 = 5 and val...
2014/03/07
[ "https://Stackoverflow.com/questions/22257784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1896016/" ]
To initialise a `struct` variable you need to add an appropriate initialiser: ``` struct { int val1, val2; double val3; } s1 = { 1, 2, 3. }; ```
That is a nice and elegant way of doing so: ``` struct s { int val1, val2; double val3; }; struct s s1 = { .val1 = 1, .val3 = 3.1444 }; ``` `s1.val2` will be set to `0` by the compiler. It is commonly used in [linux kernel source code](http://lxr.free-electrons.com/source/arch/arm/mach-mmp/aspenite.c#L185).
8,395,232
*This is the same question as [on SuperUser](https://superuser.com/questions/364645/opening-a-file-from-netrw-in-a-specified-split), but I feel it has a better chance of being answered here, so ...* In Vim, I have four splits - two by two - and in the upper left one netrw is open. Is there a way to open a file from ne...
2011/12/06
[ "https://Stackoverflow.com/questions/8395232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62699/" ]
there're some hints here <https://superuser.com/questions/377501/keep-cursor-in-netrw-window-when-browsing-files-in-vim> Put this in your .vimrc, ``` let g:netrw_preview = 1 ``` to configure vertical preview splits, then when the cursor is over the desired file, type `p` to open a preview window. To close the windo...
You can set the `g:netrw_chgwin` variable to make netrw open the files in a specific window. See: ``` :h netrw-C ``` So to make the current window the target of netrw type this while you're in that window: ``` :let g:netrw_chgwin = winnr() ``` Another way is to launch netrw in the target window (`:E`), hit `C` to...
8,395,232
*This is the same question as [on SuperUser](https://superuser.com/questions/364645/opening-a-file-from-netrw-in-a-specified-split), but I feel it has a better chance of being answered here, so ...* In Vim, I have four splits - two by two - and in the upper left one netrw is open. Is there a way to open a file from ne...
2011/12/06
[ "https://Stackoverflow.com/questions/8395232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62699/" ]
there're some hints here <https://superuser.com/questions/377501/keep-cursor-in-netrw-window-when-browsing-files-in-vim> Put this in your .vimrc, ``` let g:netrw_preview = 1 ``` to configure vertical preview splits, then when the cursor is over the desired file, type `p` to open a preview window. To close the windo...
To bring above answers together some inspirations: I use the following window configuration together with netrw (together with :let g:netrw\_liststyle = 2): ``` -------------------------------- ... Netrw-split: topleft spilt -------------------------------- ... | | | wor...
6,518,189
I have a complex Model containing an array. For rendering items for this array I'm using EditorFor like this: ``` for (int i = 0; i < Model.Contacts.Phones.Length; i++) { @Html.EditorFor(x => x.Contacts.Phones[i]) } ``` Inside editor there is a post-form. Problem is, that binding is successful only when I...
2011/06/29
[ "https://Stackoverflow.com/questions/6518189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/544866/" ]
Yes it acceptable and will work just file ***if compile-time polymorphism is enough for you*** - you will save on virtual calls and that will allow for better compiler coptimizations.
As it stands above, it is needlessly confusing. Just create three classes with different names.
23,155,298
How can i create a custom filter to replace: ``` <a href="http://www.externalsite.com">Whatever text</a> ``` into this: ``` <a href="#" ng-click="openExternal('http://www.externalsite.com')">Whatever text</a> ``` it should be easy, but i'm unable to do it… I have this: ``` <div ng-bind-html="item.htmltext | myFi...
2014/04/18
[ "https://Stackoverflow.com/questions/23155298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572038/" ]
**UPDATE**: Use Ruby 2.1.2, it fixes this issue. --- 14.04 is probably shipping with readline 6.3, which uses `rl_hook_func_t` instead of `Function`. This bug has already been reported and fixed in Ruby (<https://bugs.ruby-lang.org/issues/9578>), but not released yet. Until Ruby 2.1.2 comes out (which I assume will...
**UPDATE**: Ruby 2.1.2, fixes this issue. If you need to patch ruby with Chef for another reason follow the example here. --- Chef installation of Ruby 2.1.1 on to Ubuntu 14.04 using [LWRP](http://docs.opscode.com/lwrp.html) ---------------------------------------------------------------------------------------------...
8,639,065
Is there a way to override the ToString() method on the Shape class, without inheriting from it and doing it in the the inherited class? So whenever I call any of the shapes' to string method I get the overriden one? Note I don't want to this: Shpae1: Shape override .... The reason why I wan't to do this, is I have a...
2011/12/26
[ "https://Stackoverflow.com/questions/8639065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/906042/" ]
I don't think that this is possible (also there might be some dirty reflection tricks involving dynamic code generation etc.) The main ways to extend an existing class like `Shape` are: 1. **Inherit**. This is not possible because you use `Rectangle`, `Ellipse` etc. which are sealed. 2. **Partial class**. Does not wo...
No; you can't do that. Instead, you should probably use a DataTemplate.
8,639,065
Is there a way to override the ToString() method on the Shape class, without inheriting from it and doing it in the the inherited class? So whenever I call any of the shapes' to string method I get the overriden one? Note I don't want to this: Shpae1: Shape override .... The reason why I wan't to do this, is I have a...
2011/12/26
[ "https://Stackoverflow.com/questions/8639065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/906042/" ]
I don't think that this is possible (also there might be some dirty reflection tricks involving dynamic code generation etc.) The main ways to extend an existing class like `Shape` are: 1. **Inherit**. This is not possible because you use `Rectangle`, `Ellipse` etc. which are sealed. 2. **Partial class**. Does not wo...
You can always use Shape as internal field of your class and in your ToString() method call \_shape.ToString().
17,632,911
I'm working on improving my math and programming skills, and my programming skills are sort of in between baby and toddler stage. I've been trying to get the gcd function from the Python fractions module to work for me, and it will work on small integers but not on large ones. for example, if I run ``` from fractions ...
2013/07/13
[ "https://Stackoverflow.com/questions/17632911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2579517/" ]
According to your Python code, my Python code, WebMath.com, and MathPortal.org the GCD of 37512 and 84293 is in fact 1. This link: <http://www.mathportal.org/calculators/numbers-calculators/gcd-lcm-calculator.php> gives a good explanation of why the GCD is what it is after inputting the numbers.
As @Chandrew said the answer is 1. You can check it with any reasonable math software (here Sage based on Python): ``` sage: xgcd(37512,84293) (1, 5220, -2323) sage: 5220 * 37512 - 2323 * 84293 1 ```
11,379,718
Hadoop Definitive Guide says: ``` When you have Minimum split size 1, Maximum split size Long.MAX_VALUE, Block size 64MB then the Split size is 64MB. ``` TextInputFormat's logical records are lines. As the each line length is different how can we have split of size exactly 64MB?
2012/07/08
[ "https://Stackoverflow.com/questions/11379718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/750177/" ]
HDFS blocks are sequences of bytes. They are not aware of lines or any other structure. So you might have a split made of only one block (of course of size 64MB) ending in the middle of a line (i.e. not including the whole last line). When you read it with TextInputFormat, it will take care to read some bytes form the...
Always follow the 2 rules: 1. Determine if your in the middle of a record 2. can over that record and read the next full record The first half of the record goes as the last record of previous InputSplit
2,858,344
I'm not a huge fan of the JavaScript frameworks that are out there today. I think a lot of the libraries could be written better, are chosen for a project because of favoritism rather than understanding the requirements of the problem at hand, and some JavaScript developers come to depend on them too much to the point ...
2010/05/18
[ "https://Stackoverflow.com/questions/2858344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322819/" ]
Well - I used to be of the same view, never really used JS libs as - well, I can do it myself. But in my job I was forced to use Jquery. Previously to that I would use Prototype and script.aculo.us and liked it because of its minimal injection into your daily workflow. But saying the libs are evil isn't really someth...
[MyLibrary](http://www.cinsoft.net/mylib.html)
2,858,344
I'm not a huge fan of the JavaScript frameworks that are out there today. I think a lot of the libraries could be written better, are chosen for a project because of favoritism rather than understanding the requirements of the problem at hand, and some JavaScript developers come to depend on them too much to the point ...
2010/05/18
[ "https://Stackoverflow.com/questions/2858344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322819/" ]
Lol. That surely is subjective, but anyways... Personally I think [YUI](http://developer.yahoo.com/yui/) is the least *evil* as it has [Douglas Crockford](http://crockfordfacts.com/) himself advocating it. ('nuf said) Although, I don't really think that other frameworks are necessarily evil... [jQuery](http://jquer...
[MyLibrary](http://www.cinsoft.net/mylib.html)
2,858,344
I'm not a huge fan of the JavaScript frameworks that are out there today. I think a lot of the libraries could be written better, are chosen for a project because of favoritism rather than understanding the requirements of the problem at hand, and some JavaScript developers come to depend on them too much to the point ...
2010/05/18
[ "https://Stackoverflow.com/questions/2858344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322819/" ]
Well - I used to be of the same view, never really used JS libs as - well, I can do it myself. But in my job I was forced to use Jquery. Previously to that I would use Prototype and script.aculo.us and liked it because of its minimal injection into your daily workflow. But saying the libs are evil isn't really someth...
My vote is for jquery. With noConflict() you can use multiple versions on the same page, easy learning curve with css selectors.
2,858,344
I'm not a huge fan of the JavaScript frameworks that are out there today. I think a lot of the libraries could be written better, are chosen for a project because of favoritism rather than understanding the requirements of the problem at hand, and some JavaScript developers come to depend on them too much to the point ...
2010/05/18
[ "https://Stackoverflow.com/questions/2858344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322819/" ]
Lol. That surely is subjective, but anyways... Personally I think [YUI](http://developer.yahoo.com/yui/) is the least *evil* as it has [Douglas Crockford](http://crockfordfacts.com/) himself advocating it. ('nuf said) Although, I don't really think that other frameworks are necessarily evil... [jQuery](http://jquer...
My vote is for jquery. With noConflict() you can use multiple versions on the same page, easy learning curve with css selectors.
2,858,344
I'm not a huge fan of the JavaScript frameworks that are out there today. I think a lot of the libraries could be written better, are chosen for a project because of favoritism rather than understanding the requirements of the problem at hand, and some JavaScript developers come to depend on them too much to the point ...
2010/05/18
[ "https://Stackoverflow.com/questions/2858344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322819/" ]
Well - I used to be of the same view, never really used JS libs as - well, I can do it myself. But in my job I was forced to use Jquery. Previously to that I would use Prototype and script.aculo.us and liked it because of its minimal injection into your daily workflow. But saying the libs are evil isn't really someth...
Lol. That surely is subjective, but anyways... Personally I think [YUI](http://developer.yahoo.com/yui/) is the least *evil* as it has [Douglas Crockford](http://crockfordfacts.com/) himself advocating it. ('nuf said) Although, I don't really think that other frameworks are necessarily evil... [jQuery](http://jquer...
1,327,694
Is There a quicker way between Ubuntu and my android to send files instead of Bluetooth or usb cable? Am I aware of quick share that uses wifi. can this be done? I'm using a Samsung galaxy note 10. I'm not sure if this has been asked before.
2021/03/28
[ "https://askubuntu.com/questions/1327694", "https://askubuntu.com", "https://askubuntu.com/users/76787/" ]
I use [SSH/SFTP Server - Terminal](https://play.google.com/store/apps/details?id=net.xnano.android.sshserver&hl=en_CA&gl=US) from Banana Studio. It has advantages: * No USB cables which can be a pain to find at times. * No teethering your phone to your comptuer or USB hub. * No bluetooth which many seem to have probl...
Try [KDE Connect](https://kdeconnect.kde.org/) it's installable from Ubuntu software store or command-line apt (and of course the KDE Connect app from Android store). I just use it for ocassional file transfers but it has loads of other features if you want/need them.
1,327,694
Is There a quicker way between Ubuntu and my android to send files instead of Bluetooth or usb cable? Am I aware of quick share that uses wifi. can this be done? I'm using a Samsung galaxy note 10. I'm not sure if this has been asked before.
2021/03/28
[ "https://askubuntu.com/questions/1327694", "https://askubuntu.com", "https://askubuntu.com/users/76787/" ]
Install `kdeconnect` on your phone... <https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp> Install `gsconnect` on your computer... <https://extensions.gnome.org/extension/1319/gsconnect/> Pair them. Enjoy.
Try [KDE Connect](https://kdeconnect.kde.org/) it's installable from Ubuntu software store or command-line apt (and of course the KDE Connect app from Android store). I just use it for ocassional file transfers but it has loads of other features if you want/need them.
1,327,694
Is There a quicker way between Ubuntu and my android to send files instead of Bluetooth or usb cable? Am I aware of quick share that uses wifi. can this be done? I'm using a Samsung galaxy note 10. I'm not sure if this has been asked before.
2021/03/28
[ "https://askubuntu.com/questions/1327694", "https://askubuntu.com", "https://askubuntu.com/users/76787/" ]
Use Total Commander with WLAN-Plugin on the phone. Total Commander can share files via Wifi that you download via Browser or connect via sftp I assume both devices are in the same WLAN.
Try [KDE Connect](https://kdeconnect.kde.org/) it's installable from Ubuntu software store or command-line apt (and of course the KDE Connect app from Android store). I just use it for ocassional file transfers but it has loads of other features if you want/need them.
1,327,694
Is There a quicker way between Ubuntu and my android to send files instead of Bluetooth or usb cable? Am I aware of quick share that uses wifi. can this be done? I'm using a Samsung galaxy note 10. I'm not sure if this has been asked before.
2021/03/28
[ "https://askubuntu.com/questions/1327694", "https://askubuntu.com", "https://askubuntu.com/users/76787/" ]
I use [SSH/SFTP Server - Terminal](https://play.google.com/store/apps/details?id=net.xnano.android.sshserver&hl=en_CA&gl=US) from Banana Studio. It has advantages: * No USB cables which can be a pain to find at times. * No teethering your phone to your comptuer or USB hub. * No bluetooth which many seem to have probl...
Through cable, you can use the Android File Transfer for Linux, available from snap store: ``` sudo snap install android-file-transfer-linux ``` [Android File Transfer for Linux - MTP](https://snapcraft.io/install/android-file-transfer-linux/ubuntu)
1,327,694
Is There a quicker way between Ubuntu and my android to send files instead of Bluetooth or usb cable? Am I aware of quick share that uses wifi. can this be done? I'm using a Samsung galaxy note 10. I'm not sure if this has been asked before.
2021/03/28
[ "https://askubuntu.com/questions/1327694", "https://askubuntu.com", "https://askubuntu.com/users/76787/" ]
Install `kdeconnect` on your phone... <https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp> Install `gsconnect` on your computer... <https://extensions.gnome.org/extension/1319/gsconnect/> Pair them. Enjoy.
Through cable, you can use the Android File Transfer for Linux, available from snap store: ``` sudo snap install android-file-transfer-linux ``` [Android File Transfer for Linux - MTP](https://snapcraft.io/install/android-file-transfer-linux/ubuntu)
1,327,694
Is There a quicker way between Ubuntu and my android to send files instead of Bluetooth or usb cable? Am I aware of quick share that uses wifi. can this be done? I'm using a Samsung galaxy note 10. I'm not sure if this has been asked before.
2021/03/28
[ "https://askubuntu.com/questions/1327694", "https://askubuntu.com", "https://askubuntu.com/users/76787/" ]
Use Total Commander with WLAN-Plugin on the phone. Total Commander can share files via Wifi that you download via Browser or connect via sftp I assume both devices are in the same WLAN.
Through cable, you can use the Android File Transfer for Linux, available from snap store: ``` sudo snap install android-file-transfer-linux ``` [Android File Transfer for Linux - MTP](https://snapcraft.io/install/android-file-transfer-linux/ubuntu)
1,327,694
Is There a quicker way between Ubuntu and my android to send files instead of Bluetooth or usb cable? Am I aware of quick share that uses wifi. can this be done? I'm using a Samsung galaxy note 10. I'm not sure if this has been asked before.
2021/03/28
[ "https://askubuntu.com/questions/1327694", "https://askubuntu.com", "https://askubuntu.com/users/76787/" ]
I use [SSH/SFTP Server - Terminal](https://play.google.com/store/apps/details?id=net.xnano.android.sshserver&hl=en_CA&gl=US) from Banana Studio. It has advantages: * No USB cables which can be a pain to find at times. * No teethering your phone to your comptuer or USB hub. * No bluetooth which many seem to have probl...
Use Total Commander with WLAN-Plugin on the phone. Total Commander can share files via Wifi that you download via Browser or connect via sftp I assume both devices are in the same WLAN.
1,327,694
Is There a quicker way between Ubuntu and my android to send files instead of Bluetooth or usb cable? Am I aware of quick share that uses wifi. can this be done? I'm using a Samsung galaxy note 10. I'm not sure if this has been asked before.
2021/03/28
[ "https://askubuntu.com/questions/1327694", "https://askubuntu.com", "https://askubuntu.com/users/76787/" ]
Install `kdeconnect` on your phone... <https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp> Install `gsconnect` on your computer... <https://extensions.gnome.org/extension/1319/gsconnect/> Pair them. Enjoy.
Use Total Commander with WLAN-Plugin on the phone. Total Commander can share files via Wifi that you download via Browser or connect via sftp I assume both devices are in the same WLAN.
2,362,577
Lets say i have 50 element grid. If its wide list it is easy for readers if i color odd and even div differently. Now lets say i want to do this and color code every 5th div. Is there a way to choose which css to apply based on a number? like instead of ``` <div class="odd">blah</div> <div class="even">blah</div> <div...
2010/03/02
[ "https://Stackoverflow.com/questions/2362577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Yes, with [nth-child](http://css-tricks.com/how-nth-child-works/). Note that nth-child doesn't work in IE, but it is a valid jQuery selector, so you can either use this with modern browsers and pure CSS, or with all browsers and a bit of presentational JavaScript.
CSS has no way of selecting based on a class name that changes like that. There are various [nth-selectors proposed for CSS 3](http://www.w3.org/TR/css3-selectors/#nth-child-pseudo), but browser support is currently weak.
2,362,577
Lets say i have 50 element grid. If its wide list it is easy for readers if i color odd and even div differently. Now lets say i want to do this and color code every 5th div. Is there a way to choose which css to apply based on a number? like instead of ``` <div class="odd">blah</div> <div class="even">blah</div> <div...
2010/03/02
[ "https://Stackoverflow.com/questions/2362577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can use jQuery to select all even or odd nodes, and then apply a css class to them. <http://api.jquery.com/nth-child-selector/> ``` $('#parentDiv:nth-child(even)').addClass('evenDivs'); $('#parentDiv:nth-child(odd)').addClass('oddDivs'); ```
CSS has no way of selecting based on a class name that changes like that. There are various [nth-selectors proposed for CSS 3](http://www.w3.org/TR/css3-selectors/#nth-child-pseudo), but browser support is currently weak.
2,362,577
Lets say i have 50 element grid. If its wide list it is easy for readers if i color odd and even div differently. Now lets say i want to do this and color code every 5th div. Is there a way to choose which css to apply based on a number? like instead of ``` <div class="odd">blah</div> <div class="even">blah</div> <div...
2010/03/02
[ "https://Stackoverflow.com/questions/2362577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Yes, with [nth-child](http://css-tricks.com/how-nth-child-works/). Note that nth-child doesn't work in IE, but it is a valid jQuery selector, so you can either use this with modern browsers and pure CSS, or with all browsers and a bit of presentational JavaScript.
Assuming you can actually use numbers as css classnames, the css could look like ``` div.1, div.3, div.5, div.7 { // Odd Style here } div.2, div.4, div.6, div.8 { // Even Style here } ``` Not that pretty, but flexible enough to do what you ask.
2,362,577
Lets say i have 50 element grid. If its wide list it is easy for readers if i color odd and even div differently. Now lets say i want to do this and color code every 5th div. Is there a way to choose which css to apply based on a number? like instead of ``` <div class="odd">blah</div> <div class="even">blah</div> <div...
2010/03/02
[ "https://Stackoverflow.com/questions/2362577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Yes, with [nth-child](http://css-tricks.com/how-nth-child-works/). Note that nth-child doesn't work in IE, but it is a valid jQuery selector, so you can either use this with modern browsers and pure CSS, or with all browsers and a bit of presentational JavaScript.
You can use jQuery to select all even or odd nodes, and then apply a css class to them. <http://api.jquery.com/nth-child-selector/> ``` $('#parentDiv:nth-child(even)').addClass('evenDivs'); $('#parentDiv:nth-child(odd)').addClass('oddDivs'); ```
2,362,577
Lets say i have 50 element grid. If its wide list it is easy for readers if i color odd and even div differently. Now lets say i want to do this and color code every 5th div. Is there a way to choose which css to apply based on a number? like instead of ``` <div class="odd">blah</div> <div class="even">blah</div> <div...
2010/03/02
[ "https://Stackoverflow.com/questions/2362577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can use jQuery to select all even or odd nodes, and then apply a css class to them. <http://api.jquery.com/nth-child-selector/> ``` $('#parentDiv:nth-child(even)').addClass('evenDivs'); $('#parentDiv:nth-child(odd)').addClass('oddDivs'); ```
Assuming you can actually use numbers as css classnames, the css could look like ``` div.1, div.3, div.5, div.7 { // Odd Style here } div.2, div.4, div.6, div.8 { // Even Style here } ``` Not that pretty, but flexible enough to do what you ask.
47,950,710
See the two different implementations that return `Enumeration<?>` ``` Vector<String> v = new Vector<>(map.keySet()); return v.elements(); ``` --- ``` List<String> v = new ArrayList<>(map.keySet()); return Collections.enumeration(v); ``` **Please note that the return type here `Enumeration<?>`, cannot be changed....
2017/12/23
[ "https://Stackoverflow.com/questions/47950710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3647002/" ]
Neither. You don't need either of these. `Collections.enumeration()` takes a `Collection` argument, and `Set` is a `Collection`, and `Map.keySet()` returns a `Set`. You just need: ``` return Collections.enumeration(map.keySet()); ```
The use of these obsolete -though not deprecated- classes is often a business decision. There's not much you can do about it, except, if possible, use a different API. I wouldn't use `Vector`. If you don't need the synchronisation in your own code, use the Collections Framework. If you do need the synchronisation, use...
47,950,710
See the two different implementations that return `Enumeration<?>` ``` Vector<String> v = new Vector<>(map.keySet()); return v.elements(); ``` --- ``` List<String> v = new ArrayList<>(map.keySet()); return Collections.enumeration(v); ``` **Please note that the return type here `Enumeration<?>`, cannot be changed....
2017/12/23
[ "https://Stackoverflow.com/questions/47950710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3647002/" ]
Neither. You don't need either of these. `Collections.enumeration()` takes a `Collection` argument, and `Set` is a `Collection`, and `Map.keySet()` returns a `Set`. You just need: ``` return Collections.enumeration(map.keySet()); ```
well depending on on your use case, use ArrayList if you don't care about thread safety so you don't get the additional overhead of synchronized methods of Vector, otherwise use Vector .