qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
23,592,131 | I could not find the main difference. And I am very confused when we could use inheritance and when we can use subtyping. I found some definitions but they are not very clear.
What is the difference between subtyping and inheritance in object-oriented programming? | 2014/05/11 | [
"https://Stackoverflow.com/questions/23592131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3337256/"
] | A relative unfortunately died and left you his bookstore.
You can now read all the books there, sell them, you can look at his accounts, his customer list, etc. This is **inheritance** - you have everything the relative had. Inheritance is a form of code reuse.
You can also re-open the book store yourself, taking on ... | **in a simple word**: subtyping and inheritance both are polymorphism, (inheritance is a dynamic polymorphism - overriding). Actually, inheritance is subclassing, it means in inheritance there is no warranty to ensure capability of the subclass with the superclass (make sure subclass do not discard superclass behavior)... |
23,592,131 | I could not find the main difference. And I am very confused when we could use inheritance and when we can use subtyping. I found some definitions but they are not very clear.
What is the difference between subtyping and inheritance in object-oriented programming? | 2014/05/11 | [
"https://Stackoverflow.com/questions/23592131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3337256/"
] | A relative unfortunately died and left you his bookstore.
You can now read all the books there, sell them, you can look at his accounts, his customer list, etc. This is **inheritance** - you have everything the relative had. Inheritance is a form of code reuse.
You can also re-open the book store yourself, taking on ... | If you inherit privately in C++, you get inheritance without subtyping. That is, given:
```cpp
class Derived : Base // note the missing public before Base
```
You cannot write:
```cpp
Base * p = new Derived(); // type error
```
Because `Derived` is not a subtype of `Base`. You merely inherited the implem... |
23,592,131 | I could not find the main difference. And I am very confused when we could use inheritance and when we can use subtyping. I found some definitions but they are not very clear.
What is the difference between subtyping and inheritance in object-oriented programming? | 2014/05/11 | [
"https://Stackoverflow.com/questions/23592131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3337256/"
] | A relative unfortunately died and left you his bookstore.
You can now read all the books there, sell them, you can look at his accounts, his customer list, etc. This is **inheritance** - you have everything the relative had. Inheritance is a form of code reuse.
You can also re-open the book store yourself, taking on ... | Inheritance is about gaining attributes (and/or functionality) of super types. For example:
```
class Base {
//interface with included definitions
}
class Derived inherits Base {
//Add some additional functionality.
//Reuse Base without having to explicitly forward
//the functions in Base
}
```
Her... |
23,592,131 | I could not find the main difference. And I am very confused when we could use inheritance and when we can use subtyping. I found some definitions but they are not very clear.
What is the difference between subtyping and inheritance in object-oriented programming? | 2014/05/11 | [
"https://Stackoverflow.com/questions/23592131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3337256/"
] | If you inherit privately in C++, you get inheritance without subtyping. That is, given:
```cpp
class Derived : Base // note the missing public before Base
```
You cannot write:
```cpp
Base * p = new Derived(); // type error
```
Because `Derived` is not a subtype of `Base`. You merely inherited the implem... | **in a simple word**: subtyping and inheritance both are polymorphism, (inheritance is a dynamic polymorphism - overriding). Actually, inheritance is subclassing, it means in inheritance there is no warranty to ensure capability of the subclass with the superclass (make sure subclass do not discard superclass behavior)... |
23,592,131 | I could not find the main difference. And I am very confused when we could use inheritance and when we can use subtyping. I found some definitions but they are not very clear.
What is the difference between subtyping and inheritance in object-oriented programming? | 2014/05/11 | [
"https://Stackoverflow.com/questions/23592131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3337256/"
] | Inheritance is about gaining attributes (and/or functionality) of super types. For example:
```
class Base {
//interface with included definitions
}
class Derived inherits Base {
//Add some additional functionality.
//Reuse Base without having to explicitly forward
//the functions in Base
}
```
Her... | **in a simple word**: subtyping and inheritance both are polymorphism, (inheritance is a dynamic polymorphism - overriding). Actually, inheritance is subclassing, it means in inheritance there is no warranty to ensure capability of the subclass with the superclass (make sure subclass do not discard superclass behavior)... |
23,592,131 | I could not find the main difference. And I am very confused when we could use inheritance and when we can use subtyping. I found some definitions but they are not very clear.
What is the difference between subtyping and inheritance in object-oriented programming? | 2014/05/11 | [
"https://Stackoverflow.com/questions/23592131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3337256/"
] | A relative unfortunately died and left you his bookstore.
You can now read all the books there, sell them, you can look at his accounts, his customer list, etc. This is **inheritance** - you have everything the relative had. Inheritance is a form of code reuse.
You can also re-open the book store yourself, taking on ... | Subtyping doesn't have to be implemented via inheritance. Some subtyping that is not inheritance:
1. [Ocaml's variant](https://realworldocaml.org/v1/en/html/variants.html)
2. [Rust's lifetime anotation](https://doc.rust-lang.org/1.17.0/book/lifetimes.html)
3. [Clean's uniqueness types](http://www.eafit.edu.co/investig... |
23,592,131 | I could not find the main difference. And I am very confused when we could use inheritance and when we can use subtyping. I found some definitions but they are not very clear.
What is the difference between subtyping and inheritance in object-oriented programming? | 2014/05/11 | [
"https://Stackoverflow.com/questions/23592131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3337256/"
] | In addition to the answers already given, here's a [link](http://www.cmi.ac.in/%7Emadhavan/courses/pl2006/lecturenotes/lecture-notes/node28.html) to an article I think is relevant.
Excerpts:
>
> In the object-oriented framework, inheritance is usually presented as a feature that goes hand in hand with subtyping when ... | Subtyping doesn't have to be implemented via inheritance. Some subtyping that is not inheritance:
1. [Ocaml's variant](https://realworldocaml.org/v1/en/html/variants.html)
2. [Rust's lifetime anotation](https://doc.rust-lang.org/1.17.0/book/lifetimes.html)
3. [Clean's uniqueness types](http://www.eafit.edu.co/investig... |
23,592,131 | I could not find the main difference. And I am very confused when we could use inheritance and when we can use subtyping. I found some definitions but they are not very clear.
What is the difference between subtyping and inheritance in object-oriented programming? | 2014/05/11 | [
"https://Stackoverflow.com/questions/23592131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3337256/"
] | Inheritance is about gaining attributes (and/or functionality) of super types. For example:
```
class Base {
//interface with included definitions
}
class Derived inherits Base {
//Add some additional functionality.
//Reuse Base without having to explicitly forward
//the functions in Base
}
```
Her... | Subtyping doesn't have to be implemented via inheritance. Some subtyping that is not inheritance:
1. [Ocaml's variant](https://realworldocaml.org/v1/en/html/variants.html)
2. [Rust's lifetime anotation](https://doc.rust-lang.org/1.17.0/book/lifetimes.html)
3. [Clean's uniqueness types](http://www.eafit.edu.co/investig... |
53,117,912 | ```
import java.util.Scanner;
import java.lang.*;
public class testing {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
char[] engArray = {'A','B','C','D','E','F','G','H','I'};
String stringEngArray = String.valueOf(engArray);
System.out.println("T... | 2018/11/02 | [
"https://Stackoverflow.com/questions/53117912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3613824/"
] | If the dates are entered as `'01/2015'` and `'08/2017'` for example, and **if all the data for August 2017 must be INCLUDED in the report**, then the `where` clause should include
```
...
and (COJ.DATE_ENTERED >= TO_DATE('&DATE_FROM', 'MM/YYYY') OR '&DATE_FROM' IS NULL)
and (COJ.DATE_ENTERED < ADD_MONTHS(TO_DATE('&DA... | I don't see your problem. If you want to add a month to a date, you can use `add_months(date, months)`:
<https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions004.htm#SQLRF00603>
```
begin
dbms_output.put_line('Sysdate: ' || sysdate);
dbms_output.put_line('Sysdate: ' || trunc(sysdate, 'mm'));
db... |
19,844,395 | I've added this code below to my default.php file in joomla 3.1.
```
<?php
JHtml::_('jquery.framework');
JFactory::getDocument()->addScript(JURI::root().'template/mytemplate/js/jquery.min.js');
?>
```
This only embeds the script inside the head tags.
Is there a way i can make it appear in the body tag? | 2013/11/07 | [
"https://Stackoverflow.com/questions/19844395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2945482/"
] | Change you regex to:
```
r'<\/div> <img src="[.]{3}" title"(.*)">$'
```
1. `.` has a special meaning in regex, so you should use a character class or escape it using `\`.
2. No need to enclose regex between `/ /` in Python.
3. `*.` should be `.*`.
4. `re.match` matches only at the start of the string, so better use ... | This is how it should be:
```
>>> import re
>>> string = 'stuff ... </div> <img src="..." title"SOME_TEXT_THAT_CHANGES">'
>>> pattern = r'</div> <img src="..." title"(.*)">$'
>>> prog = re.compile(pattern)
>>> result = prog.search(string)
>>> result
<_sre.SRE_Match object at 0x0188A3A0>
>>> print result.group(1)
SOME_... |
649,623 | I made an alias `alias goto="cd $@ && source ~/.zshrc"` and it works, but only if I execute it twice. Even after I execute it twice in one shell, and if I want to move to another dir, I must again execute it twice. Why is that and how can I change that?
I need to type two times `goto <dir>`. The first time, I am still... | 2021/05/14 | [
"https://unix.stackexchange.com/questions/649623",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/471152/"
] | First of all, aliases are not functions and do not accept arguments. Rather, aliases are simple substitutions: When you type `goto foo` on the command line and press Enter, the shell simply replaces `goto` with the value of the alias, before executing the command line.
Therefore, `$@` does not expand to the arguments ... | Marlon's answer works. Instead of making an alias, I did following function:
```
function goto {
cd $@ && exec $SHELL
}
```
And it works perfectly. I also remarked, that sourcing ~/.zshrc takes longer and longer after every call of `goto`. |
12,498,654 | I have a project with PhoneGap and jQueryMobile, using a multi-page template. On the home page the `pageshow`, `pageinit`, `pagecreate`, `pagebeforeshow` events don't fire. I have tried a couple of possible solutions.
Solution 1:
```
$('#home').on("pageshow", function(e) { ... }
```
With this solution, when I chang... | 2012/09/19 | [
"https://Stackoverflow.com/questions/12498654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1683547/"
] | Finally I found the solution to this, is create another page first and this redirect to home page with $.mobile.changePage('#home',{transition:'none'}), this page make all the init functions.
With this the home page fire all the events. | `pagebeforeshow`, `pageshow`, and other collections are empty when the first page is transitioned in during the application startup.
>
> Note that this collection is empty when the first page is transitioned
> in during application startup.
>
>
>
Read up on the docs: <http://jquerymobile.com/test/docs/api/events... |
49,435,865 | I have two different dataframes populated with different name sets. For example:
```
t1 = pd.DataFrame(['Abe, John Doe', 'Smith, Brian', 'Lin, Sam', 'Lin, Greg'], columns=['t1'])
t2 = pd.DataFrame(['Abe, John', 'Smith, Brian', 'Lin, Sam', 'Lu, John'], columns=['t2'])
```
I need to find the intersection between the t... | 2018/03/22 | [
"https://Stackoverflow.com/questions/49435865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6701024/"
] | Consider inverse the logic and just filter what you want to delete?
```
Sub test()
Dim rng As Range
Set rng = wkb.Sheets("temp").Range("$A$1:$AC$72565")
rng.AutoFilter Field:=1, Criteria1:=Array("1", "3", "5", "7", "9"), Operator:=xlFilterValues
' In case your data has header used Offset(1,0) to preserve the header... | Try this (all necessary comments in code):
```
Sub filter()
'declaration of variables
Dim numbers(5) As Long, cell As Range, number As Variant
'fill this array accordingly to your needs (notee that you'd have to change array size in declaration
numbers(0) = 1
numbers(1) = 3
numbers(2) = 5
numbers(3) = 7
numbers(4) = 9... |
40,926,343 | I'have already got a table name 'members' which contains fields like -
memberID,
password (md5 hashed),
resetToken,
etc.
I want to login using memberID and password. I tried `Auth::attempt($credentials)` and `Auth::login($user)` but could not make it work. | 2016/12/02 | [
"https://Stackoverflow.com/questions/40926343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4292290/"
] | You need to change in auth.php file
```
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
```
In this code you need change User model to your specified model... | There is a reference to the model `User` in `config/auth.php` file so you can change it as follows:
```
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
```
As for me what I do is, I maintain the model name as `User` but inside the model I define my table name.... |
66,706,422 | Created Flutter application built on both an Android and iOS device. Application is working fine with android and when i build my ios build it ends up with error as shown below.
Error while executing ios build in android studio using mac device.
i try plenty of method to solve this.
```
**FOLLOWED SETS:**
```
* Flut... | 2021/03/19 | [
"https://Stackoverflow.com/questions/66706422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1808468/"
] | Change the target version to above 10.0.
Change in the Project Runner (in Xcode), PodFile & Target Runner (in Xcode), then run Pod Install | Make sure you open the `.xcworkspace` file instead of the `.xcodeproj`. This helped me to solve the issue. |
166,455 | I want to find patterns in the way that two models, Model A and Model B, perform on my dataset. What are some good ways to compare the individual predictions of the two models for $N$ classes? If any particular method is used for $N=2$, then that's interesting as well. I'm not interested in comparing the general accura... | 2015/08/10 | [
"https://stats.stackexchange.com/questions/166455",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/29025/"
] | For classification, the standard is the receiver operating characteristic (ROC) and/or precision vs recall plots.
[](https://i.stack.imgur.com/28deJ.png)
If you're after a graphical comparison, then you can plot the... | This paper looks into improving prediction if more than one model is available: <http://arxiv.org/pdf/1106.0219.pdf>
This is done by finding patterns between models. Might be useful.
Main idea is to look intersections of different models. Where they agree, disagree and iterate over all four possible ways it is possib... |
157,017 | I think my settlement is somewhat stable now. I have a mine and quarry, so reliable sources of iron/coal/stone. The food supply seems pretty robust, I have three gatherer/forester stations along with two crop fields and everything seems to be chugging along fine. Should I expand some more (build more houses, farms, pas... | 2014/02/20 | [
"https://gaming.stackexchange.com/questions/157017",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/27975/"
] | Building a school and training students to completion causes the age of maturity in your town to move from 10 (months) to around 20. That means that for 2.5 years you will have people die of old age/other causes and not be replaced. If you can afford that, based on your stockpiles and productivity, it is advantageous t... | There's almost no time too soon to build a school. Educated people are more efficient and also have less workplace related accidents. That's a force multiplier that's hard to pass up. As soon as your people aren't going to freeze or starve, put up the school. |
157,017 | I think my settlement is somewhat stable now. I have a mine and quarry, so reliable sources of iron/coal/stone. The food supply seems pretty robust, I have three gatherer/forester stations along with two crop fields and everything seems to be chugging along fine. Should I expand some more (build more houses, farms, pas... | 2014/02/20 | [
"https://gaming.stackexchange.com/questions/157017",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/27975/"
] | A few facts to consider:
* Students graduate at age 16 if they live next to the school. If they have to walk (back and forth) to the school, that walking time does not count toward education progress. This is why players are reporting 20 year old students.
* Education gives the worker a ~50% productivity increase. How... | Building a school and training students to completion causes the age of maturity in your town to move from 10 (months) to around 20. That means that for 2.5 years you will have people die of old age/other causes and not be replaced. If you can afford that, based on your stockpiles and productivity, it is advantageous t... |
157,017 | I think my settlement is somewhat stable now. I have a mine and quarry, so reliable sources of iron/coal/stone. The food supply seems pretty robust, I have three gatherer/forester stations along with two crop fields and everything seems to be chugging along fine. Should I expand some more (build more houses, farms, pas... | 2014/02/20 | [
"https://gaming.stackexchange.com/questions/157017",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/27975/"
] | A few facts to consider:
* Students graduate at age 16 if they live next to the school. If they have to walk (back and forth) to the school, that walking time does not count toward education progress. This is why players are reporting 20 year old students.
* Education gives the worker a ~50% productivity increase. How... | There's almost no time too soon to build a school. Educated people are more efficient and also have less workplace related accidents. That's a force multiplier that's hard to pass up. As soon as your people aren't going to freeze or starve, put up the school. |
15,124,698 | I'm developing a single page wordpress website. As it is a single page one I have used jQuery scrollTop for animating the menu. I want to go to specific div when I click on the corresponding menu link with div id..
Current Problem is the fixed positioned menu tab is crossing the content.. It shows over the div content... | 2013/02/27 | [
"https://Stackoverflow.com/questions/15124698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2113676/"
] | The method `NSDateFormatter initWithDateFormat:allowNaturalLanguage:` is not part of iOS. That method is only available for the Mac. For iOS do:
```
NSDateFormatter* dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"zzz"];
``` | You are getting
```
No visible @interface for 'NSDateFormatter' declares the selector 'initWithDateFormat:allowNaturalLanguage:'
```
because iOS does not support this selector. Only OS X.
Explained in more detail in this post:
[Why is a documented NSDateFormatter init method not getting recognized?](https://stackov... |
370,125 | If you have a linked-list, where the items are not necessarily close to each other in memory, wondering if it is (in general) better/worse/no difference to do the following.
Say you want to iterate through the items 2 or 3 times. One solution is to just iterate through them each time, finding the pointers one at a tim... | 2018/04/29 | [
"https://softwareengineering.stackexchange.com/questions/370125",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/73722/"
] | Caching effects are difficult to predict. In general, contiguous memory data structures like arrays of values are more cache friendly, but does this matter? Not for most code.
For the purpose of iteration over the pointed-to values, an array of pointers is very similar to a linked list which you traverse by pointer ch... | In response to genuine hotspots, it can be a useful optimization at times to especially apply the third solution you proposed which creates a contiguous array of elements that are stored by value (ex: numbers, not variable-sized sub-sequences like strings), and more so if the resulting array doesn't need to store all t... |
60,703,308 | How can I implement pagination in Spring + hibernate project ?
Following is the code. I will get PageRequest object and I want to return Page of item
```
@Repository
public class ItemRepository {
@PersistenceContext
EntityManager entityManager;
public Page<Item> findItems(PageRequest pageRequ... | 2020/03/16 | [
"https://Stackoverflow.com/questions/60703308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6467863/"
] | I found the solution
```
public Page<Item> findItems(PageRequest pageRequest) {
Query query = entityManager.createQuery("From Item");
int pageNumber =pageRequest.getPageNumber();
int pageSize = pageRequest.getCount();
query.setFirstResult((pageNumber) * pageSize);
query.setMaxResults(pageSize);
... | One way to do it is to add logic in your `PageRequest` class to "slice" an incoming list depending on its `Pageable` method parameter and return it as `org.springframework.data.domain.PageImpl`.
Here is a static method that you can use in your `PageRequest` class:
```
public static <E> Page<E> returnPagedList(Pageabl... |
57,019,594 | I need to create one object which will be used for the rest of the program. Thus, it needs to be a global. However - its value needs to be the result of some logic (calling some function). What is the recommended way to do this?
The approach I can think of is this:
```c
MyThing my_global;
bool my_global_is_initialize... | 2019/07/13 | [
"https://Stackoverflow.com/questions/57019594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3284878/"
] | Yours is a good way. I'd also make the flag `static`.
You're paying a small runtime cost for the flag check but might not be a problem (the function call overhead will likely cost more).
Alternatively, you could have a `library_init` function (placeholder name; choose your own) that you'd require the user to call bef... | I'm not entirely sure about what kind of object 'MyThing' is and what values this global variable can be initialized with, but if you know that for example, the initialize\_global() function will never initialize 'my\_global' with the value (-1), you can drop the extra global variable, and do something like this:
```
... |
57,019,594 | I need to create one object which will be used for the rest of the program. Thus, it needs to be a global. However - its value needs to be the result of some logic (calling some function). What is the recommended way to do this?
The approach I can think of is this:
```c
MyThing my_global;
bool my_global_is_initialize... | 2019/07/13 | [
"https://Stackoverflow.com/questions/57019594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3284878/"
] | Yours is a good way. I'd also make the flag `static`.
You're paying a small runtime cost for the flag check but might not be a problem (the function call overhead will likely cost more).
Alternatively, you could have a `library_init` function (placeholder name; choose your own) that you'd require the user to call bef... | If it's a global var, then what you are doing is an antipattern, unless there are multiple global instances of `MyThing`, and in that case having multiple flags one, for each global is even worse.
If MyThing is equivalent of a basic C-type then simply use an out-of-range (of your use case) value to indicate uninitiali... |
57,019,594 | I need to create one object which will be used for the rest of the program. Thus, it needs to be a global. However - its value needs to be the result of some logic (calling some function). What is the recommended way to do this?
The approach I can think of is this:
```c
MyThing my_global;
bool my_global_is_initialize... | 2019/07/13 | [
"https://Stackoverflow.com/questions/57019594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3284878/"
] | There are several ways you could do this:
1. Do the initialization at the start of `main`.
2. Only expose a function `MyThing *get_global(void)`. Users of the global variable would then call this function to obtain a pointer. The function can do whatever it wants, including initializing a static variable the first tim... | I'm not entirely sure about what kind of object 'MyThing' is and what values this global variable can be initialized with, but if you know that for example, the initialize\_global() function will never initialize 'my\_global' with the value (-1), you can drop the extra global variable, and do something like this:
```
... |
57,019,594 | I need to create one object which will be used for the rest of the program. Thus, it needs to be a global. However - its value needs to be the result of some logic (calling some function). What is the recommended way to do this?
The approach I can think of is this:
```c
MyThing my_global;
bool my_global_is_initialize... | 2019/07/13 | [
"https://Stackoverflow.com/questions/57019594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3284878/"
] | There are several ways you could do this:
1. Do the initialization at the start of `main`.
2. Only expose a function `MyThing *get_global(void)`. Users of the global variable would then call this function to obtain a pointer. The function can do whatever it wants, including initializing a static variable the first tim... | If it's a global var, then what you are doing is an antipattern, unless there are multiple global instances of `MyThing`, and in that case having multiple flags one, for each global is even worse.
If MyThing is equivalent of a basic C-type then simply use an out-of-range (of your use case) value to indicate uninitiali... |
57,019,594 | I need to create one object which will be used for the rest of the program. Thus, it needs to be a global. However - its value needs to be the result of some logic (calling some function). What is the recommended way to do this?
The approach I can think of is this:
```c
MyThing my_global;
bool my_global_is_initialize... | 2019/07/13 | [
"https://Stackoverflow.com/questions/57019594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3284878/"
] | If it's a global var, then what you are doing is an antipattern, unless there are multiple global instances of `MyThing`, and in that case having multiple flags one, for each global is even worse.
If MyThing is equivalent of a basic C-type then simply use an out-of-range (of your use case) value to indicate uninitiali... | I'm not entirely sure about what kind of object 'MyThing' is and what values this global variable can be initialized with, but if you know that for example, the initialize\_global() function will never initialize 'my\_global' with the value (-1), you can drop the extra global variable, and do something like this:
```
... |
53,241,453 | I am using a **Custom ArrayAdapter** to store User information for example sammy, robert, lizie are each one User objects and i am using a User type **ArrayList** to store all the User objects to **ArrayList**.
And because it is not a string or int (The ArrayList) the default **getFilter** does not work, and i have d... | 2018/11/10 | [
"https://Stackoverflow.com/questions/53241453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6280855/"
] | `ArrayAdapter`'s built-in `Filter` uses the `toString()` return from the model class (i.e., its type parameter) to perform its filtering comparisons. You don't necessarily need a custom `Filter` implementation if you're able to override `User`'s `toString()` method to return what you want to compare (provided its filte... | ```
Filter myFilter = new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults filterResults = new FilterResults();
ArrayList<User> tempList=new ArrayList<User>();
// Add the filter code here
if(constraint != null &... |
67,240,094 | In our backend server, when user
1. Cancel the subscription.
2. Re-subscribe again after few days.
It is crucial for us to know, the old purchase token, and the new purchase token, are both referring to the same user.
Reason is that, previous, user had already created some data in server, using old cancelled subscri... | 2021/04/24 | [
"https://Stackoverflow.com/questions/67240094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72437/"
] | A resubscription before the original, cancelled subscription has expired will re-use the same purchase token. A re-subscription after the original subscription has already expired is treated like a new purchase, so you will get a brand new purchase token, and the linkedPurchaseToken field will not be set. The linked pu... | To me this seems like a bug, not only it does not send **linkedPurchaseToken**, but also **obfuscatedExternalAccountId** and **obfuscatedExternalProfileId** which were present in the original purchase.
So there seems to be no way to link the resubscription to the user who made it and grant them the purchased items.
Y... |
6,489,637 | I am working on scenario, i have two tables:
"**Master\_product**" and "**New\_Products**"
**Master\_product** table have 14 fields
and
**New\_Products** table have 16 fields, some fields are same between both table but different data-types than **Master\_product**
now i want to copy record to **Master\_product** f... | 2011/06/27 | [
"https://Stackoverflow.com/questions/6489637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816827/"
] | I've done this a few times now, and the details are a bit extensive to put in an answer, but there are a few common gotchas and a few specific ones that you'll need to work on.
First, you need to implement the IDirect3D9 and IDirect3DDevice9 interfaces (at least) *exactly* as they are done in the libraries, or binary-... | You might want to check out existing DirextX packages for Delphi, even just to confirm (with their examples) that the constructs used are the same as one that you use.
The site I know best is Clootie's: <http://clootie.ru/delphi/index.html> But afaik there are multiple attempts
There are both DX9 and DX10 SDKs with e... |
6,489,637 | I am working on scenario, i have two tables:
"**Master\_product**" and "**New\_Products**"
**Master\_product** table have 14 fields
and
**New\_Products** table have 16 fields, some fields are same between both table but different data-types than **Master\_product**
now i want to copy record to **Master\_product** f... | 2011/06/27 | [
"https://Stackoverflow.com/questions/6489637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816827/"
] | I've done this a few times now, and the details are a bit extensive to put in an answer, but there are a few common gotchas and a few specific ones that you'll need to work on.
First, you need to implement the IDirect3D9 and IDirect3DDevice9 interfaces (at least) *exactly* as they are done in the libraries, or binary-... | You can get a fully working D3D9 Proxy DLL if you take the clootie's D3D9 SDK
<http://sourceforge.net/projects/delphi-dx9sdk/>
and the "advanced" d3d9 base from GD
<http://www.gamedeception.net/attachment.php?attachmentid=3035&d=1260299029>
I use it on Delphi Architect XE3 and compiles and workes fine. |
35,800,631 | I'm using `"body-parser": "1.15.0"` and `"express": "4.13.4"`
And I'm trying to get the `json` data from the `body` part of a `http` post request.
This is my code:
```
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
///Set Connection config
var server = require('http')... | 2016/03/04 | [
"https://Stackoverflow.com/questions/35800631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6019037/"
] | >
> It only prints 99 , why doesnt the others values get pushed into vector?
>
>
>
After you inserted the values 55, 99, 5, 99, 100, 13, 99, 55 your tree looks like this:
```
55
/ \
/ \
/ \
5 99
\ / \
13 55 99
... | Python Code
```
import json
class Node:
def __init__(self, val=0):
self.right = ''
self.left = ''
self.value = val
class Tree(Node):
def addNode(self, tree, node, duplicates):
if not tree:
tree = node
elif tree.value > node.value:
if tree.left:
tree... |
15,740,228 | I have the following simple class
```
generic<typename T> where T:IDbConnection ref class CDbConnection
{
private:
IDbConnection^m_db;
ConnectionState^ m_originalConnState;
public:
CDbConnection();
bool Connect(String ^ connStr);
bool Exists(int id);
auto GetAllData(String^ tableStr);
... | 2013/04/01 | [
"https://Stackoverflow.com/questions/15740228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2214140/"
] | You are using wrong [`Date` class constructor](http://docs.oracle.com/javase/7/docs/api/java/util/Date.html#Date%28long%29):
```
Date date = new Date(202020);
```
Means that you are trying to allocate a Date object and initialize it to represent the specified number of milliseconds since the standard base time know... | change `SimpleDateFormat dateformat = new SimpleDateFormat("dd-mm-yy");` to `SimpleDateFormat dateformat = new SimpleDateFormat("dd-MM-yyyy");`
if I clearly remember small `mm` mean minutes not month
[Read this post about date formatting](http://docs.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html)
... |
15,740,228 | I have the following simple class
```
generic<typename T> where T:IDbConnection ref class CDbConnection
{
private:
IDbConnection^m_db;
ConnectionState^ m_originalConnState;
public:
CDbConnection();
bool Connect(String ^ connStr);
bool Exists(int id);
auto GetAllData(String^ tableStr);
... | 2013/04/01 | [
"https://Stackoverflow.com/questions/15740228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2214140/"
] | change `SimpleDateFormat dateformat = new SimpleDateFormat("dd-mm-yy");` to `SimpleDateFormat dateformat = new SimpleDateFormat("dd-MM-yyyy");`
if I clearly remember small `mm` mean minutes not month
[Read this post about date formatting](http://docs.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html)
... | * You create the date instance from a timestamps (milliseconds from 1970). I suppose that is not what you are trying to do.
* You format the date into a string and pass the date. If you want to use the formatted date, you have to pass the string. |
15,740,228 | I have the following simple class
```
generic<typename T> where T:IDbConnection ref class CDbConnection
{
private:
IDbConnection^m_db;
ConnectionState^ m_originalConnState;
public:
CDbConnection();
bool Connect(String ^ connStr);
bool Exists(int id);
auto GetAllData(String^ tableStr);
... | 2013/04/01 | [
"https://Stackoverflow.com/questions/15740228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2214140/"
] | From your comment :
"I tried to add date 1, but it wouldn't allow it. It says string can not be converted to date"
You are passing string to your constructor but looks like it can take java.util.Date object
```
Shopping shoplist1 = new Shopping ( "iphone", 2, date);
```
Change your constructor signature to take a... | change `SimpleDateFormat dateformat = new SimpleDateFormat("dd-mm-yy");` to `SimpleDateFormat dateformat = new SimpleDateFormat("dd-MM-yyyy");`
if I clearly remember small `mm` mean minutes not month
[Read this post about date formatting](http://docs.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html)
... |
15,740,228 | I have the following simple class
```
generic<typename T> where T:IDbConnection ref class CDbConnection
{
private:
IDbConnection^m_db;
ConnectionState^ m_originalConnState;
public:
CDbConnection();
bool Connect(String ^ connStr);
bool Exists(int id);
auto GetAllData(String^ tableStr);
... | 2013/04/01 | [
"https://Stackoverflow.com/questions/15740228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2214140/"
] | You are using wrong [`Date` class constructor](http://docs.oracle.com/javase/7/docs/api/java/util/Date.html#Date%28long%29):
```
Date date = new Date(202020);
```
Means that you are trying to allocate a Date object and initialize it to represent the specified number of milliseconds since the standard base time know... | * You create the date instance from a timestamps (milliseconds from 1970). I suppose that is not what you are trying to do.
* You format the date into a string and pass the date. If you want to use the formatted date, you have to pass the string. |
15,740,228 | I have the following simple class
```
generic<typename T> where T:IDbConnection ref class CDbConnection
{
private:
IDbConnection^m_db;
ConnectionState^ m_originalConnState;
public:
CDbConnection();
bool Connect(String ^ connStr);
bool Exists(int id);
auto GetAllData(String^ tableStr);
... | 2013/04/01 | [
"https://Stackoverflow.com/questions/15740228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2214140/"
] | From your comment :
"I tried to add date 1, but it wouldn't allow it. It says string can not be converted to date"
You are passing string to your constructor but looks like it can take java.util.Date object
```
Shopping shoplist1 = new Shopping ( "iphone", 2, date);
```
Change your constructor signature to take a... | * You create the date instance from a timestamps (milliseconds from 1970). I suppose that is not what you are trying to do.
* You format the date into a string and pass the date. If you want to use the formatted date, you have to pass the string. |
362,122 | in my business area, we have a need to replicate the standard activity timeline component (on the contact record page) but make it custom because we want to do things like having more flexibility around showing cross object fields (appending case subject name in places it doesn't show , adding case notes , etc.
I want... | 2021/11/16 | [
"https://salesforce.stackexchange.com/questions/362122",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/94381/"
] | There are various example available which you can refer to start with:-
1. <https://github.com/anandbn/timeline-lwc>
2. <https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000G0yN3UAJ>
3. <https://awesomeopensource.com/project/deejay-hub/timeline-lwc>
4. <https://kshitijlawate.com/salesforce-record-... | I built TimelinePlus to add filters to a custom timeline component, its pretty straightforward to build the basics but when you get deeper into it pulling all the records from different objects together and the functionality which goes with it starts to get tricky.
I could probably extend it with some of the features ... |
24,188,450 | I want to write a Configwriter that writes data from a dictionary to a config file.
```
jobstore = {
'DEFAULT': [
'foo',
'bar'
],
'DEFAULT2': [
'foo',
'bar'
]
}
with open('./config2.txt', 'w') as f:
conf = ConfigParser()
for job in jobstore.keys():
conf.... | 2014/06/12 | [
"https://Stackoverflow.com/questions/24188450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3715497/"
] | It sounds like you need to grant access to the google apps domain user data. Link below under section "Delegate domain-wide authority to your service account".
<https://developers.google.com/drive/web/delegation> | You may try set the auth like this:
```
$auth = new Google_Auth_AssertionCredentials(
SERVICE_ACCOUNT_NAME,
SCOPES,
$key,
'notasecret',
'http://oauth.net/grant_type/jwt/1.0/bearer',
ADMIN_USER
);
``` |
65,620,398 | I have a dataframe, df, where I am seeing duplicate or unwanted values within my column. I would like to remove any numerical values that *come before* the **#T** ex. hi 1 1.92T,I wish to remove the single '1' to create: hi 1.92T
Data
```
type value
hi 1 1.92T 5
hello 6 6.4T 5
yy16 1 6 12T 6
fre... | 2021/01/07 | [
"https://Stackoverflow.com/questions/65620398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5942100/"
] | Let's use `replace` with the following pattern, details [here](https://regex101.com/r/gLU2uk/2):
```
pat = r'\b([\d\.]+)([^\d\.T])'
df['type'] = df['type'].str.replace(pat, r'\2')
```
Output:
```
type value
0 hi 1.92T 5
1 hello 6.4T 5
2 yy16 12T 6
3 free 12T 7
4 Gal 0T ... | How about:
```
df['filtered_type']=\
df.type.apply(lambda row: ' '.join([row.split(' ')[0],row.split(' ')[-1]]))
```
This will give you:
```
type value filtered_type
0 hi 1 1.92T 5 hi 1.92T
1 hello 6 6.4T 5 hello 6.4T
2 yy16 1 6 12T 6 yy16 12T
3 free 1 1 12T 7 ... |
65,620,398 | I have a dataframe, df, where I am seeing duplicate or unwanted values within my column. I would like to remove any numerical values that *come before* the **#T** ex. hi 1 1.92T,I wish to remove the single '1' to create: hi 1.92T
Data
```
type value
hi 1 1.92T 5
hello 6 6.4T 5
yy16 1 6 12T 6
fre... | 2021/01/07 | [
"https://Stackoverflow.com/questions/65620398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5942100/"
] | How about replacing the spaces and everything between? Is `T` ever not in the last group of characters in the string? Is that the the best way to define the pattern? How about:
```
df['type'] = df['type'].str.replace('(\s+.*\s+)', ' ')
df
type value
0 hi 1.92T 5
1 hello 6.4T 5
2 yy16 12T ... | How about:
```
df['filtered_type']=\
df.type.apply(lambda row: ' '.join([row.split(' ')[0],row.split(' ')[-1]]))
```
This will give you:
```
type value filtered_type
0 hi 1 1.92T 5 hi 1.92T
1 hello 6 6.4T 5 hello 6.4T
2 yy16 1 6 12T 6 yy16 12T
3 free 1 1 12T 7 ... |
65,620,398 | I have a dataframe, df, where I am seeing duplicate or unwanted values within my column. I would like to remove any numerical values that *come before* the **#T** ex. hi 1 1.92T,I wish to remove the single '1' to create: hi 1.92T
Data
```
type value
hi 1 1.92T 5
hello 6 6.4T 5
yy16 1 6 12T 6
fre... | 2021/01/07 | [
"https://Stackoverflow.com/questions/65620398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5942100/"
] | How about replacing the spaces and everything between? Is `T` ever not in the last group of characters in the string? Is that the the best way to define the pattern? How about:
```
df['type'] = df['type'].str.replace('(\s+.*\s+)', ' ')
df
type value
0 hi 1.92T 5
1 hello 6.4T 5
2 yy16 12T ... | Let's use `replace` with the following pattern, details [here](https://regex101.com/r/gLU2uk/2):
```
pat = r'\b([\d\.]+)([^\d\.T])'
df['type'] = df['type'].str.replace(pat, r'\2')
```
Output:
```
type value
0 hi 1.92T 5
1 hello 6.4T 5
2 yy16 12T 6
3 free 12T 7
4 Gal 0T ... |
15,508,477 | I am trying to integrate my application with Box, Dropbox, and Google Drive. All 3 of these services require a number of 3rd party jars. Additionally, my application already requires a few 3rd party jars. Now when I try to run my application from eclipse I get the following error:
>
> Unable to execute dex: method ID... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15508477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426493/"
] | \*\*\*NEW\*\*\*\* All of the other answers are now outdated. Here's the new fix
===============================================================================
Android 5.0 and higher
----------------------
[Multi-dex support is included automatically.](https://developer.android.com/tools/building/multidex.html#mdex-o... | [Here](https://gist.github.com/toms972/c83504df2da1176a248a) is a script I wrote for counting the number of methods in each jar (and in total) for a specific folder.
Once you count the methods you can concentrate on refactoring and removing heavy libraries. |
15,508,477 | I am trying to integrate my application with Box, Dropbox, and Google Drive. All 3 of these services require a number of 3rd party jars. Additionally, my application already requires a few 3rd party jars. Now when I try to run my application from eclipse I get the following error:
>
> Unable to execute dex: method ID... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15508477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426493/"
] | The Dalvik VM can have a maximum of 65536 methods per dex file, due to the bytecode instruction set not having a way to refer to method numbers requiring more than 16 bits (as pointed out by @danfuzz in the comments).
While it is possible to fix this using multiple dex files, Facebook [found another fix](https://www.f... | You need to enable the Dex support for that. So you need to do these steps:
1. Gradle plugin v0.14.0 for Android adds support for multi-dex. To enable, you just have to declare it in build.gradle:
>
>
> ```
> android {
> defaultConfig {
> ...
> multiDexEnabled = true
> }
> }
>
> ```
>
>
2. if ... |
15,508,477 | I am trying to integrate my application with Box, Dropbox, and Google Drive. All 3 of these services require a number of 3rd party jars. Additionally, my application already requires a few 3rd party jars. Now when I try to run my application from eclipse I get the following error:
>
> Unable to execute dex: method ID... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15508477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426493/"
] | Most of the problems with hitting the 65k method limit are related with the use of the mastodontic Google Play Services in your apps. Recently, you can get more granularity when using it.
Following [this guide](http://android-developers.blogspot.com.es/2014/12/google-play-services-and-dex-method.html), you can use onl... | You need to enable the Dex support for that. So you need to do these steps:
1. Gradle plugin v0.14.0 for Android adds support for multi-dex. To enable, you just have to declare it in build.gradle:
>
>
> ```
> android {
> defaultConfig {
> ...
> multiDexEnabled = true
> }
> }
>
> ```
>
>
2. if ... |
15,508,477 | I am trying to integrate my application with Box, Dropbox, and Google Drive. All 3 of these services require a number of 3rd party jars. Additionally, my application already requires a few 3rd party jars. Now when I try to run my application from eclipse I get the following error:
>
> Unable to execute dex: method ID... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15508477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426493/"
] | \*\*\*NEW\*\*\*\* All of the other answers are now outdated. Here's the new fix
===============================================================================
Android 5.0 and higher
----------------------
[Multi-dex support is included automatically.](https://developer.android.com/tools/building/multidex.html#mdex-o... | I faced this issue recently. After scouring the web for some more detailed implementation, I realized there wasn't much out there other than:
* Good but a little outdated now that Gradle is around: <http://android-developers.blogspot.co.il/2011/07/custom-class-loading-in-dalvik.html>
* Not much details but a vague ide... |
15,508,477 | I am trying to integrate my application with Box, Dropbox, and Google Drive. All 3 of these services require a number of 3rd party jars. Additionally, my application already requires a few 3rd party jars. Now when I try to run my application from eclipse I get the following error:
>
> Unable to execute dex: method ID... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15508477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426493/"
] | The Dalvik VM can have a maximum of 65536 methods per dex file, due to the bytecode instruction set not having a way to refer to method numbers requiring more than 16 bits (as pointed out by @danfuzz in the comments).
While it is possible to fix this using multiple dex files, Facebook [found another fix](https://www.f... | Most of the problems with hitting the 65k method limit are related with the use of the mastodontic Google Play Services in your apps. Recently, you can get more granularity when using it.
Following [this guide](http://android-developers.blogspot.com.es/2014/12/google-play-services-and-dex-method.html), you can use onl... |
15,508,477 | I am trying to integrate my application with Box, Dropbox, and Google Drive. All 3 of these services require a number of 3rd party jars. Additionally, my application already requires a few 3rd party jars. Now when I try to run my application from eclipse I get the following error:
>
> Unable to execute dex: method ID... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15508477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426493/"
] | I faced this issue recently. After scouring the web for some more detailed implementation, I realized there wasn't much out there other than:
* Good but a little outdated now that Gradle is around: <http://android-developers.blogspot.co.il/2011/07/custom-class-loading-in-dalvik.html>
* Not much details but a vague ide... | [Here](https://gist.github.com/toms972/c83504df2da1176a248a) is a script I wrote for counting the number of methods in each jar (and in total) for a specific folder.
Once you count the methods you can concentrate on refactoring and removing heavy libraries. |
15,508,477 | I am trying to integrate my application with Box, Dropbox, and Google Drive. All 3 of these services require a number of 3rd party jars. Additionally, my application already requires a few 3rd party jars. Now when I try to run my application from eclipse I get the following error:
>
> Unable to execute dex: method ID... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15508477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426493/"
] | See vm/LinearAlloc.c and you can find this code: (5MiB under Android 2.3.3, 8MiB after Android 4.0 as my investigation)
#define DEFAULT\_MAX\_LENGTH (5\*1024\*1024)
...
LinearAllocHdr\* pHdr;
...
pHdr->mapLength = DEFAULT\_MAX\_LENGTH;
I suppose that the 'Facebook fix' is editing this memory by using native C poi... | [Here](https://gist.github.com/toms972/c83504df2da1176a248a) is a script I wrote for counting the number of methods in each jar (and in total) for a specific folder.
Once you count the methods you can concentrate on refactoring and removing heavy libraries. |
15,508,477 | I am trying to integrate my application with Box, Dropbox, and Google Drive. All 3 of these services require a number of 3rd party jars. Additionally, my application already requires a few 3rd party jars. Now when I try to run my application from eclipse I get the following error:
>
> Unable to execute dex: method ID... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15508477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426493/"
] | You can also develop one or more of these as a plugin to your main app, in the form of a separate APK available for download. That APK would expose some component that the main app would use -- since I do not know the nature of your integration with these services, I cannot make a more specific recommendation about tha... | [Here](https://gist.github.com/toms972/c83504df2da1176a248a) is a script I wrote for counting the number of methods in each jar (and in total) for a specific folder.
Once you count the methods you can concentrate on refactoring and removing heavy libraries. |
15,508,477 | I am trying to integrate my application with Box, Dropbox, and Google Drive. All 3 of these services require a number of 3rd party jars. Additionally, my application already requires a few 3rd party jars. Now when I try to run my application from eclipse I get the following error:
>
> Unable to execute dex: method ID... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15508477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426493/"
] | You can also develop one or more of these as a plugin to your main app, in the form of a separate APK available for download. That APK would expose some component that the main app would use -- since I do not know the nature of your integration with these services, I cannot make a more specific recommendation about tha... | The Dalvik VM can have a maximum of 65536 methods per dex file, due to the bytecode instruction set not having a way to refer to method numbers requiring more than 16 bits (as pointed out by @danfuzz in the comments).
While it is possible to fix this using multiple dex files, Facebook [found another fix](https://www.f... |
15,508,477 | I am trying to integrate my application with Box, Dropbox, and Google Drive. All 3 of these services require a number of 3rd party jars. Additionally, my application already requires a few 3rd party jars. Now when I try to run my application from eclipse I get the following error:
>
> Unable to execute dex: method ID... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15508477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426493/"
] | See vm/LinearAlloc.c and you can find this code: (5MiB under Android 2.3.3, 8MiB after Android 4.0 as my investigation)
#define DEFAULT\_MAX\_LENGTH (5\*1024\*1024)
...
LinearAllocHdr\* pHdr;
...
pHdr->mapLength = DEFAULT\_MAX\_LENGTH;
I suppose that the 'Facebook fix' is editing this memory by using native C poi... | Most of the problems with hitting the 65k method limit are related with the use of the mastodontic Google Play Services in your apps. Recently, you can get more granularity when using it.
Following [this guide](http://android-developers.blogspot.com.es/2014/12/google-play-services-and-dex-method.html), you can use onl... |
7,196,382 | I am working on a small project with jQuery, so far so good, but I am having an issue with jQuery's .live() function.
In my source code below you will see:
```
colourMenu.children('li').live('click', selectColour);
```
The list elements are populated to an empty UL element via an ajax request which parses JSON. Can... | 2011/08/25 | [
"https://Stackoverflow.com/questions/7196382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/377994/"
] | [`.live()` *[docs]*](http://api.jquery.com/live/) only works directly on selectors:
>
> DOM traversal methods are not supported for finding elements to send to `.live()`. Rather, the `.live()` method should always be called directly after a selector, as in the example above.
>
>
>
There might be other issues with... | I imagine it has to do with `checkComplete();` That function is looking at the value of the global var `complete`. If that variable has been set to `true` by another click listener, then your `colourmenu` code will not execute. |
16,177,131 | I made some changes in a website. The website was initial static and to make some changes I changed the links of the website to .php.
I made the changes and it was working perfectly fine in localhost. I saw no errors and no warnings.
However when I moved it to a live server I saw this problem.
```
Server error
The w... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16177131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1364302/"
] | Be sure to check both apache and php error logs (if they're separate). You'll find your answer in there.
Alternatively, assuming php is the culprit, you can momentarily enable the following settings in php.ini:
```
display_errors = On
html_errors = On
error_reporting = E_ALL | E_STRICT
```
just be sure that you dis... | make sure the user www-data has permission to read the php script |
13,421,806 | I'm trying to stretch the height of the last list item to 100% to match the dynamic height of the div floated right.
```
ul.menu li:last-child {height:100%}
```
example of where i've got..
<http://jsfiddle.net/kvtV8/1/>

any help appreciated | 2012/11/16 | [
"https://Stackoverflow.com/questions/13421806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/79803/"
] | What you are asking for can be done but IMHO there is no pretty solution in current CSS. Here is one possibility that works (sort of).
For the list to be aware of the size of the floated element next to it, both need to be contained in the same element (container):
```
<div id="container">
<ul class="menu">
…
... | I think you have to put html and body height to 100%
Try using this line:
```
html, body, section {width:100%; height:100%;}
``` |
120,545 | I am looking to implement a means to generate rooms with outer walls with windows and doors from prefab game objects in Unity.
The idea is that a group of tiles is defined as a room which I then iterate through to find the outer tiles and then use their external edges to generate the walls of the entire room. Gatherin... | 2016/04/26 | [
"https://gamedev.stackexchange.com/questions/120545",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/16256/"
] | You can merge the meshes of multiple game objects into one using [`Mesh.CombineMeshes`](https://docs.unity3d.com/ScriptReference/Mesh.CombineMeshes.html).
Note that this does not care about which materials you assigned to the input meshes. The GameObject into which you merge the meshes will use whatever materials you ... | Disclaimer - I'm not a unity dev & as such I'm not familiar with all its options, but it does look like it has support for [merging meshes together to increase performance](http://docs.unity3d.com/ScriptReference/Mesh.CombineMeshes.html).
In general how to tackle this problem will come down to tensions between player ... |
49,704,744 | I am creating a registration form with VueJS! The user has to enter his/her date of birth.
So, how can I generate years starting from 1900 to current year in `<select>` element?
I tried this:
```js
new Vue ({
el: '.container',
methods: {
getCurrentYear() {
return new Date().getFullYear();
}
... | 2018/04/07 | [
"https://Stackoverflow.com/questions/49704744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8253178/"
] | 1. Don't use a method in the loop, use a computed property instead.
2. Don't use `v-if` in a `v-for` element. [**It's bad!**](https://v2.vuejs.org/v2/style-guide/#Avoid-v-if-with-v-for-essential)
```js
new Vue ({
el: '.container',
computed : {
years () {
const year = new Date().getFullYear()
return... | You can use `v-if`:
```
<option v-for="year in getCurrentYear()" v-if="year >= 1900" :value="year">{{ year }}</option>
```
[ https://v2.vuejs.org/v2/guide/list.html#v-for-with-v-if ] |
49,704,744 | I am creating a registration form with VueJS! The user has to enter his/her date of birth.
So, how can I generate years starting from 1900 to current year in `<select>` element?
I tried this:
```js
new Vue ({
el: '.container',
methods: {
getCurrentYear() {
return new Date().getFullYear();
}
... | 2018/04/07 | [
"https://Stackoverflow.com/questions/49704744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8253178/"
] | ```
mounted(){
this.inittahun();
},
computed : {
inittahun() {
let years = [];
for (var i = 2001; i <= new Date().getFullYear(); i++) {
years.push(i );
}
this.years = years;
},
<select2 v-model="form.tahun">
<option value="">----</opti... | You can use `v-if`:
```
<option v-for="year in getCurrentYear()" v-if="year >= 1900" :value="year">{{ year }}</option>
```
[ https://v2.vuejs.org/v2/guide/list.html#v-for-with-v-if ] |
49,704,744 | I am creating a registration form with VueJS! The user has to enter his/her date of birth.
So, how can I generate years starting from 1900 to current year in `<select>` element?
I tried this:
```js
new Vue ({
el: '.container',
methods: {
getCurrentYear() {
return new Date().getFullYear();
}
... | 2018/04/07 | [
"https://Stackoverflow.com/questions/49704744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8253178/"
] | 1. Don't use a method in the loop, use a computed property instead.
2. Don't use `v-if` in a `v-for` element. [**It's bad!**](https://v2.vuejs.org/v2/style-guide/#Avoid-v-if-with-v-for-essential)
```js
new Vue ({
el: '.container',
computed : {
years () {
const year = new Date().getFullYear()
return... | ```
mounted(){
this.inittahun();
},
computed : {
inittahun() {
let years = [];
for (var i = 2001; i <= new Date().getFullYear(); i++) {
years.push(i );
}
this.years = years;
},
<select2 v-model="form.tahun">
<option value="">----</opti... |
116,108 | ```
@isTest
public class test6 {
static testmethod void test()
{
string check;
system.debug(Test.isRunningTest());
if(Test.isRunningTest())
check='Test7';
else
check='tyftdytfyudd';
}
//system.debug(check);
}
```
While Saving the Apex Class:
>
> Error: Compile Error: Method does not exist or incorrect signa... | 2016/03/30 | [
"https://salesforce.stackexchange.com/questions/116108",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/-1/"
] | Most likely you created an Apex Class before with the name `Test`, which will force the compiler to look at your class and try to find the `isRunningTest()` method instead of the standard Apex class. | Did you add a class to your org named Test?
If you add an Apex Class with the same name as a default class in Apex, all calls to that class will look at your class instead of the standard Apex classes. |
116,108 | ```
@isTest
public class test6 {
static testmethod void test()
{
string check;
system.debug(Test.isRunningTest());
if(Test.isRunningTest())
check='Test7';
else
check='tyftdytfyudd';
}
//system.debug(check);
}
```
While Saving the Apex Class:
>
> Error: Compile Error: Method does not exist or incorrect signa... | 2016/03/30 | [
"https://salesforce.stackexchange.com/questions/116108",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/-1/"
] | Most likely you created an Apex Class before with the name `Test`, which will force the compiler to look at your class and try to find the `isRunningTest()` method instead of the standard Apex class. | Test.isRunningTest() is meant to be used in the class that the test is testing not in the test class itself. See the docs [here](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_test.htm#apex_System_Test_isRunningTest) for more information on that method.
>
> Returns true ... |
116,108 | ```
@isTest
public class test6 {
static testmethod void test()
{
string check;
system.debug(Test.isRunningTest());
if(Test.isRunningTest())
check='Test7';
else
check='tyftdytfyudd';
}
//system.debug(check);
}
```
While Saving the Apex Class:
>
> Error: Compile Error: Method does not exist or incorrect signa... | 2016/03/30 | [
"https://salesforce.stackexchange.com/questions/116108",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/-1/"
] | Test.isRunningTest() is meant to be used in the class that the test is testing not in the test class itself. See the docs [here](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_test.htm#apex_System_Test_isRunningTest) for more information on that method.
>
> Returns true ... | Did you add a class to your org named Test?
If you add an Apex Class with the same name as a default class in Apex, all calls to that class will look at your class instead of the standard Apex classes. |
47,281,687 | I have a python project created in eclipse. I am creating for first time a Dockerfile.The Docker build always fails showing this
>
> ADD failed: no source files were specified
>
>
>
I am copying the project directory and adding pydev packages with python modules using ADD command.Below is the python project stru... | 2017/11/14 | [
"https://Stackoverflow.com/questions/47281687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1731770/"
] | It generally is recommended to use `COPY` before `ADD`, because it serves a lesser purpose and is somewhat more lightweight.
To copy your whole directory into the image, just add the following line after editing:
```
COPY . /path/to/dir/in/image
```
Some helpful links to start writing dockerfiles:
[Reference](htt... | I got the same error for my spring boot microservice.
I have rebuild my microservice using
```
mvn clean install
```
And run the docker build command again, this worked for me. |
47,281,687 | I have a python project created in eclipse. I am creating for first time a Dockerfile.The Docker build always fails showing this
>
> ADD failed: no source files were specified
>
>
>
I am copying the project directory and adding pydev packages with python modules using ADD command.Below is the python project stru... | 2017/11/14 | [
"https://Stackoverflow.com/questions/47281687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1731770/"
] | It generally is recommended to use `COPY` before `ADD`, because it serves a lesser purpose and is somewhat more lightweight.
To copy your whole directory into the image, just add the following line after editing:
```
COPY . /path/to/dir/in/image
```
Some helpful links to start writing dockerfiles:
[Reference](htt... | In a Java project, the problem was the lack of a JAR file in the **target** folder. It was necessary to make (in the case of maven) the **mvn clean package**, and then make the **docker run** command. |
47,281,687 | I have a python project created in eclipse. I am creating for first time a Dockerfile.The Docker build always fails showing this
>
> ADD failed: no source files were specified
>
>
>
I am copying the project directory and adding pydev packages with python modules using ADD command.Below is the python project stru... | 2017/11/14 | [
"https://Stackoverflow.com/questions/47281687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1731770/"
] | It generally is recommended to use `COPY` before `ADD`, because it serves a lesser purpose and is somewhat more lightweight.
To copy your whole directory into the image, just add the following line after editing:
```
COPY . /path/to/dir/in/image
```
Some helpful links to start writing dockerfiles:
[Reference](htt... | I had the same error message.
It was a `.dockerignore` next to my Dockerfile wich was ignoring my file. |
47,281,687 | I have a python project created in eclipse. I am creating for first time a Dockerfile.The Docker build always fails showing this
>
> ADD failed: no source files were specified
>
>
>
I am copying the project directory and adding pydev packages with python modules using ADD command.Below is the python project stru... | 2017/11/14 | [
"https://Stackoverflow.com/questions/47281687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1731770/"
] | In a Java project, the problem was the lack of a JAR file in the **target** folder. It was necessary to make (in the case of maven) the **mvn clean package**, and then make the **docker run** command. | I got the same error for my spring boot microservice.
I have rebuild my microservice using
```
mvn clean install
```
And run the docker build command again, this worked for me. |
47,281,687 | I have a python project created in eclipse. I am creating for first time a Dockerfile.The Docker build always fails showing this
>
> ADD failed: no source files were specified
>
>
>
I am copying the project directory and adding pydev packages with python modules using ADD command.Below is the python project stru... | 2017/11/14 | [
"https://Stackoverflow.com/questions/47281687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1731770/"
] | I had the same error message.
It was a `.dockerignore` next to my Dockerfile wich was ignoring my file. | I got the same error for my spring boot microservice.
I have rebuild my microservice using
```
mvn clean install
```
And run the docker build command again, this worked for me. |
47,281,687 | I have a python project created in eclipse. I am creating for first time a Dockerfile.The Docker build always fails showing this
>
> ADD failed: no source files were specified
>
>
>
I am copying the project directory and adding pydev packages with python modules using ADD command.Below is the python project stru... | 2017/11/14 | [
"https://Stackoverflow.com/questions/47281687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1731770/"
] | In a Java project, the problem was the lack of a JAR file in the **target** folder. It was necessary to make (in the case of maven) the **mvn clean package**, and then make the **docker run** command. | I had the same error message.
It was a `.dockerignore` next to my Dockerfile wich was ignoring my file. |
1,856,980 | I have a UserControl that contains a listbox.
On the parent window, I have this UserControl and a button.
Ideally I'd like to use the ChangePropertyAction behavior on the parents button, and tie it to the UserControl's listbox count.
The idea being that if there are no entries in the listbox inside the usercontro... | 2009/12/06 | [
"https://Stackoverflow.com/questions/1856980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108602/"
] | ```
DBCC FREEPROCCACHE
```
Will remove all cached procedures execution plans. This would cause all subsequent procedure calls to be recompiled.
Adding `WITH RECOMPILE` to a procedure definition would cause the procedure to be recompiled every time it was called.
I do not believe that (in SQL 2005 or earlier) there ... | use
```
WITH RECOMPILE
``` |
1,856,980 | I have a UserControl that contains a listbox.
On the parent window, I have this UserControl and a button.
Ideally I'd like to use the ChangePropertyAction behavior on the parents button, and tie it to the UserControl's listbox count.
The idea being that if there are no entries in the listbox inside the usercontro... | 2009/12/06 | [
"https://Stackoverflow.com/questions/1856980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108602/"
] | If you want to force a query to not use the data cache, the best approach is to clear the cache before you run the query:
```
CHECKPOINT
DBCC DROPCLEANBUFFERS
```
Note that forcing a recompile will have no effect on the query's use of the data cache.
One reason you can't just mark an individual query to avoid the c... | use
```
WITH RECOMPILE
``` |
1,856,980 | I have a UserControl that contains a listbox.
On the parent window, I have this UserControl and a button.
Ideally I'd like to use the ChangePropertyAction behavior on the parents button, and tie it to the UserControl's listbox count.
The idea being that if there are no entries in the listbox inside the usercontro... | 2009/12/06 | [
"https://Stackoverflow.com/questions/1856980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108602/"
] | Another more localized way to not use the MS-SQL Server Cache is to use the `OPTION(RECOMPILE)` keyword at the *end* of your statement.
E.g.
```
SELECT Columnname
FROM TableName
OPTION(RECOMPILE)
```
For more information about this and other similar query-cache clues to help identify problems with a query, Pinal Da... | use
```
WITH RECOMPILE
``` |
1,856,980 | I have a UserControl that contains a listbox.
On the parent window, I have this UserControl and a button.
Ideally I'd like to use the ChangePropertyAction behavior on the parents button, and tie it to the UserControl's listbox count.
The idea being that if there are no entries in the listbox inside the usercontro... | 2009/12/06 | [
"https://Stackoverflow.com/questions/1856980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108602/"
] | ```
DBCC FREEPROCCACHE
```
Will remove all cached procedures execution plans. This would cause all subsequent procedure calls to be recompiled.
Adding `WITH RECOMPILE` to a procedure definition would cause the procedure to be recompiled every time it was called.
I do not believe that (in SQL 2005 or earlier) there ... | If you want to force a query to not use the data cache, the best approach is to clear the cache before you run the query:
```
CHECKPOINT
DBCC DROPCLEANBUFFERS
```
Note that forcing a recompile will have no effect on the query's use of the data cache.
One reason you can't just mark an individual query to avoid the c... |
1,856,980 | I have a UserControl that contains a listbox.
On the parent window, I have this UserControl and a button.
Ideally I'd like to use the ChangePropertyAction behavior on the parents button, and tie it to the UserControl's listbox count.
The idea being that if there are no entries in the listbox inside the usercontro... | 2009/12/06 | [
"https://Stackoverflow.com/questions/1856980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108602/"
] | ```
DBCC FREEPROCCACHE
```
Will remove all cached procedures execution plans. This would cause all subsequent procedure calls to be recompiled.
Adding `WITH RECOMPILE` to a procedure definition would cause the procedure to be recompiled every time it was called.
I do not believe that (in SQL 2005 or earlier) there ... | Another more localized way to not use the MS-SQL Server Cache is to use the `OPTION(RECOMPILE)` keyword at the *end* of your statement.
E.g.
```
SELECT Columnname
FROM TableName
OPTION(RECOMPILE)
```
For more information about this and other similar query-cache clues to help identify problems with a query, Pinal Da... |
1,856,980 | I have a UserControl that contains a listbox.
On the parent window, I have this UserControl and a button.
Ideally I'd like to use the ChangePropertyAction behavior on the parents button, and tie it to the UserControl's listbox count.
The idea being that if there are no entries in the listbox inside the usercontro... | 2009/12/06 | [
"https://Stackoverflow.com/questions/1856980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108602/"
] | If you want to force a query to not use the data cache, the best approach is to clear the cache before you run the query:
```
CHECKPOINT
DBCC DROPCLEANBUFFERS
```
Note that forcing a recompile will have no effect on the query's use of the data cache.
One reason you can't just mark an individual query to avoid the c... | Another more localized way to not use the MS-SQL Server Cache is to use the `OPTION(RECOMPILE)` keyword at the *end* of your statement.
E.g.
```
SELECT Columnname
FROM TableName
OPTION(RECOMPILE)
```
For more information about this and other similar query-cache clues to help identify problems with a query, Pinal Da... |
38,274,372 | I'm trying to do a try-catch-finally so that if the mainLog was successfully created, but an exception was thrown after that, it will be disposed of properly. However, if mainLog was *not* successfully created and there exists a `mainLog.Dipose()` method call, there will be *another exception*. Typically, I would do an... | 2016/07/08 | [
"https://Stackoverflow.com/questions/38274372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6396569/"
] | Adding a [using statement](https://msdn.microsoft.com/en-CA/library/yh598w02.aspx) will call dispose only if it's null at the end of the code block. It's one of those handy syntactic sugars. | In the general case you set `mainLog` to `null` by default and only call the method if it is not null. With C# 6 you can use the handy form:
```
mainLog?.Dispose();
```
For older versions a simple if:
```
if (mainLog != null)
mainLog.Dispose();
```
If the object implements the `IDisposable` interface then usi... |
4,579,215 | I want to iterate *each character* of a Unicode string, *treating each surrogate pair and combining character sequence as a single unit* (one grapheme).
Example
-------
The text "नमस्ते" is comprised of the code points: `U+0928, U+092E, U+0938, U+094D, U+0924, U+0947`, of which, `U+0938` and `U+0947` are *combining m... | 2011/01/02 | [
"https://Stackoverflow.com/questions/4579215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111021/"
] | You should be able to use the ICU [BreakIterator](http://icu-project.org/apiref/icu4c/classBreakIterator.html) for this (the character instance assuming it is feature-equivalent to the Java version). | Glib's [ustring](http://library.gnome.org/devel/glibmm/unstable/classGlib_1_1ustring.html) class gives you utf-8 strings, if using utf-8 is ok for you. It is designed to be similar to `std::string`. Since utf-8 is native for Linux, your task is quite easy:
```
int main()
{
Glib::ustring s = L"नमस्ते";
cout << ... |
4,579,215 | I want to iterate *each character* of a Unicode string, *treating each surrogate pair and combining character sequence as a single unit* (one grapheme).
Example
-------
The text "नमस्ते" is comprised of the code points: `U+0928, U+092E, U+0938, U+094D, U+0924, U+0947`, of which, `U+0938` and `U+0947` are *combining m... | 2011/01/02 | [
"https://Stackoverflow.com/questions/4579215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111021/"
] | You should be able to use the ICU [BreakIterator](http://icu-project.org/apiref/icu4c/classBreakIterator.html) for this (the character instance assuming it is feature-equivalent to the Java version). | ICU has a very old interface, Boost.Locale is much better:
```
#include <iostream>
#include <string_view>
#include <boost/locale.hpp>
using namespace std::string_view_literals;
int main()
{
boost::locale::generator gen;
auto string = "noël "sv;
boost::locale::boundary::csegment_index map{
boost... |
4,579,215 | I want to iterate *each character* of a Unicode string, *treating each surrogate pair and combining character sequence as a single unit* (one grapheme).
Example
-------
The text "नमस्ते" is comprised of the code points: `U+0928, U+092E, U+0938, U+094D, U+0924, U+0947`, of which, `U+0938` and `U+0947` are *combining m... | 2011/01/02 | [
"https://Stackoverflow.com/questions/4579215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111021/"
] | Glib's [ustring](http://library.gnome.org/devel/glibmm/unstable/classGlib_1_1ustring.html) class gives you utf-8 strings, if using utf-8 is ok for you. It is designed to be similar to `std::string`. Since utf-8 is native for Linux, your task is quite easy:
```
int main()
{
Glib::ustring s = L"नमस्ते";
cout << ... | ICU has a very old interface, Boost.Locale is much better:
```
#include <iostream>
#include <string_view>
#include <boost/locale.hpp>
using namespace std::string_view_literals;
int main()
{
boost::locale::generator gen;
auto string = "noël "sv;
boost::locale::boundary::csegment_index map{
boost... |
4,012,124 | Can I can create `public static final` variables in an interface? Can I keep some common constant values defined in these files? | 2010/10/25 | [
"https://Stackoverflow.com/questions/4012124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454660/"
] | Yes, you can:
```
public interface Constants
{
public static final int ZERO = 0;
}
```
However, it's *generally* reckoned not to be a good idea these days. It's not so bad if the interface has a real purpose *as well*, and the constants are likely to be used by most of the implementations... but introducing an i... | Yes, you can keep constants in interfaces. BTW, it's considered to be not very good practice. |
4,012,124 | Can I can create `public static final` variables in an interface? Can I keep some common constant values defined in these files? | 2010/10/25 | [
"https://Stackoverflow.com/questions/4012124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454660/"
] | Yes, you can:
```
public interface Constants
{
public static final int ZERO = 0;
}
```
However, it's *generally* reckoned not to be a good idea these days. It's not so bad if the interface has a real purpose *as well*, and the constants are likely to be used by most of the implementations... but introducing an i... | Certainly, `public` constants can be used declared inside interfaces. One thing, however, if your interface is just going to be placeholders for constants, use `enum` instead |
11,728,599 | I have a feeling its not possible; but is there a way to set a read timeout on an anonymous pipe in Python / C on Linux?
Are there better options than setting and trapping a SIGALRM?
```
>>> import os
>>> output, input = os.pipe()
>>> outputfd = os.fdopen(output, 'r')
>>> dir(outputfd)
['__class__', '__delattr__', '_... | 2012/07/30 | [
"https://Stackoverflow.com/questions/11728599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/592851/"
] | You should try using the `select` module, which does allow you to provide a timeout. Add the file object to the select set, and then examine the return object to see if it's changed:
```
r, w, x = select.select([output], [], [], timeout)
```
Then examine r to see if the object is readable. This can be extended to as... | This isn't a direct setting, but you could use `select` on the file descriptor to wait for input. It's a built-in module, and supports all file descriptors on Unix, but only sockets on OpenVMS and Windows (from the pydoc page on `select`). |
56,357,720 | I have an array object which looks like this
```
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
country: "US",
province: "Illinois"
```
I want my data model to look like this
```
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
issuedEntity:{
c... | 2019/05/29 | [
"https://Stackoverflow.com/questions/56357720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8880204/"
] | You can use array map function and return an object with required keys
```js
let data = [{
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
country: "US",
province: "Illinois"
}]
let newData = data.map(function(item) {
return {
identificationType: item.ident... | You can `map` over your original object and change it's internal values or addon external values to it.
```
myModel.identification.map(idObj => {
idObj.issuedEntity = {
province: idObj.province
country: idObj.country
}
delete idObj.province
delete idObj.country
return idObj
})
``` |
56,357,720 | I have an array object which looks like this
```
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
country: "US",
province: "Illinois"
```
I want my data model to look like this
```
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
issuedEntity:{
c... | 2019/05/29 | [
"https://Stackoverflow.com/questions/56357720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8880204/"
] | You can use array map function and return an object with required keys
```js
let data = [{
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
country: "US",
province: "Illinois"
}]
let newData = data.map(function(item) {
return {
identificationType: item.ident... | I think problem here, we are using `=` instead of `:` colon when assigning value to object.
```
myModel.identification.forEach(identificationObj => {
issuedEntity: {
province **=** identificationObj.issuedEntity.province,
country **=** identificationObj.issuedEntity.country,
}
});
```
It ... |
56,357,720 | I have an array object which looks like this
```
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
country: "US",
province: "Illinois"
```
I want my data model to look like this
```
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
issuedEntity:{
c... | 2019/05/29 | [
"https://Stackoverflow.com/questions/56357720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8880204/"
] | You can use array map function and return an object with required keys
```js
let data = [{
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
country: "US",
province: "Illinois"
}]
let newData = data.map(function(item) {
return {
identificationType: item.ident... | Just in case you might want to use **ES6 Syntax**, you'd do the same thing like this:
```js
let data = [{
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
country: "US",
province: "Illinois"
}]
let newData = data.map(({
identificationType,
identificationDesc,
... |
56,357,720 | I have an array object which looks like this
```
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
country: "US",
province: "Illinois"
```
I want my data model to look like this
```
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
issuedEntity:{
c... | 2019/05/29 | [
"https://Stackoverflow.com/questions/56357720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8880204/"
] | You can `map` over your original object and change it's internal values or addon external values to it.
```
myModel.identification.map(idObj => {
idObj.issuedEntity = {
province: idObj.province
country: idObj.country
}
delete idObj.province
delete idObj.country
return idObj
})
``` | I think problem here, we are using `=` instead of `:` colon when assigning value to object.
```
myModel.identification.forEach(identificationObj => {
issuedEntity: {
province **=** identificationObj.issuedEntity.province,
country **=** identificationObj.issuedEntity.country,
}
});
```
It ... |
56,357,720 | I have an array object which looks like this
```
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
country: "US",
province: "Illinois"
```
I want my data model to look like this
```
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
issuedEntity:{
c... | 2019/05/29 | [
"https://Stackoverflow.com/questions/56357720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8880204/"
] | Just in case you might want to use **ES6 Syntax**, you'd do the same thing like this:
```js
let data = [{
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
country: "US",
province: "Illinois"
}]
let newData = data.map(({
identificationType,
identificationDesc,
... | You can `map` over your original object and change it's internal values or addon external values to it.
```
myModel.identification.map(idObj => {
idObj.issuedEntity = {
province: idObj.province
country: idObj.country
}
delete idObj.province
delete idObj.country
return idObj
})
``` |
56,357,720 | I have an array object which looks like this
```
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
country: "US",
province: "Illinois"
```
I want my data model to look like this
```
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
issuedEntity:{
c... | 2019/05/29 | [
"https://Stackoverflow.com/questions/56357720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8880204/"
] | Just in case you might want to use **ES6 Syntax**, you'd do the same thing like this:
```js
let data = [{
identificationType: "DL",
identificationDesc: "Test",
referenceNumber: "123456789",
country: "US",
province: "Illinois"
}]
let newData = data.map(({
identificationType,
identificationDesc,
... | I think problem here, we are using `=` instead of `:` colon when assigning value to object.
```
myModel.identification.forEach(identificationObj => {
issuedEntity: {
province **=** identificationObj.issuedEntity.province,
country **=** identificationObj.issuedEntity.country,
}
});
```
It ... |
270,387 | My native language is Swedish. And I work as a webdeveloper. And at the moment I am working on a real estate website written in English.
So I would like to know, what is the best word or phrase that describes that bidding of a property has started, when it is writen as a "status" of the object.
Could I use
>
> "Bi... | 2015/08/31 | [
"https://english.stackexchange.com/questions/270387",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/135892/"
] | Standard English, more often that not, doesn't have words for very specific events like this one. I can't find a single word for you to use, but it would be beneficial to condense your statement to this:
>
> Bidding started
>
>
>
This is possibly the closest you'll get while still being as descriptive as possible... | I think you need to check with professionals in the relevant country. In the UK, the word "bid" would suggest that the property was being sold by auction, but that is not how most properties are sold in the UK.
In the UK, "*n* offers have been received" (where *n* is a number) seems right (but I am not a professional)... |
270,387 | My native language is Swedish. And I work as a webdeveloper. And at the moment I am working on a real estate website written in English.
So I would like to know, what is the best word or phrase that describes that bidding of a property has started, when it is writen as a "status" of the object.
Could I use
>
> "Bi... | 2015/08/31 | [
"https://english.stackexchange.com/questions/270387",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/135892/"
] | Bidding is *open*. Later on, bidding is *closed*. | Standard English, more often that not, doesn't have words for very specific events like this one. I can't find a single word for you to use, but it would be beneficial to condense your statement to this:
>
> Bidding started
>
>
>
This is possibly the closest you'll get while still being as descriptive as possible... |
270,387 | My native language is Swedish. And I work as a webdeveloper. And at the moment I am working on a real estate website written in English.
So I would like to know, what is the best word or phrase that describes that bidding of a property has started, when it is writen as a "status" of the object.
Could I use
>
> "Bi... | 2015/08/31 | [
"https://english.stackexchange.com/questions/270387",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/135892/"
] | Bidding is *open*. Later on, bidding is *closed*. | I think you need to check with professionals in the relevant country. In the UK, the word "bid" would suggest that the property was being sold by auction, but that is not how most properties are sold in the UK.
In the UK, "*n* offers have been received" (where *n* is a number) seems right (but I am not a professional)... |
17,134 | I would like to ask how to add more fields to the tags for each individual. We have a lot of individuals who are parents but we do not know where to define them as parents since we don't know the name of their children, can't use the "Parent of" in the Relationship category. So we would like to add more fields in the t... | 2017/02/09 | [
"https://civicrm.stackexchange.com/questions/17134",
"https://civicrm.stackexchange.com",
"https://civicrm.stackexchange.com/users/4292/"
] | I would suggest you create a contact sub-type called "Parent" (sub-type of Individial). This allows you to create a custom field group just for parents, and you can collect whatever additional information you wish. | you didn't indicate what version of Civi you're using (that's always helpful to other users, FYI) but the general answer to your question is that custom fields are unavailable on tags. However, you could create a group to which you can add parents who don't have defined parent/child relationships in Civi, and groups do... |
7,034 | A few batches ago, I had a "learning experience". I now have some pretty good ideas of where I went wrong (mainly, not having any idea how to design a recipe), but I'm wondering what I can do with a case of not-very-tasty (but not completely ruined) beer. This mess started with:
* Using too much molasses (12oz jar of ... | 2012/05/21 | [
"https://homebrew.stackexchange.com/questions/7034",
"https://homebrew.stackexchange.com",
"https://homebrew.stackexchange.com/users/1633/"
] | IMHO, play this batch to its strengths, e.g. cooking ribs or perhaps serving on nitrogen, or mix at pouring time with another beer.
You could try salvaging the batch by blending, but if it still doesn't turn out as you like, then you will have **wasted two batches**.
Since it's already bottled, that would deter me ... | You can't fix Sh!t beer. Invest your time and money on re-brewing it the way you wanted to brew it.
Pouring the beer into a fermentor will only oxidize it and make it worse, regardless of what you want to add to it.
If you are really hell bent on keeping it, go to your favorite bottle shop and buy the strongest doubl... |
7,034 | A few batches ago, I had a "learning experience". I now have some pretty good ideas of where I went wrong (mainly, not having any idea how to design a recipe), but I'm wondering what I can do with a case of not-very-tasty (but not completely ruined) beer. This mess started with:
* Using too much molasses (12oz jar of ... | 2012/05/21 | [
"https://homebrew.stackexchange.com/questions/7034",
"https://homebrew.stackexchange.com",
"https://homebrew.stackexchange.com/users/1633/"
] | You can't fix Sh!t beer. Invest your time and money on re-brewing it the way you wanted to brew it.
Pouring the beer into a fermentor will only oxidize it and make it worse, regardless of what you want to add to it.
If you are really hell bent on keeping it, go to your favorite bottle shop and buy the strongest doubl... | I'm in line with brewchez and mdma when they say not to rescue the beer especially since it has already been bottled. Everything tends to get better with time, so cellar the beer, forget about it and revisit it around November or December and see if it's gotten any better. If not, I'll give you my address (I'm one stat... |
7,034 | A few batches ago, I had a "learning experience". I now have some pretty good ideas of where I went wrong (mainly, not having any idea how to design a recipe), but I'm wondering what I can do with a case of not-very-tasty (but not completely ruined) beer. This mess started with:
* Using too much molasses (12oz jar of ... | 2012/05/21 | [
"https://homebrew.stackexchange.com/questions/7034",
"https://homebrew.stackexchange.com",
"https://homebrew.stackexchange.com/users/1633/"
] | You can't fix Sh!t beer. Invest your time and money on re-brewing it the way you wanted to brew it.
Pouring the beer into a fermentor will only oxidize it and make it worse, regardless of what you want to add to it.
If you are really hell bent on keeping it, go to your favorite bottle shop and buy the strongest doubl... | I have never tried this personally, however I remember an episode of "Basic Brewing Radio" titled "Hopped Vodka" or something like that. This guy used Vodka (and a specific procedure) to basically make a hop extract. The hops were soaked in the Vodka and a couple different distillation procedures were used (freezing an... |
7,034 | A few batches ago, I had a "learning experience". I now have some pretty good ideas of where I went wrong (mainly, not having any idea how to design a recipe), but I'm wondering what I can do with a case of not-very-tasty (but not completely ruined) beer. This mess started with:
* Using too much molasses (12oz jar of ... | 2012/05/21 | [
"https://homebrew.stackexchange.com/questions/7034",
"https://homebrew.stackexchange.com",
"https://homebrew.stackexchange.com/users/1633/"
] | IMHO, play this batch to its strengths, e.g. cooking ribs or perhaps serving on nitrogen, or mix at pouring time with another beer.
You could try salvaging the batch by blending, but if it still doesn't turn out as you like, then you will have **wasted two batches**.
Since it's already bottled, that would deter me ... | I'm in line with brewchez and mdma when they say not to rescue the beer especially since it has already been bottled. Everything tends to get better with time, so cellar the beer, forget about it and revisit it around November or December and see if it's gotten any better. If not, I'll give you my address (I'm one stat... |
7,034 | A few batches ago, I had a "learning experience". I now have some pretty good ideas of where I went wrong (mainly, not having any idea how to design a recipe), but I'm wondering what I can do with a case of not-very-tasty (but not completely ruined) beer. This mess started with:
* Using too much molasses (12oz jar of ... | 2012/05/21 | [
"https://homebrew.stackexchange.com/questions/7034",
"https://homebrew.stackexchange.com",
"https://homebrew.stackexchange.com/users/1633/"
] | IMHO, play this batch to its strengths, e.g. cooking ribs or perhaps serving on nitrogen, or mix at pouring time with another beer.
You could try salvaging the batch by blending, but if it still doesn't turn out as you like, then you will have **wasted two batches**.
Since it's already bottled, that would deter me ... | I have never tried this personally, however I remember an episode of "Basic Brewing Radio" titled "Hopped Vodka" or something like that. This guy used Vodka (and a specific procedure) to basically make a hop extract. The hops were soaked in the Vodka and a couple different distillation procedures were used (freezing an... |
7,034 | A few batches ago, I had a "learning experience". I now have some pretty good ideas of where I went wrong (mainly, not having any idea how to design a recipe), but I'm wondering what I can do with a case of not-very-tasty (but not completely ruined) beer. This mess started with:
* Using too much molasses (12oz jar of ... | 2012/05/21 | [
"https://homebrew.stackexchange.com/questions/7034",
"https://homebrew.stackexchange.com",
"https://homebrew.stackexchange.com/users/1633/"
] | I have never tried this personally, however I remember an episode of "Basic Brewing Radio" titled "Hopped Vodka" or something like that. This guy used Vodka (and a specific procedure) to basically make a hop extract. The hops were soaked in the Vodka and a couple different distillation procedures were used (freezing an... | I'm in line with brewchez and mdma when they say not to rescue the beer especially since it has already been bottled. Everything tends to get better with time, so cellar the beer, forget about it and revisit it around November or December and see if it's gotten any better. If not, I'll give you my address (I'm one stat... |
7,978,688 | `stylesheet.css`
```
body
{
font-family:Tahoma;
}
Label
{
font-family:Freestyle Script;
}
Hyperlink
{
font-family:Times New Roman;
}
TextBox
{
font-family:Tahoma;
}
```
`index.aspx`
`<link rel="Stylesheet" href="StyleSheet.css" type="text/c... | 2011/11/02 | [
"https://Stackoverflow.com/questions/7978688",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/707665/"
] | ASP.NET renders html at client side and css is applied to html. You cannot use HyperLink , Label etc.
```
Label renders to <Span>
Hyperlink to <a>
TextBox to <Input>
```
try
```
a
{
font-family:Times New Roman;
}
input
{
font-family:Tahoma;
}
```
Instead, its better to assign ID's to them and use the ids ... | It's label, not Lable.
Use
```
a
{
...
}
```
Instead of hyperlink. |
7,978,688 | `stylesheet.css`
```
body
{
font-family:Tahoma;
}
Label
{
font-family:Freestyle Script;
}
Hyperlink
{
font-family:Times New Roman;
}
TextBox
{
font-family:Tahoma;
}
```
`index.aspx`
`<link rel="Stylesheet" href="StyleSheet.css" type="text/c... | 2011/11/02 | [
"https://Stackoverflow.com/questions/7978688",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/707665/"
] | ASP.NET renders html at client side and css is applied to html. You cannot use HyperLink , Label etc.
```
Label renders to <Span>
Hyperlink to <a>
TextBox to <Input>
```
try
```
a
{
font-family:Times New Roman;
}
input
{
font-family:Tahoma;
}
```
Instead, its better to assign ID's to them and use the ids ... | u can assign class to controls in aspx file as
```
<asp:TextBox ID="txtName" runat="server" CssClass ="txtInput" />
```
and in css file
```
.txtInput
{
font-family:Tahoma;
}
``` |
48,282,608 | ```
$con=mysqli_connect($localhost,$username,$password,'db');
$query = 'SELECT `SN` FROM `list` WHERE `Floor` LIKE "LP60" AND `type`LIKE "pc"';
$result = mysqli_query($con,$query) or die(mysqli_error());
foreach ($result as $SN)
{
$get = mysqli_query($con,'SELECT * FROM pc WHERE pcSN LIKE '.$SN.'ORD... | 2018/01/16 | [
"https://Stackoverflow.com/questions/48282608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8080663/"
] | You are trying to access the values in an associative array using numeric indexes. Use the column names instead. `mysqli_fetch_assoc()` returns an associative array.
Instead of this,
```
$get_row[1]
```
Try to use this,
```
$get_row['column_name']
```
**Edit**
As per your comment about still getting an error tr... | Do it this way:
```
while ($get_sn_row = mysqli_fetch_assoc($result)) {
$SN = $get_sn_row['SN'];
$get = mysqli_query($con,'SELECT * FROM pc WHERE pcSN LIKE '.$SN.'ORDER BY EvenID DESC LIMIT 1');
while ($get_row = mysqli_fetch_assoc($get)) {
...
}
}
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.