qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
60,696,671
I have a class `Foo`, and I want to extend it dynamically with some literal object that I have. How can I keep the `this` typed **without manually repeating the keys** of the literal object in a separate interface? ```js const someLiteralObject = { key1: 'foo', key2: 'bar', // ...lots of more keys } class Foo ...
2020/03/15
[ "https://Stackoverflow.com/questions/60696671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4019513/" ]
EDIT: I suggest you to look into [Mixins in Typescript](https://www.typescriptlang.org/docs/handbook/mixins.html) and research the difference between `Object.assign` and `applyMixins` helper presented there. Perhaps that design pattern is what you actually need instead. Here's a dirty but strongly typed solution wit u...
Strongly typed way: ``` class Some { // <= This is representing your Object key1: string; key2: string; } const someLiteralObject: Some = { // <= As you can see it is of type Some key1: 'foo', key2: 'bar', } class Foo extends Some { // <= Tell TS we are using all the keys from Some constructor...
11,321,610
I am trying to use the return value(response) from the callback outside the jQuery.post API..how can that be done? ``` jQuery.post( ajaxurl, 'action', function( response ) { console.log(response); // this comes back with "working" // i tried this responseVal = response; but didn't work }); alert(resp...
2012/07/04
[ "https://Stackoverflow.com/questions/11321610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
There is nothing wrong with their bitmap strategy. Just change the 'size' parameter based on the screen density. ``` DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); ``` Now muliply your `size`, `width`, `height`, `widthText`, and `heightText` values by `metr...
The short answer to your question is, use density resources. If you are using a high density screen, but your bitmap in: `res/drawable-hdpi/` The long answer is, that screen density does not have a "silver bullet" so to speak and to have a successful app, you need to make sure your app works across all screens. Getti...
41,892,105
How can I get all the records for `findAll ()` service using pagination and `Spring Data JPA` when we do not apply filters it should return all the records rather than displaying it pagewise.I have `findAll (Pageable pageable)` service and calling it from custom repository. IS it possible to get all the records in one ...
2017/01/27
[ "https://Stackoverflow.com/questions/41892105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7478215/" ]
``` public interface UserRepository extends PagingAndSortingRepository<User, Long> { //Page<User> findAll(Pageable pageable); is already in this repository. } ``` So just in case you want to find the first page of size 20 try: ``` Page<User> users = repository.findAll(new PageRequest(0, 20)); ``` If what you w...
If you are using PagingAndSortingRepository and still want a list of "things", You can add a method `List<Thing> findBy()` If you have a RepositoryRestResource, it will be exposed as REST: `/things/search/findBy`
41,892,105
How can I get all the records for `findAll ()` service using pagination and `Spring Data JPA` when we do not apply filters it should return all the records rather than displaying it pagewise.I have `findAll (Pageable pageable)` service and calling it from custom repository. IS it possible to get all the records in one ...
2017/01/27
[ "https://Stackoverflow.com/questions/41892105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7478215/" ]
``` public interface UserRepository extends PagingAndSortingRepository<User, Long> { //Page<User> findAll(Pageable pageable); is already in this repository. } ``` So just in case you want to find the first page of size 20 try: ``` Page<User> users = repository.findAll(new PageRequest(0, 20)); ``` If what you w...
Use `CrudRepository` instead of `PagingAndSortingRepository` if you don't need paging
41,892,105
How can I get all the records for `findAll ()` service using pagination and `Spring Data JPA` when we do not apply filters it should return all the records rather than displaying it pagewise.I have `findAll (Pageable pageable)` service and calling it from custom repository. IS it possible to get all the records in one ...
2017/01/27
[ "https://Stackoverflow.com/questions/41892105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7478215/" ]
``` public interface UserRepository extends PagingAndSortingRepository<User, Long> { //Page<User> findAll(Pageable pageable); is already in this repository. } ``` So just in case you want to find the first page of size 20 try: ``` Page<User> users = repository.findAll(new PageRequest(0, 20)); ``` If what you w...
Now PageRequest constructor is protected and you cannot create with 'new'. You have to call static method: ``` PageRequest.of(int page, int size) PageRequest.of(int page, int size, @NotNull Sort sort) PageRequest.of(int page, int size, @NotNull Direction direction, @NotNull String... properties) ``` And solution loo...
41,892,105
How can I get all the records for `findAll ()` service using pagination and `Spring Data JPA` when we do not apply filters it should return all the records rather than displaying it pagewise.I have `findAll (Pageable pageable)` service and calling it from custom repository. IS it possible to get all the records in one ...
2017/01/27
[ "https://Stackoverflow.com/questions/41892105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7478215/" ]
``` public interface UserRepository extends PagingAndSortingRepository<User, Long> { //Page<User> findAll(Pageable pageable); is already in this repository. } ``` So just in case you want to find the first page of size 20 try: ``` Page<User> users = repository.findAll(new PageRequest(0, 20)); ``` If what you w...
Step 1: In your repository,implement the interface JpaSpecificationExecutor, which as overloaded findAll method, which accepts the Specification Object and page object created above. ``` The method signature in interface is: Page<T> findAll(@Nullable Specification<T> spec, Pageable pageable); ``` The repository ...
41,892,105
How can I get all the records for `findAll ()` service using pagination and `Spring Data JPA` when we do not apply filters it should return all the records rather than displaying it pagewise.I have `findAll (Pageable pageable)` service and calling it from custom repository. IS it possible to get all the records in one ...
2017/01/27
[ "https://Stackoverflow.com/questions/41892105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7478215/" ]
Now PageRequest constructor is protected and you cannot create with 'new'. You have to call static method: ``` PageRequest.of(int page, int size) PageRequest.of(int page, int size, @NotNull Sort sort) PageRequest.of(int page, int size, @NotNull Direction direction, @NotNull String... properties) ``` And solution loo...
If you are using PagingAndSortingRepository and still want a list of "things", You can add a method `List<Thing> findBy()` If you have a RepositoryRestResource, it will be exposed as REST: `/things/search/findBy`
41,892,105
How can I get all the records for `findAll ()` service using pagination and `Spring Data JPA` when we do not apply filters it should return all the records rather than displaying it pagewise.I have `findAll (Pageable pageable)` service and calling it from custom repository. IS it possible to get all the records in one ...
2017/01/27
[ "https://Stackoverflow.com/questions/41892105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7478215/" ]
Now PageRequest constructor is protected and you cannot create with 'new'. You have to call static method: ``` PageRequest.of(int page, int size) PageRequest.of(int page, int size, @NotNull Sort sort) PageRequest.of(int page, int size, @NotNull Direction direction, @NotNull String... properties) ``` And solution loo...
Use `CrudRepository` instead of `PagingAndSortingRepository` if you don't need paging
41,892,105
How can I get all the records for `findAll ()` service using pagination and `Spring Data JPA` when we do not apply filters it should return all the records rather than displaying it pagewise.I have `findAll (Pageable pageable)` service and calling it from custom repository. IS it possible to get all the records in one ...
2017/01/27
[ "https://Stackoverflow.com/questions/41892105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7478215/" ]
Now PageRequest constructor is protected and you cannot create with 'new'. You have to call static method: ``` PageRequest.of(int page, int size) PageRequest.of(int page, int size, @NotNull Sort sort) PageRequest.of(int page, int size, @NotNull Direction direction, @NotNull String... properties) ``` And solution loo...
Step 1: In your repository,implement the interface JpaSpecificationExecutor, which as overloaded findAll method, which accepts the Specification Object and page object created above. ``` The method signature in interface is: Page<T> findAll(@Nullable Specification<T> spec, Pageable pageable); ``` The repository ...
7,799,763
So I have an app that runs on iOS 3.2 - 4.x. It uses ASIHTTPRequest to make all the REST API calls. Ever since my team and I upgraded three of our iPhone 4's to iOS 5, The app will hang and show the ActivityIndicator indefinitely. I looked at the server logs and the requests aren't hitting the server. However, if I p...
2011/10/17
[ "https://Stackoverflow.com/questions/7799763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999988/" ]
If you are using a UISwitch, then as seen in the developer API, the task `setOn: animated:` should do the trick. ``` - (void)setOn:(BOOL)on animated:(BOOL)animated ``` So to set the switch ON in your program, you would use: **Objective-C** ``` [switchName setOn:YES animated:YES]; ``` **Swift** ``` switchName.se...
UISwitches have a property called "on" that should be set. Are you talking about an iOS app or a mobile web site?
7,799,763
So I have an app that runs on iOS 3.2 - 4.x. It uses ASIHTTPRequest to make all the REST API calls. Ever since my team and I upgraded three of our iPhone 4's to iOS 5, The app will hang and show the ActivityIndicator indefinitely. I looked at the server logs and the requests aren't hitting the server. However, if I p...
2011/10/17
[ "https://Stackoverflow.com/questions/7799763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999988/" ]
UISwitches have a property called "on" that should be set. Are you talking about an iOS app or a mobile web site?
Use this code to solve on/off state problem in switch in iOS ``` - (IBAction)btnSwitched:(id)sender { UISwitch *switchObject = (UISwitch *)sender; if(switchObject.isOn){ self.lblShow.text=@"Switch State is Disabled"; }else{ self.lblShow.text=@"Switch State is Enabled"; } ...
7,799,763
So I have an app that runs on iOS 3.2 - 4.x. It uses ASIHTTPRequest to make all the REST API calls. Ever since my team and I upgraded three of our iPhone 4's to iOS 5, The app will hang and show the ActivityIndicator indefinitely. I looked at the server logs and the requests aren't hitting the server. However, if I p...
2011/10/17
[ "https://Stackoverflow.com/questions/7799763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999988/" ]
UISwitches have a property called "on" that should be set. Are you talking about an iOS app or a mobile web site?
I also use the `setOn:animated:` for this and it works fine. This is the code I use in an app's `viewDidLoad` to toggle a `UISwitch` in code so that it loads preset. ``` // Check the status of the autoPlaySetting BOOL autoPlayOn = [[NSUserDefaults standardUserDefaults] boolForKey:@"autoPlay"]; [self.autoplaySwitch s...
7,799,763
So I have an app that runs on iOS 3.2 - 4.x. It uses ASIHTTPRequest to make all the REST API calls. Ever since my team and I upgraded three of our iPhone 4's to iOS 5, The app will hang and show the ActivityIndicator indefinitely. I looked at the server logs and the requests aren't hitting the server. However, if I p...
2011/10/17
[ "https://Stackoverflow.com/questions/7799763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999988/" ]
UISwitches have a property called "on" that should be set. Are you talking about an iOS app or a mobile web site?
**ViewController.h** ``` - (IBAction)switchAction:(id)sender; @property (strong, nonatomic) IBOutlet UILabel *lbl; ``` **ViewController.m** ``` - (IBAction)switchAction:(id)sender { UISwitch *mySwitch = (UISwitch *)sender; if ([mySwitch isOn]) { self.lbl.backgroundColor = [UIColor redColor]; }...
7,799,763
So I have an app that runs on iOS 3.2 - 4.x. It uses ASIHTTPRequest to make all the REST API calls. Ever since my team and I upgraded three of our iPhone 4's to iOS 5, The app will hang and show the ActivityIndicator indefinitely. I looked at the server logs and the requests aren't hitting the server. However, if I p...
2011/10/17
[ "https://Stackoverflow.com/questions/7799763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999988/" ]
If you are using a UISwitch, then as seen in the developer API, the task `setOn: animated:` should do the trick. ``` - (void)setOn:(BOOL)on animated:(BOOL)animated ``` So to set the switch ON in your program, you would use: **Objective-C** ``` [switchName setOn:YES animated:YES]; ``` **Swift** ``` switchName.se...
Use this code to solve on/off state problem in switch in iOS ``` - (IBAction)btnSwitched:(id)sender { UISwitch *switchObject = (UISwitch *)sender; if(switchObject.isOn){ self.lblShow.text=@"Switch State is Disabled"; }else{ self.lblShow.text=@"Switch State is Enabled"; } ...
7,799,763
So I have an app that runs on iOS 3.2 - 4.x. It uses ASIHTTPRequest to make all the REST API calls. Ever since my team and I upgraded three of our iPhone 4's to iOS 5, The app will hang and show the ActivityIndicator indefinitely. I looked at the server logs and the requests aren't hitting the server. However, if I p...
2011/10/17
[ "https://Stackoverflow.com/questions/7799763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999988/" ]
If you are using a UISwitch, then as seen in the developer API, the task `setOn: animated:` should do the trick. ``` - (void)setOn:(BOOL)on animated:(BOOL)animated ``` So to set the switch ON in your program, you would use: **Objective-C** ``` [switchName setOn:YES animated:YES]; ``` **Swift** ``` switchName.se...
I also use the `setOn:animated:` for this and it works fine. This is the code I use in an app's `viewDidLoad` to toggle a `UISwitch` in code so that it loads preset. ``` // Check the status of the autoPlaySetting BOOL autoPlayOn = [[NSUserDefaults standardUserDefaults] boolForKey:@"autoPlay"]; [self.autoplaySwitch s...
7,799,763
So I have an app that runs on iOS 3.2 - 4.x. It uses ASIHTTPRequest to make all the REST API calls. Ever since my team and I upgraded three of our iPhone 4's to iOS 5, The app will hang and show the ActivityIndicator indefinitely. I looked at the server logs and the requests aren't hitting the server. However, if I p...
2011/10/17
[ "https://Stackoverflow.com/questions/7799763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999988/" ]
If you are using a UISwitch, then as seen in the developer API, the task `setOn: animated:` should do the trick. ``` - (void)setOn:(BOOL)on animated:(BOOL)animated ``` So to set the switch ON in your program, you would use: **Objective-C** ``` [switchName setOn:YES animated:YES]; ``` **Swift** ``` switchName.se...
**ViewController.h** ``` - (IBAction)switchAction:(id)sender; @property (strong, nonatomic) IBOutlet UILabel *lbl; ``` **ViewController.m** ``` - (IBAction)switchAction:(id)sender { UISwitch *mySwitch = (UISwitch *)sender; if ([mySwitch isOn]) { self.lbl.backgroundColor = [UIColor redColor]; }...
7,799,763
So I have an app that runs on iOS 3.2 - 4.x. It uses ASIHTTPRequest to make all the REST API calls. Ever since my team and I upgraded three of our iPhone 4's to iOS 5, The app will hang and show the ActivityIndicator indefinitely. I looked at the server logs and the requests aren't hitting the server. However, if I p...
2011/10/17
[ "https://Stackoverflow.com/questions/7799763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999988/" ]
Use this code to solve on/off state problem in switch in iOS ``` - (IBAction)btnSwitched:(id)sender { UISwitch *switchObject = (UISwitch *)sender; if(switchObject.isOn){ self.lblShow.text=@"Switch State is Disabled"; }else{ self.lblShow.text=@"Switch State is Enabled"; } ...
I also use the `setOn:animated:` for this and it works fine. This is the code I use in an app's `viewDidLoad` to toggle a `UISwitch` in code so that it loads preset. ``` // Check the status of the autoPlaySetting BOOL autoPlayOn = [[NSUserDefaults standardUserDefaults] boolForKey:@"autoPlay"]; [self.autoplaySwitch s...
7,799,763
So I have an app that runs on iOS 3.2 - 4.x. It uses ASIHTTPRequest to make all the REST API calls. Ever since my team and I upgraded three of our iPhone 4's to iOS 5, The app will hang and show the ActivityIndicator indefinitely. I looked at the server logs and the requests aren't hitting the server. However, if I p...
2011/10/17
[ "https://Stackoverflow.com/questions/7799763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999988/" ]
Use this code to solve on/off state problem in switch in iOS ``` - (IBAction)btnSwitched:(id)sender { UISwitch *switchObject = (UISwitch *)sender; if(switchObject.isOn){ self.lblShow.text=@"Switch State is Disabled"; }else{ self.lblShow.text=@"Switch State is Enabled"; } ...
**ViewController.h** ``` - (IBAction)switchAction:(id)sender; @property (strong, nonatomic) IBOutlet UILabel *lbl; ``` **ViewController.m** ``` - (IBAction)switchAction:(id)sender { UISwitch *mySwitch = (UISwitch *)sender; if ([mySwitch isOn]) { self.lbl.backgroundColor = [UIColor redColor]; }...
7,799,763
So I have an app that runs on iOS 3.2 - 4.x. It uses ASIHTTPRequest to make all the REST API calls. Ever since my team and I upgraded three of our iPhone 4's to iOS 5, The app will hang and show the ActivityIndicator indefinitely. I looked at the server logs and the requests aren't hitting the server. However, if I p...
2011/10/17
[ "https://Stackoverflow.com/questions/7799763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999988/" ]
I also use the `setOn:animated:` for this and it works fine. This is the code I use in an app's `viewDidLoad` to toggle a `UISwitch` in code so that it loads preset. ``` // Check the status of the autoPlaySetting BOOL autoPlayOn = [[NSUserDefaults standardUserDefaults] boolForKey:@"autoPlay"]; [self.autoplaySwitch s...
**ViewController.h** ``` - (IBAction)switchAction:(id)sender; @property (strong, nonatomic) IBOutlet UILabel *lbl; ``` **ViewController.m** ``` - (IBAction)switchAction:(id)sender { UISwitch *mySwitch = (UISwitch *)sender; if ([mySwitch isOn]) { self.lbl.backgroundColor = [UIColor redColor]; }...
27,251,797
I have an application that has a single activity that hosts several fragments in a sort of custom navigation drawer design. Two of these fragments depend on a service to return them json information to display. I want to be able to start the service on my splash screen to load the data I need then asynchronously commu...
2014/12/02
[ "https://Stackoverflow.com/questions/27251797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3740701/" ]
You could call startService() not only from your splash screen, but from your fragments: `getActivity().startService()`. Derive your service from [Service](http://developer.android.com/reference/android/app/Service.html) (not from IntentService). In the `onStartCommand()` it will read data from network, then broadcast...
Use event bus instead of broadcasting intents, like [Green Robot EventBus](https://github.com/greenrobot/EventBus) (also supports sticky broadcasts)
27,251,797
I have an application that has a single activity that hosts several fragments in a sort of custom navigation drawer design. Two of these fragments depend on a service to return them json information to display. I want to be able to start the service on my splash screen to load the data I need then asynchronously commu...
2014/12/02
[ "https://Stackoverflow.com/questions/27251797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3740701/" ]
Believe me, I tried a lot of third party approaches (service buses, observes, ...) in large enterprise projects and it turned out the native Android mechanisms are the fastest and robust ones, since they take advantage of the framework's benefits. Thats why I would recommend the usage of LocalBroadcastManager along wi...
Use event bus instead of broadcasting intents, like [Green Robot EventBus](https://github.com/greenrobot/EventBus) (also supports sticky broadcasts)
36,466,008
I'm learning about multithreading in C++11 and I tried this simple test but the output is not what I expected. ``` #include <thread> #include <iostream> #include <mutex> int main() { auto function = [](int x) { std::mutex m; m.try_lock(); std::cout << "Hello" << x << std::endl; m.u...
2016/04/07
[ "https://Stackoverflow.com/questions/36466008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4501262/" ]
You need to use `static`, as all threads must access the same mutex object. Also, `try_lock()` (or `lock()`) causes problems if an exception is thrown before you get to `unlock()`. `std::lock_guard<>()` is a much safer way of doing this and is recommended, as it will be released when you go out of its scope, whether it...
`try_lock()` does not necessarily lock the mutex. It might lock the mutex, it might not. It only tries to lock the mutex if it can. If it's already locked, it does not wait until the mutex gets unlocked, but returns an indication that this has happened. So, in effect, your code does not end up effectively synchronizin...
6,305,049
I am creating **table rows** within a TableLayout in a loop which goes till the size of an array. The size of my array is 120. In the loop, an object of another class is created. ``` for(int i=0; i<arrName.length; i++) { MyClass *obj =new MyClass(this); /* Some code */ } ``` **Question**: 1) How do I relea...
2011/06/10
[ "https://Stackoverflow.com/questions/6305049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
**Use this** html() gets the html code. and .text() function returns only text visible. ``` $(this).find("td:nth-child(1)").text(); ```
The raw JavaScript [`unescape()`](https://developer.mozilla.org/ja/DOM/window.unescape) function can be used for this as follows: ``` var content = $(this).find("td:nth-child(1)").html(); var unescapedContent = unescape(content); ```
902,565
I have a sequence of numbers below... $1, 2, 4, 7, 11, 16 ...$ You get this list by starting at $1$ then add $1, 2, 3, 4, 5 ...$ Given a number $n$, how can I determine if it will show up in this pattern of numbers?
2014/08/19
[ "https://math.stackexchange.com/questions/902565", "https://math.stackexchange.com", "https://math.stackexchange.com/users/70527/" ]
The $k$th term in your sequence is $1+\frac{k(k-1)}{2}$. [See [triangular numbers](http://en.wikipedia.org/wiki/Triangular_number).] Given your number $n$, you just need to check if it is of this form or not.
Put another way, take your number, multiply by $8,$ then subtract $7.$ If the result is a perfect square, the number is in the sequence, otherwise no.
7,966,428
Basically I have created an app that reads and writes values in text boxes to an XML file. Instead of using all text boxes I want to add in some combo boxes but I am not sure what property is needed for it. ``` String ^strMake = this->txtMake->Text; String ^strModel = this->txtModel->Text; ...
2011/11/01
[ "https://Stackoverflow.com/questions/7966428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/993180/" ]
After a lot of debugging I found that this was actually due to a memory corruption being caused by the QSStrings library which I was using to generate base64 encoded strings. The crashes seemed to happen randomly but only after this library was invoked. When I switched to a different MD5 library, the issue went away. I...
I think the problem happens because you have something wrong in your view that owns your label (view of your ActiveChallengeViewController). When you set the font of your label, that invokes the setNeedsDisplay of your parent view and because something is wrong, setNeedsDisplay crashs. Your line : ``` self.challenge...
7,379,070
So far I learned how animations work and how to set the background of a button according to its state as described [here](http://www.gersic.com/blog.php?id=56). Well, I defined an animation: ``` <set xmlns:android="http://schemas.android.com/apk/res/android"> <alpha android:interpolator="@android:anim/accelerat...
2011/09/11
[ "https://Stackoverflow.com/questions/7379070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/939248/" ]
You can use the Selector tag like Follows: Create a New xml file and place it in your drawable folder and name it as shadow\_color.xml ``` <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_pressed="false" an...
Define the `onclick` for the button =================================== ``` button1.setOnClickListener( new Button.OnClickListener() { public void onClick (View v){ calcular(1,v); } } ); ``` Make your button blink ====================== This makes the images defined in the XML alternate between eac...
40,462,632
I havent used PyGithub yet but I am just curious if there is any possibility to get a list of releases from a repository (e.g. `https://github.com/{username}/{repo-name}/releases`). I can not see any information about that in documentation [here](http://pygithub.readthedocs.io/en/latest/apis.html).
2016/11/07
[ "https://Stackoverflow.com/questions/40462632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3333597/" ]
The question is a bit old but nobody seems to have answered it in the way the OP asked. PyGithub does have a way to return releases of a repo, here is a working example: ```py from github import Github G = Github('') # Put your GitHub token here repo = G.get_repo('justintime50/github-archive') releases = repo.get_r...
You can get a list of releases from a GitHub repo by making a GET request to ``` https://api.github.com/repos/{user}/{repo}/releases ``` Eg ``` import requests url = 'https://api.github.com/repos/facebook/react/releases' response = requests.get(url) # Raise an exception if the API call fails. response.raise_for_...
40,462,632
I havent used PyGithub yet but I am just curious if there is any possibility to get a list of releases from a repository (e.g. `https://github.com/{username}/{repo-name}/releases`). I can not see any information about that in documentation [here](http://pygithub.readthedocs.io/en/latest/apis.html).
2016/11/07
[ "https://Stackoverflow.com/questions/40462632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3333597/" ]
The question is a bit old but nobody seems to have answered it in the way the OP asked. PyGithub does have a way to return releases of a repo, here is a working example: ```py from github import Github G = Github('') # Put your GitHub token here repo = G.get_repo('justintime50/github-archive') releases = repo.get_r...
The documentation for PyGithub doesn't mention it, but I believe that `pygithub-1.29` (the latest published on PyPi as of today) does in fact contain this API: [`Repository.py`](https://github.com/PyGithub/PyGithub/blob/v1.29/github/Repository.py#L2056) for the `v1.29` tag contains a `get_releases()` function. There i...
21,294,352
I'm trying to select the values from two adjacent xml nodes at the same time using ``` var values = xDoc.Element("root") .Elements("model") .Where(x => x.Element("modelName").Value == modelType.ToString()) .Elements("directory") .Select(x => n...
2014/01/22
[ "https://Stackoverflow.com/questions/21294352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2125444/" ]
I suggest you to use casting elements to string instead of accessing their `Value` property. Because if element is missing (e.g. for `Model1` you don't have `taskName` element) then you will get `NullReferenceException`. ``` var values = from m in xDoc.Root.Elements("model") where (string)m.Element("model...
Figured it out, you just need to name the properties in the anonymous type ``` var values = xDoc.Element("root") .Elements("model") .Where(x => x.Element("modelName").Value == modelType.ToString()) .Elements("directory") .Select(x => new { Dir...
44,444,815
hello guys after mixing laravel template i have some problem with the jquery with Error: Bootstrap's JavaScript requires jQuery and after searcing im still confused whats happen can you help me here is my code : ``` <script src="{{{ URL::asset('js/ace-extra.min.js')}}}"></script> <script src="{{{ URL::asset('js/b...
2017/06/08
[ "https://Stackoverflow.com/questions/44444815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8100587/" ]
Here's a simple solution: ``` // array to store required strings $stringsCollection = []; // 4 is the number of strings that you need while (sizeof($stringsCollection) != 4) { // generate new string $randString = random_string($length); // if string is not in `stringsCollection` - add it as a key if (!...
> > or is there a more efficient way > > > You are heading to "overengeneering land", trying to fix things you cannot even name :) Is it slow? Sluggish? Then profile and fix relevant parts. "Efficient" is buzzword w/o defining what efficiency means for you. > > what is the best way to prevent duplicate outputs /...
38,590,811
Is there a shorthand method for constructing a 2D array? I really don't want to do the following: ``` let board = array2D [| [| 0;0 |] [| 0;1 |] [| 0;2 |] [| 0;3 |] [| 0;4 |] ...
2016/07/26
[ "https://Stackoverflow.com/questions/38590811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/492701/" ]
You could do something like this: ``` import sys try: _, size, file = sys.argv size = int(size) except ValueError: sys.exit('Usage: splitter.py <size in bytes> <filename to split>') with open(file) as infile: count = 0 current_size = 0 # you could do something more # fancy with the name l...
As comment above mentions you can use `split` in the bash shell: ``` split -b 20000m <path-to-your-file> ```
73,945,039
I am trying to add an background image with css but I am geting 404 error GEThttp://127.0.0.1:5500/css/img/example.jpg Here is the code that I use. ``` body { background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0,0.7)), url(img/example.jpg); background-size: cover; background-position: cente...
2022/10/04
[ "https://Stackoverflow.com/questions/73945039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15842342/" ]
The path may be correct, but not if the css is the starting point So firstly you have to go up a level with "../" in front of your current path. So "../img/example.jpg" (Maybe you have to go up several levels, depending on where exactly your folder lies, you would need to show your folder structure for more insight if...
If this is a CSS file, the image file is relative to the css file, not the html.
73,945,039
I am trying to add an background image with css but I am geting 404 error GEThttp://127.0.0.1:5500/css/img/example.jpg Here is the code that I use. ``` body { background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0,0.7)), url(img/example.jpg); background-size: cover; background-position: cente...
2022/10/04
[ "https://Stackoverflow.com/questions/73945039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15842342/" ]
The path may be correct, but not if the css is the starting point So firstly you have to go up a level with "../" in front of your current path. So "../img/example.jpg" (Maybe you have to go up several levels, depending on where exactly your folder lies, you would need to show your folder structure for more insight if...
`url` accepts the path relative to `/` (document root of the web server where website is deployed) or to the CSS file. So if you change the line by adding `/css`: `background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0,0.7)), url(img/example.jpg);` to `background-image: linear-gradient(rgba(0, 0, 0, 0.7...
12,990
I am a student of computer science with interest in image processing. I have learned how to apply a few effects to images like making them grayscale, sketching them out of lines, etc. I would like to learn more about the algorithmic techniques behind creative manipulation of images like making them sepia-tone, smudgi...
2013/06/30
[ "https://cs.stackexchange.com/questions/12990", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/8418/" ]
There are books on digital image processing which you can look into. Many common image manipulation techniques, such as smudging (usually known as blurring) are accomplished by [image filtering](http://lodev.org/cgtutor/filtering.html), which is a process of applying a two-dimensional filter to an image: the value of e...
I have been working on that very same thing recently, albeit for a very different purpose. Asides from SO, I have been referring to Google code examples, and forums related to the platform and language that I am working in. Sometimes, I found some information and techniques from [Image Processing Online](http://www.ipo...
12,990
I am a student of computer science with interest in image processing. I have learned how to apply a few effects to images like making them grayscale, sketching them out of lines, etc. I would like to learn more about the algorithmic techniques behind creative manipulation of images like making them sepia-tone, smudgi...
2013/06/30
[ "https://cs.stackexchange.com/questions/12990", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/8418/" ]
I have been working on that very same thing recently, albeit for a very different purpose. Asides from SO, I have been referring to Google code examples, and forums related to the platform and language that I am working in. Sometimes, I found some information and techniques from [Image Processing Online](http://www.ipo...
If you already know the name of some specific image processing technique, Wikipedia has pretty good explanations -- such as ["closing"](http://en.wikipedia.org/wiki/closing_%28morphology%29) in [morphological image processing](http://en.wikipedia.org/wiki/morphological_image_processing). The [computer vision wiki](htt...
12,990
I am a student of computer science with interest in image processing. I have learned how to apply a few effects to images like making them grayscale, sketching them out of lines, etc. I would like to learn more about the algorithmic techniques behind creative manipulation of images like making them sepia-tone, smudgi...
2013/06/30
[ "https://cs.stackexchange.com/questions/12990", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/8418/" ]
There are books on digital image processing which you can look into. Many common image manipulation techniques, such as smudging (usually known as blurring) are accomplished by [image filtering](http://lodev.org/cgtutor/filtering.html), which is a process of applying a two-dimensional filter to an image: the value of e...
you seem to be interested in image enhancement techniques such as used on Instagram to add "cool effects". these algorithms tend to be somewhat more advanced and proprietary. however for basic image manipulation which is the underlying basis for these algorithms, there are many places to start. here are a few: * [Imag...
12,990
I am a student of computer science with interest in image processing. I have learned how to apply a few effects to images like making them grayscale, sketching them out of lines, etc. I would like to learn more about the algorithmic techniques behind creative manipulation of images like making them sepia-tone, smudgi...
2013/06/30
[ "https://cs.stackexchange.com/questions/12990", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/8418/" ]
There are books on digital image processing which you can look into. Many common image manipulation techniques, such as smudging (usually known as blurring) are accomplished by [image filtering](http://lodev.org/cgtutor/filtering.html), which is a process of applying a two-dimensional filter to an image: the value of e...
What you are referring to is not a branch of just image processing, but specifically [digital image processing.](http://en.wikipedia.org/wiki/Digital_image_processing) Also, [linear filtering](http://en.wikipedia.org/wiki/Linear_filter) should help a bit.
12,990
I am a student of computer science with interest in image processing. I have learned how to apply a few effects to images like making them grayscale, sketching them out of lines, etc. I would like to learn more about the algorithmic techniques behind creative manipulation of images like making them sepia-tone, smudgi...
2013/06/30
[ "https://cs.stackexchange.com/questions/12990", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/8418/" ]
There are books on digital image processing which you can look into. Many common image manipulation techniques, such as smudging (usually known as blurring) are accomplished by [image filtering](http://lodev.org/cgtutor/filtering.html), which is a process of applying a two-dimensional filter to an image: the value of e...
If you already know the name of some specific image processing technique, Wikipedia has pretty good explanations -- such as ["closing"](http://en.wikipedia.org/wiki/closing_%28morphology%29) in [morphological image processing](http://en.wikipedia.org/wiki/morphological_image_processing). The [computer vision wiki](htt...
12,990
I am a student of computer science with interest in image processing. I have learned how to apply a few effects to images like making them grayscale, sketching them out of lines, etc. I would like to learn more about the algorithmic techniques behind creative manipulation of images like making them sepia-tone, smudgi...
2013/06/30
[ "https://cs.stackexchange.com/questions/12990", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/8418/" ]
you seem to be interested in image enhancement techniques such as used on Instagram to add "cool effects". these algorithms tend to be somewhat more advanced and proprietary. however for basic image manipulation which is the underlying basis for these algorithms, there are many places to start. here are a few: * [Imag...
If you already know the name of some specific image processing technique, Wikipedia has pretty good explanations -- such as ["closing"](http://en.wikipedia.org/wiki/closing_%28morphology%29) in [morphological image processing](http://en.wikipedia.org/wiki/morphological_image_processing). The [computer vision wiki](htt...
12,990
I am a student of computer science with interest in image processing. I have learned how to apply a few effects to images like making them grayscale, sketching them out of lines, etc. I would like to learn more about the algorithmic techniques behind creative manipulation of images like making them sepia-tone, smudgi...
2013/06/30
[ "https://cs.stackexchange.com/questions/12990", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/8418/" ]
What you are referring to is not a branch of just image processing, but specifically [digital image processing.](http://en.wikipedia.org/wiki/Digital_image_processing) Also, [linear filtering](http://en.wikipedia.org/wiki/Linear_filter) should help a bit.
If you already know the name of some specific image processing technique, Wikipedia has pretty good explanations -- such as ["closing"](http://en.wikipedia.org/wiki/closing_%28morphology%29) in [morphological image processing](http://en.wikipedia.org/wiki/morphological_image_processing). The [computer vision wiki](htt...
37,373
We have been introduced to 5 characters (all Impel Down Jailers) with "Awakened" Zoan Devil Fruits. Minotaurus is the most famous of them. A normal Zoan fruit allows the user to transform between Natural (normally human), Animal (based on the devil fruit type), and Hybrid forms. I can't, however, remember any of the "M...
2016/11/17
[ "https://anime.stackexchange.com/questions/37373", "https://anime.stackexchange.com", "https://anime.stackexchange.com/users/3561/" ]
My theory about its "real name" is, either Towako, the name of hakumen's avatar, maybe Hakumen named its avatar the real name for self-satisfaction? and the second probable name, is kirio/Inasa, as in Kirio Inasa, the boy whom it kidnapped. after the kidnapping, it probably change his name as it likes. I personally t...
In my opinion i think Hakumen’s real name might have something to do with the baby shown as he vaporizes and yin/yang because in the end he does not fall as negative ki which creates other youkai, but he floats upwards as positive ki. Maybe in the end he died a peaceful death and he could now be reborn as a human, not ...
21,501,174
I'm trying: ``` python3 -m timeit -c 'len("".join([str(x) for x in range(0, 999999)]))' 10 loops, best of 3: 330 msec per loop python3 -m timeit -c 'sum((len(y) for y in [str(x) for x in range(0, 999999)])) 10 loops, best of 3: 439 msec per loop ``` Why does this happen? Is there a faster way? P.S. It is assumed t...
2014/02/01
[ "https://Stackoverflow.com/questions/21501174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3260919/" ]
A better benchmark with IPython shows the situation is worse than you thought: ``` >>> lst = [str(x) for x in range(0, 999999)] >>> %timeit len("".join(lst)) 100 loops, best of 3: 9.94 ms per loop >>> %timeit sum(len(x) for x in lst) 10 loops, best of 3: 62.2 ms per loop ``` You're seeing two effects here, the overh...
The first (faster) version has 1 call to the `len` function, 1 call to `join` and 100k calls to `str`. Looking at the second line you can see that both `len` and `str` are called 100k times each which makes for about twice as many total function calls in the second case.
21,501,174
I'm trying: ``` python3 -m timeit -c 'len("".join([str(x) for x in range(0, 999999)]))' 10 loops, best of 3: 330 msec per loop python3 -m timeit -c 'sum((len(y) for y in [str(x) for x in range(0, 999999)])) 10 loops, best of 3: 439 msec per loop ``` Why does this happen? Is there a faster way? P.S. It is assumed t...
2014/02/01
[ "https://Stackoverflow.com/questions/21501174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3260919/" ]
Ignoring that rather small time difference for now, there is actually a huge difference for your two ways *in memory*. ``` sum((len(y) for y in [str(x) for x in range(0, 999999)])) ``` This will create a string for each number and store that in a list. Then you use a generator expression to loop over that list and s...
The first (faster) version has 1 call to the `len` function, 1 call to `join` and 100k calls to `str`. Looking at the second line you can see that both `len` and `str` are called 100k times each which makes for about twice as many total function calls in the second case.
148,852
I deployed a webpart by admin user in Visual Studio 2013 through in SharePoint 2013. It's working fine. But when I deploy using another user which already have admin permission then it is showing below error. > > Error occurred in deployment step 'Retract Solution': Object reference not set to an instance of an obj...
2015/07/10
[ "https://sharepoint.stackexchange.com/questions/148852", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/37342/" ]
It's most likely your SpSite or SpWeb object is null because of insufficient rights to the user. Can you make sure that the user have rights on the webapp you are deploying the solution too. A simple way to make sure that the user have sufficient rights is to create a new test solution and deploy, it will make things c...
I had same problem and i tried whatever was suggested in the blog. Like uninstall solution etc. Then I did a restart of system. And opened a new solution and tired to deploy. But this time the error was very clear, I got a message it was due to increase in database size. After reducing deployment worked correctly.
148,852
I deployed a webpart by admin user in Visual Studio 2013 through in SharePoint 2013. It's working fine. But when I deploy using another user which already have admin permission then it is showing below error. > > Error occurred in deployment step 'Retract Solution': Object reference not set to an instance of an obj...
2015/07/10
[ "https://sharepoint.stackexchange.com/questions/148852", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/37342/" ]
It's most likely your SpSite or SpWeb object is null because of insufficient rights to the user. Can you make sure that the user have rights on the webapp you are deploying the solution too. A simple way to make sure that the user have sufficient rights is to create a new test solution and deploy, it will make things c...
I had same problem and my solution was related with no space in disk for deployment. ps.: database disk.
148,852
I deployed a webpart by admin user in Visual Studio 2013 through in SharePoint 2013. It's working fine. But when I deploy using another user which already have admin permission then it is showing below error. > > Error occurred in deployment step 'Retract Solution': Object reference not set to an instance of an obj...
2015/07/10
[ "https://sharepoint.stackexchange.com/questions/148852", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/37342/" ]
I had same problem and my solution was related with no space in disk for deployment. ps.: database disk.
I had same problem and i tried whatever was suggested in the blog. Like uninstall solution etc. Then I did a restart of system. And opened a new solution and tired to deploy. But this time the error was very clear, I got a message it was due to increase in database size. After reducing deployment worked correctly.
1,640,364
Revision of mutator method definition Write a mutator method setAge() that takes a single parameter of type int and sets the value of variable age Paste your answer in here: ``` public int setAge(int age) { return age; } ``` Comments: ``` * Test 1 (0.0 out of 1) The compilation was successful The ...
2009/10/28
[ "https://Stackoverflow.com/questions/1640364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/196341/" ]
Try with ``` public void setAge(int age) { this.age = age; } ```
Your code does not "set the value of a variable age". Your method only returns the value that was passed to it.
1,640,364
Revision of mutator method definition Write a mutator method setAge() that takes a single parameter of type int and sets the value of variable age Paste your answer in here: ``` public int setAge(int age) { return age; } ``` Comments: ``` * Test 1 (0.0 out of 1) The compilation was successful The ...
2009/10/28
[ "https://Stackoverflow.com/questions/1640364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/196341/" ]
Try with ``` public void setAge(int age) { this.age = age; } ```
Assuming you have a class variable called 'age', you can create the mutator class method as: ``` public class myTest{ public int age; //other code here..if any public void setAge(int age) { this.age = age; } //other code here.. if any } ``` Normally your setAge method should not return anything. Mutator only...
1,640,364
Revision of mutator method definition Write a mutator method setAge() that takes a single parameter of type int and sets the value of variable age Paste your answer in here: ``` public int setAge(int age) { return age; } ``` Comments: ``` * Test 1 (0.0 out of 1) The compilation was successful The ...
2009/10/28
[ "https://Stackoverflow.com/questions/1640364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/196341/" ]
Your mutator is not actually setting anything. I assume you already have a piece of code that you have to modify, search in that piece for a variable/field 'age'.
Your code does not "set the value of a variable age". Your method only returns the value that was passed to it.
1,640,364
Revision of mutator method definition Write a mutator method setAge() that takes a single parameter of type int and sets the value of variable age Paste your answer in here: ``` public int setAge(int age) { return age; } ``` Comments: ``` * Test 1 (0.0 out of 1) The compilation was successful The ...
2009/10/28
[ "https://Stackoverflow.com/questions/1640364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/196341/" ]
Your mutator is not actually setting anything. I assume you already have a piece of code that you have to modify, search in that piece for a variable/field 'age'.
Assuming you have a class variable called 'age', you can create the mutator class method as: ``` public class myTest{ public int age; //other code here..if any public void setAge(int age) { this.age = age; } //other code here.. if any } ``` Normally your setAge method should not return anything. Mutator only...
1,640,364
Revision of mutator method definition Write a mutator method setAge() that takes a single parameter of type int and sets the value of variable age Paste your answer in here: ``` public int setAge(int age) { return age; } ``` Comments: ``` * Test 1 (0.0 out of 1) The compilation was successful The ...
2009/10/28
[ "https://Stackoverflow.com/questions/1640364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/196341/" ]
Your code does not "set the value of a variable age". Your method only returns the value that was passed to it.
Assuming you have a class variable called 'age', you can create the mutator class method as: ``` public class myTest{ public int age; //other code here..if any public void setAge(int age) { this.age = age; } //other code here.. if any } ``` Normally your setAge method should not return anything. Mutator only...
214,395
I'm running through the popular python practice exercises located at github: <https://github.com/zhiwehu/Python-programming-exercises/blob/master/100%2B%20Python%20challenging%20programming%20exercises.txt> I recently discovered recursive functions. So when asked the following in the above link: ``` Question 9 Level ...
2019/02/27
[ "https://codereview.stackexchange.com/questions/214395", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/161732/" ]
Is this pythonic ? ------------------ The answer to this question is often found by doing `import this`: > > Beautiful is better than ugly. > > Explicit is better than implicit. > > Simple is better than complex. > > Complex is better than complicated. > > Flat is better than nested. > > Sparse i...
While [the answer](https://codereview.stackexchange.com/a/214407/98493) by [@BenoîtPilatte](https://codereview.stackexchange.com/users/193138/beno%C3%AEt-pilatte) is fine as long as you want to keep this a recursive solution, here is a solution using only generators. First, [Python 2 is going to be no longer supported...
2,422,071
There are $14$ more cookies than biscuits in a jar of $38$ cookies and biscuits. How many cookies are in the jar?
2017/09/08
[ "https://math.stackexchange.com/questions/2422071", "https://math.stackexchange.com", "https://math.stackexchange.com/users/478813/" ]
Solve the following system. $$x-y=14$$ and $$x+y=38$$
Think of starting with a jar of $38$ cookies and no biscuits, and turning cookies into biscuits one by one. Each time you do this you reduce the excess of cookies over biscuits by $2$. How many times would you have to do it to make that excess be $14$?
2,422,071
There are $14$ more cookies than biscuits in a jar of $38$ cookies and biscuits. How many cookies are in the jar?
2017/09/08
[ "https://math.stackexchange.com/questions/2422071", "https://math.stackexchange.com", "https://math.stackexchange.com/users/478813/" ]
Solve the following system. $$x-y=14$$ and $$x+y=38$$
A non algebraic technique useful for simpler word problems: *hypothesise*, i.e. start with *Suppose...* Suppose you removed those "extra" $14$ cookies. What's the total number of snacks now? Can you see that the remaining biscuits and cookies are now equal in number? Can you figure out how many cookies you have now...
42,977,235
I am making a script that lists the existing files in a directory,and then save them to a dictionary list. In the directory there are two types of images, "foo" and "bar", which at the end of the name have an identifier to know the position in which they should be viewed, for example: ``` foo_1.jpg foo_2.jpg foo_5.jpg...
2017/03/23
[ "https://Stackoverflow.com/questions/42977235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59468/" ]
Obviously, I don't have those files on my HD, so here's some code that processes a list of file names, but it shouldn't be hard to adapt it for your purposes. The heart of this code is a helper function `parse_name` that extracts the position (`pos`) and image type info (`kind`) from a file name. To organize that inf...
1. Try to use `filename.startswith('bar')` or `filename.startswith('foo')` to distinguish `foo_1.jpg` and `bar_1.jpg` 2. Try to use `position=int(os.path.splitext(filename)[0].split('_')[-1])` instead of `re`. --- 3. Don't use `register = {**foo_register, **bar_register}` : e.g. ``` a={'foo': '', 'bar': 'uploads/ca...
42,977,235
I am making a script that lists the existing files in a directory,and then save them to a dictionary list. In the directory there are two types of images, "foo" and "bar", which at the end of the name have an identifier to know the position in which they should be viewed, for example: ``` foo_1.jpg foo_2.jpg foo_5.jpg...
2017/03/23
[ "https://Stackoverflow.com/questions/42977235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59468/" ]
1. Try to use `filename.startswith('bar')` or `filename.startswith('foo')` to distinguish `foo_1.jpg` and `bar_1.jpg` 2. Try to use `position=int(os.path.splitext(filename)[0].split('_')[-1])` instead of `re`. --- 3. Don't use `register = {**foo_register, **bar_register}` : e.g. ``` a={'foo': '', 'bar': 'uploads/ca...
``` import os, re cwd = os.getcwd() print cwd def update(li, pos, path, key): added = False if len(li) == 0: di=dict() di["position"] = int(pos) di[key] = path li.append(di) added = True else: for di in li: if di["position"]==pos: ...
42,977,235
I am making a script that lists the existing files in a directory,and then save them to a dictionary list. In the directory there are two types of images, "foo" and "bar", which at the end of the name have an identifier to know the position in which they should be viewed, for example: ``` foo_1.jpg foo_2.jpg foo_5.jpg...
2017/03/23
[ "https://Stackoverflow.com/questions/42977235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59468/" ]
Obviously, I don't have those files on my HD, so here's some code that processes a list of file names, but it shouldn't be hard to adapt it for your purposes. The heart of this code is a helper function `parse_name` that extracts the position (`pos`) and image type info (`kind`) from a file name. To organize that inf...
``` import os, re cwd = os.getcwd() print cwd def update(li, pos, path, key): added = False if len(li) == 0: di=dict() di["position"] = int(pos) di[key] = path li.append(di) added = True else: for di in li: if di["position"]==pos: ...
38,603,176
This is for InnoDB with MySQL 5.7. If I have a query like: ``` SELECT A, B, C FROM TABLE WHERE STRCMP(D, 'somestring') > 0 ``` Is it possible to have an index on `D` which can be used by the query? i.e. is MySQL smart enough to use the btree index for STRCMP function? If not, how might I be able to redesign the qu...
2016/07/27
[ "https://Stackoverflow.com/questions/38603176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/254959/" ]
Why not just ``` WHERE D > 'somestring' ``` This would leverage a typical B-tree index on column `D`.
Mysql will not use indexes for function calls. Use below query And Create index on **D** column ``` SELECT A, B, C FROM TABLE WHERE D ='somestring' ``` to create index use the below query ``` create index index1 on TABLE(D); ```
38,603,176
This is for InnoDB with MySQL 5.7. If I have a query like: ``` SELECT A, B, C FROM TABLE WHERE STRCMP(D, 'somestring') > 0 ``` Is it possible to have an index on `D` which can be used by the query? i.e. is MySQL smart enough to use the btree index for STRCMP function? If not, how might I be able to redesign the qu...
2016/07/27
[ "https://Stackoverflow.com/questions/38603176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/254959/" ]
If you perform comparisons only by passing column values to a function such as `STRCMP()`, there is no value in indexing it. Reference: <https://dev.mysql.com/doc/refman/5.5/en/index-btree-hash.html> A B-tree index can be used for column comparisons in expressions that use the `=`, `>`, `>=`, `<`, `<=`, or `BETWEEN`...
Mysql will not use indexes for function calls. Use below query And Create index on **D** column ``` SELECT A, B, C FROM TABLE WHERE D ='somestring' ``` to create index use the below query ``` create index index1 on TABLE(D); ```
38,603,176
This is for InnoDB with MySQL 5.7. If I have a query like: ``` SELECT A, B, C FROM TABLE WHERE STRCMP(D, 'somestring') > 0 ``` Is it possible to have an index on `D` which can be used by the query? i.e. is MySQL smart enough to use the btree index for STRCMP function? If not, how might I be able to redesign the qu...
2016/07/27
[ "https://Stackoverflow.com/questions/38603176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/254959/" ]
Amazing how many wrong answers so far. Let me see if I can not join them. `STRCMP` returns -1, 0, or 1, depending on how the arguments compare. `STRCMP(D, 'somestring') > 0` is identical to `D > 'somestring'`. (Not `>=`, not `=`, not `LIKE`) Actually, there *may* be collation differences, but that can be handled if ...
Mysql will not use indexes for function calls. Use below query And Create index on **D** column ``` SELECT A, B, C FROM TABLE WHERE D ='somestring' ``` to create index use the below query ``` create index index1 on TABLE(D); ```
38,603,176
This is for InnoDB with MySQL 5.7. If I have a query like: ``` SELECT A, B, C FROM TABLE WHERE STRCMP(D, 'somestring') > 0 ``` Is it possible to have an index on `D` which can be used by the query? i.e. is MySQL smart enough to use the btree index for STRCMP function? If not, how might I be able to redesign the qu...
2016/07/27
[ "https://Stackoverflow.com/questions/38603176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/254959/" ]
Why not just ``` WHERE D > 'somestring' ``` This would leverage a typical B-tree index on column `D`.
If you perform comparisons only by passing column values to a function such as `STRCMP()`, there is no value in indexing it. Reference: <https://dev.mysql.com/doc/refman/5.5/en/index-btree-hash.html> A B-tree index can be used for column comparisons in expressions that use the `=`, `>`, `>=`, `<`, `<=`, or `BETWEEN`...
38,603,176
This is for InnoDB with MySQL 5.7. If I have a query like: ``` SELECT A, B, C FROM TABLE WHERE STRCMP(D, 'somestring') > 0 ``` Is it possible to have an index on `D` which can be used by the query? i.e. is MySQL smart enough to use the btree index for STRCMP function? If not, how might I be able to redesign the qu...
2016/07/27
[ "https://Stackoverflow.com/questions/38603176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/254959/" ]
Amazing how many wrong answers so far. Let me see if I can not join them. `STRCMP` returns -1, 0, or 1, depending on how the arguments compare. `STRCMP(D, 'somestring') > 0` is identical to `D > 'somestring'`. (Not `>=`, not `=`, not `LIKE`) Actually, there *may* be collation differences, but that can be handled if ...
Why not just ``` WHERE D > 'somestring' ``` This would leverage a typical B-tree index on column `D`.
38,603,176
This is for InnoDB with MySQL 5.7. If I have a query like: ``` SELECT A, B, C FROM TABLE WHERE STRCMP(D, 'somestring') > 0 ``` Is it possible to have an index on `D` which can be used by the query? i.e. is MySQL smart enough to use the btree index for STRCMP function? If not, how might I be able to redesign the qu...
2016/07/27
[ "https://Stackoverflow.com/questions/38603176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/254959/" ]
Amazing how many wrong answers so far. Let me see if I can not join them. `STRCMP` returns -1, 0, or 1, depending on how the arguments compare. `STRCMP(D, 'somestring') > 0` is identical to `D > 'somestring'`. (Not `>=`, not `=`, not `LIKE`) Actually, there *may* be collation differences, but that can be handled if ...
If you perform comparisons only by passing column values to a function such as `STRCMP()`, there is no value in indexing it. Reference: <https://dev.mysql.com/doc/refman/5.5/en/index-btree-hash.html> A B-tree index can be used for column comparisons in expressions that use the `=`, `>`, `>=`, `<`, `<=`, or `BETWEEN`...
24,488,839
I'm using a jquery slider plugin and I have it working (new to jquery/css/html), but when I try to center the slider it breaks. The red dot that moves around the circle does not center along with the pictures? I'd like to understand why this is and how can it be fixed? Thank you very much. <http://jsfiddle.net/asQL9/>...
2014/06/30
[ "https://Stackoverflow.com/questions/24488839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1009762/" ]
Looks like you built all of the dependencies outside of the gcc packaging. Included is a script that will gather all of the dependencies into the gcc packaging and include them as part of the gcc build: ``` gcc-4.9.0/contrib/download_prerequisites ``` That should simplify your initial configuration. Not sure what c...
Two problems: First, you should never build the compiler in the source directory. It might appear to work, sometimes, but it's not supported and the compiler developers don't do that, so you shouldn't. Create an external `obj` directory, and build there: ``` mkdir obj cd obj /path/to/src/configure ...blah...blah...bl...
18,962
In Western Europe, we currently have a long spell of warm and dry weather. The perfect moment to combine sunbathing with working from home. However, outside in the sun, the legibility of my laptop screen is greatly reduced when compared to inside the house/office, even when I maximize the display's brightness. Are ther...
2018/07/28
[ "https://lifehacks.stackexchange.com/questions/18962", "https://lifehacks.stackexchange.com", "https://lifehacks.stackexchange.com/users/5345/" ]
I forgot where I saw/heard this tip, but I'm often using a [cardboard](https://en.wikipedia.org/wiki/Cardboard) box slightly larger than the laptop to provide shade on the display. At least for me, this makes it more legible. An additional benefit is that this also reduces the amount of sunlight on the laptop, which ke...
The cardboard box suggested by Glorfindel, and improved upon by Stan's comment, is fantastic. I have another suggestion that can be used with the box or by itself. Wear a dark shirt, and make sure whatever is behind you is dark. (A wall, a shaded forest, etc.) Much of the reason you can't see the screen is because of ...
18,962
In Western Europe, we currently have a long spell of warm and dry weather. The perfect moment to combine sunbathing with working from home. However, outside in the sun, the legibility of my laptop screen is greatly reduced when compared to inside the house/office, even when I maximize the display's brightness. Are ther...
2018/07/28
[ "https://lifehacks.stackexchange.com/questions/18962", "https://lifehacks.stackexchange.com", "https://lifehacks.stackexchange.com/users/5345/" ]
I forgot where I saw/heard this tip, but I'm often using a [cardboard](https://en.wikipedia.org/wiki/Cardboard) box slightly larger than the laptop to provide shade on the display. At least for me, this makes it more legible. An additional benefit is that this also reduces the amount of sunlight on the laptop, which ke...
To increase the legibility of a computer screen, arrangement should be made to control the fall of run rays directly on the computer screen. This can be done by covering the top of the computer by some wooden surface or cloth , in such a way that the area of the wooden surface or the cloth is more than the area of the ...
18,962
In Western Europe, we currently have a long spell of warm and dry weather. The perfect moment to combine sunbathing with working from home. However, outside in the sun, the legibility of my laptop screen is greatly reduced when compared to inside the house/office, even when I maximize the display's brightness. Are ther...
2018/07/28
[ "https://lifehacks.stackexchange.com/questions/18962", "https://lifehacks.stackexchange.com", "https://lifehacks.stackexchange.com/users/5345/" ]
I forgot where I saw/heard this tip, but I'm often using a [cardboard](https://en.wikipedia.org/wiki/Cardboard) box slightly larger than the laptop to provide shade on the display. At least for me, this makes it more legible. An additional benefit is that this also reduces the amount of sunlight on the laptop, which ke...
In my experience many command line users have bright font on dark background terminal emulators (usually white on black, or matrix-movie green on black), while in bright environments (e.g. outside work), a dark font on a bright background is more legible (black on white). Of cause this mainly addresses command line us...
18,962
In Western Europe, we currently have a long spell of warm and dry weather. The perfect moment to combine sunbathing with working from home. However, outside in the sun, the legibility of my laptop screen is greatly reduced when compared to inside the house/office, even when I maximize the display's brightness. Are ther...
2018/07/28
[ "https://lifehacks.stackexchange.com/questions/18962", "https://lifehacks.stackexchange.com", "https://lifehacks.stackexchange.com/users/5345/" ]
The cardboard box suggested by Glorfindel, and improved upon by Stan's comment, is fantastic. I have another suggestion that can be used with the box or by itself. Wear a dark shirt, and make sure whatever is behind you is dark. (A wall, a shaded forest, etc.) Much of the reason you can't see the screen is because of ...
To increase the legibility of a computer screen, arrangement should be made to control the fall of run rays directly on the computer screen. This can be done by covering the top of the computer by some wooden surface or cloth , in such a way that the area of the wooden surface or the cloth is more than the area of the ...
18,962
In Western Europe, we currently have a long spell of warm and dry weather. The perfect moment to combine sunbathing with working from home. However, outside in the sun, the legibility of my laptop screen is greatly reduced when compared to inside the house/office, even when I maximize the display's brightness. Are ther...
2018/07/28
[ "https://lifehacks.stackexchange.com/questions/18962", "https://lifehacks.stackexchange.com", "https://lifehacks.stackexchange.com/users/5345/" ]
In my experience many command line users have bright font on dark background terminal emulators (usually white on black, or matrix-movie green on black), while in bright environments (e.g. outside work), a dark font on a bright background is more legible (black on white). Of cause this mainly addresses command line us...
To increase the legibility of a computer screen, arrangement should be made to control the fall of run rays directly on the computer screen. This can be done by covering the top of the computer by some wooden surface or cloth , in such a way that the area of the wooden surface or the cloth is more than the area of the ...
56,854,273
I am trying to write a piece of code that plots a list of markers on a map. The markers are formatted by longitude and latitude: ``` trip_markers[0:4]: [[40.64499, -73.78115], [40.766931, -73.982098], [40.77773, -73.951902], [40.795678, -73.971049]] ``` I am trying to write a function that iterates through this ...
2019/07/02
[ "https://Stackoverflow.com/questions/56854273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11664078/" ]
I suggest using *Linq*, [GroupBy](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.groupby?view=netframework-4.8): ``` using System.Linq; ... // No Sequential Order test var _entries = new List<string>() { "Awesom", "Bar", "Awesom", "Awesom", "Foo", "Awesom", "Bar", }; in...
When you say *This one compares in sequential order but it should compare with every possible scenario.* I believe you are expecting value of **count = 16**. As by comparing with every possible values you'll have 16 combinations and as all the values are equal you'll get count as 16. ``` var _entries = new...
13,643,706
I'm working on a asp.net page and I have several buttons in my page, some of them are asp.net buttons, other are HTML `input[type=button]` elements. HTML buttons are used to make AJAX calls. When the user press ENTER I need to set as default button one of these HTML buttons, but at the moment the first button in the p...
2012/11/30
[ "https://Stackoverflow.com/questions/13643706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1061499/" ]
read this article <http://www.codeproject.com/Articles/35180/How-To-set-Default-Button-for-ENTER-key-pressed-ev> you can use it in somewhat this way ``` <form id="form1" runat="server" defaultbutton="Button1" > ```
Can you not put the form inside a panel and use the defaultbutton property ``` <asp:Panel runat="server" DefaultButton="btnSomething"> ... </asp:Panel> ```
13,643,706
I'm working on a asp.net page and I have several buttons in my page, some of them are asp.net buttons, other are HTML `input[type=button]` elements. HTML buttons are used to make AJAX calls. When the user press ENTER I need to set as default button one of these HTML buttons, but at the moment the first button in the p...
2012/11/30
[ "https://Stackoverflow.com/questions/13643706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1061499/" ]
Try this : ``` // JavaScript Code var body = document.getElementsByTagName('body')[0]; body.onkeydown = function (e) { if (e.keyCode === 13) { //enter key code // call your html button onclick code here } } ```
Can you not put the form inside a panel and use the defaultbutton property ``` <asp:Panel runat="server" DefaultButton="btnSomething"> ... </asp:Panel> ```
13,643,706
I'm working on a asp.net page and I have several buttons in my page, some of them are asp.net buttons, other are HTML `input[type=button]` elements. HTML buttons are used to make AJAX calls. When the user press ENTER I need to set as default button one of these HTML buttons, but at the moment the first button in the p...
2012/11/30
[ "https://Stackoverflow.com/questions/13643706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1061499/" ]
I'm using JQuery, so I modified the code in the **Mohit Pandey** answer: ``` $("body").keypress(function (event) { if (event.which == 13) { event.preventDefault(); // my function } }); ```
Can you not put the form inside a panel and use the defaultbutton property ``` <asp:Panel runat="server" DefaultButton="btnSomething"> ... </asp:Panel> ```
13,643,706
I'm working on a asp.net page and I have several buttons in my page, some of them are asp.net buttons, other are HTML `input[type=button]` elements. HTML buttons are used to make AJAX calls. When the user press ENTER I need to set as default button one of these HTML buttons, but at the moment the first button in the p...
2012/11/30
[ "https://Stackoverflow.com/questions/13643706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1061499/" ]
Try this : ``` // JavaScript Code var body = document.getElementsByTagName('body')[0]; body.onkeydown = function (e) { if (e.keyCode === 13) { //enter key code // call your html button onclick code here } } ```
read this article <http://www.codeproject.com/Articles/35180/How-To-set-Default-Button-for-ENTER-key-pressed-ev> you can use it in somewhat this way ``` <form id="form1" runat="server" defaultbutton="Button1" > ```
13,643,706
I'm working on a asp.net page and I have several buttons in my page, some of them are asp.net buttons, other are HTML `input[type=button]` elements. HTML buttons are used to make AJAX calls. When the user press ENTER I need to set as default button one of these HTML buttons, but at the moment the first button in the p...
2012/11/30
[ "https://Stackoverflow.com/questions/13643706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1061499/" ]
I'm using JQuery, so I modified the code in the **Mohit Pandey** answer: ``` $("body").keypress(function (event) { if (event.which == 13) { event.preventDefault(); // my function } }); ```
read this article <http://www.codeproject.com/Articles/35180/How-To-set-Default-Button-for-ENTER-key-pressed-ev> you can use it in somewhat this way ``` <form id="form1" runat="server" defaultbutton="Button1" > ```
13,643,706
I'm working on a asp.net page and I have several buttons in my page, some of them are asp.net buttons, other are HTML `input[type=button]` elements. HTML buttons are used to make AJAX calls. When the user press ENTER I need to set as default button one of these HTML buttons, but at the moment the first button in the p...
2012/11/30
[ "https://Stackoverflow.com/questions/13643706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1061499/" ]
Try this : ``` // JavaScript Code var body = document.getElementsByTagName('body')[0]; body.onkeydown = function (e) { if (e.keyCode === 13) { //enter key code // call your html button onclick code here } } ```
I'm using JQuery, so I modified the code in the **Mohit Pandey** answer: ``` $("body").keypress(function (event) { if (event.which == 13) { event.preventDefault(); // my function } }); ```
72,884,629
``` <button type="button" class="action-oser" id="click-vlink2"> <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24"><path d="M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm-3 18v-12...
2022/07/06
[ "https://Stackoverflow.com/questions/72884629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15602105/" ]
add a [`style=""`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/style) attribute in the `<iframe>` with this css code `max-width: 100%;` [![enter image description here](https://i.stack.imgur.com/e5UBp.gif)](https://i.stack.imgur.com/e5UBp.gif) > > this means that the video iframe in mobile a...
i guess this can help you. ``` @media screen and (max-width: 750px) { iframe { max-width: 100% !important; width: auto !important; height: auto !important; } } ``` and for more solution example visit : <https://www.h3xed.com/web-development/how-to-make-a-responsive-100-width-youtube-ifra...
47,187,115
I need to only use every other number in a string of numbers. This is how the xml file content comes to us, but I only want to use The first group and then every other group. The second number in each group can be ignored. The most important number are the first like 1,3,5 and 29 Can you help? Each group equals “x”:”x”...
2017/11/08
[ "https://Stackoverflow.com/questions/47187115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8908858/" ]
You're probably looking for something like **[jdkapidiff](https://github.com/gunnarmorling/jdkapidiff)** which uses *[japicmp](https://github.com/siom79/japicmp)* to generate reports similar to one hosted here by the author - [jdk8-jdk9-api-diff.](https://gunnarmorling.github.io/jdkapidiff/jdk8-jdk9-api-diff.html) You...
There are many changes to existing classes and members, in addition to new @since 9 classes and members. The final release of JSR 379 include an annex with the complete set of diffs. The draft is online here: <http://cr.openjdk.java.net/~iris/se/9/java-se-9-fr-spec-01/apidiffs/overview-summary.html>
16,653,016
Been scratching my head over this one. I have a URL format I need to redirect and only need one part of the querystring. Example URL: > > tiles?shape=&colour=&finish=&material=&price=&o=60&tile=50-double-roman-antique-red-03-granular > > > All I need from this is the value of the tile parameter (50-double-roman-a...
2013/05/20
[ "https://Stackoverflow.com/questions/16653016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1105816/" ]
My problems: There is a scrollView with many buttons (items). Above it there are 2 function buttons (return, start). 1. When I scroll down item buttons overlie function buttons. When I swallow all touches above my scrollview I will lose my function buttons. So I have to find another solution. 2. When I start draging s...
Inspired by Tomasz's answer, I created an alternative solution, also inheriting from `CCControlButton`: ``` bool ScrollableButton::isTouchInside(CCTouch *touch) { return !dragging && CCControlButton::isTouchInside(touch); } bool ScrollableButton::ccTouchBegan(CCTouch *touch, CCEvent *event) { dragging = false; ...
5,690,512
What's the difference between `|` and `||` in Javascript? Furthermore, what's the difference between `&` and `&&`?
2011/04/17
[ "https://Stackoverflow.com/questions/5690512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/710598/" ]
Another difference is that `||` uses shortcut evaluation. That is, it only evaluates the right side if the left side is `false` (or gets converted to false in a boolean context, e.g. `0`, `""`, `null`, etc.). Similarly, `&&` only evaluates the right side if the left side is `true` (or non-zero, non-empty string, an obj...
In Javascript perspective, there is more to it. ``` var a = 42; var b = "abc"; var c = null; a || b; // 42 a && b; // "abc" c || b; // "abc" c && b; // null ``` Both || and && operators perform a boolean test on the first operand (a or c). If the operand is not already boolean (as it's not, here), ...
5,690,512
What's the difference between `|` and `||` in Javascript? Furthermore, what's the difference between `&` and `&&`?
2011/04/17
[ "https://Stackoverflow.com/questions/5690512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/710598/" ]
In Javascript perspective, there is more to it. ``` var a = 42; var b = "abc"; var c = null; a || b; // 42 a && b; // "abc" c || b; // "abc" c && b; // null ``` Both || and && operators perform a boolean test on the first operand (a or c). If the operand is not already boolean (as it's not, here), ...
one more point i want to add is || operator is used to assign default value in case the value you are assigning is undefined. So for Exapmle you are assigning a obj to some object test and if you dont want test to be undefined then you can do the following to ensure that value of test wont be undefined. var test = obj...
5,690,512
What's the difference between `|` and `||` in Javascript? Furthermore, what's the difference between `&` and `&&`?
2011/04/17
[ "https://Stackoverflow.com/questions/5690512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/710598/" ]
`|` is a bitwise or, `||` is a logical or. A bitwise or takes the two numbers and compares them on a bit-by-bit basis, producing a new integer which combines the 1 bits from both inputs. So `0101 | 1010` would produce `1111`. A logical or `||` checks for the "truthiness" of a value (depends on the type, for integer...
To explain a little more in layman's terms: `&&` and `||` are *logical* operators. This means they're used for logical comparison; ``` if (a == 4 && b == 5) ``` This means "If a equals to four AND b equals to five" `|` and `&` are *bitwise* operators. They operate on bits in a specific fashion which the wiki artic...
5,690,512
What's the difference between `|` and `||` in Javascript? Furthermore, what's the difference between `&` and `&&`?
2011/04/17
[ "https://Stackoverflow.com/questions/5690512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/710598/" ]
* `&` is [the bitwise AND operator](http://rx4ajax-jscore.com/resource/glossary/glossb.html#bitwise_and_operator) * `|` is [the bitwise OR operator](http://rx4ajax-jscore.com/resource/glossary/glossb.html#bitwise_or_operator) * `&&` is [the logical AND operator](http://www.devguru.com/technologies/ecmascript/quickref/l...
Single | is bit wise OR operator . If you do 2 | 3 , it converts to binary and performs OR operation. 01 11 Results in 11 equal to 3. Where as || operator checks if first argument is true, if it is true it returns else it goes to other operator. 2 || 3 returns 2 since 2 is true.
5,690,512
What's the difference between `|` and `||` in Javascript? Furthermore, what's the difference between `&` and `&&`?
2011/04/17
[ "https://Stackoverflow.com/questions/5690512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/710598/" ]
* `&` is [the bitwise AND operator](http://rx4ajax-jscore.com/resource/glossary/glossb.html#bitwise_and_operator) * `|` is [the bitwise OR operator](http://rx4ajax-jscore.com/resource/glossary/glossb.html#bitwise_or_operator) * `&&` is [the logical AND operator](http://www.devguru.com/technologies/ecmascript/quickref/l...
Another difference is that `||` uses shortcut evaluation. That is, it only evaluates the right side if the left side is `false` (or gets converted to false in a boolean context, e.g. `0`, `""`, `null`, etc.). Similarly, `&&` only evaluates the right side if the left side is `true` (or non-zero, non-empty string, an obj...
5,690,512
What's the difference between `|` and `||` in Javascript? Furthermore, what's the difference between `&` and `&&`?
2011/04/17
[ "https://Stackoverflow.com/questions/5690512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/710598/" ]
* `&` is [the bitwise AND operator](http://rx4ajax-jscore.com/resource/glossary/glossb.html#bitwise_and_operator) * `|` is [the bitwise OR operator](http://rx4ajax-jscore.com/resource/glossary/glossb.html#bitwise_or_operator) * `&&` is [the logical AND operator](http://www.devguru.com/technologies/ecmascript/quickref/l...
one more point i want to add is || operator is used to assign default value in case the value you are assigning is undefined. So for Exapmle you are assigning a obj to some object test and if you dont want test to be undefined then you can do the following to ensure that value of test wont be undefined. var test = obj...
5,690,512
What's the difference between `|` and `||` in Javascript? Furthermore, what's the difference between `&` and `&&`?
2011/04/17
[ "https://Stackoverflow.com/questions/5690512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/710598/" ]
Another difference is that `||` uses shortcut evaluation. That is, it only evaluates the right side if the left side is `false` (or gets converted to false in a boolean context, e.g. `0`, `""`, `null`, etc.). Similarly, `&&` only evaluates the right side if the left side is `true` (or non-zero, non-empty string, an obj...
Single | is bit wise OR operator . If you do 2 | 3 , it converts to binary and performs OR operation. 01 11 Results in 11 equal to 3. Where as || operator checks if first argument is true, if it is true it returns else it goes to other operator. 2 || 3 returns 2 since 2 is true.
5,690,512
What's the difference between `|` and `||` in Javascript? Furthermore, what's the difference between `&` and `&&`?
2011/04/17
[ "https://Stackoverflow.com/questions/5690512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/710598/" ]
`|` is a bitwise or, `||` is a logical or. A bitwise or takes the two numbers and compares them on a bit-by-bit basis, producing a new integer which combines the 1 bits from both inputs. So `0101 | 1010` would produce `1111`. A logical or `||` checks for the "truthiness" of a value (depends on the type, for integer...
* `&` is [the bitwise AND operator](http://rx4ajax-jscore.com/resource/glossary/glossb.html#bitwise_and_operator) * `|` is [the bitwise OR operator](http://rx4ajax-jscore.com/resource/glossary/glossb.html#bitwise_or_operator) * `&&` is [the logical AND operator](http://www.devguru.com/technologies/ecmascript/quickref/l...
5,690,512
What's the difference between `|` and `||` in Javascript? Furthermore, what's the difference between `&` and `&&`?
2011/04/17
[ "https://Stackoverflow.com/questions/5690512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/710598/" ]
To explain a little more in layman's terms: `&&` and `||` are *logical* operators. This means they're used for logical comparison; ``` if (a == 4 && b == 5) ``` This means "If a equals to four AND b equals to five" `|` and `&` are *bitwise* operators. They operate on bits in a specific fashion which the wiki artic...
one more point i want to add is || operator is used to assign default value in case the value you are assigning is undefined. So for Exapmle you are assigning a obj to some object test and if you dont want test to be undefined then you can do the following to ensure that value of test wont be undefined. var test = obj...
5,690,512
What's the difference between `|` and `||` in Javascript? Furthermore, what's the difference between `&` and `&&`?
2011/04/17
[ "https://Stackoverflow.com/questions/5690512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/710598/" ]
* `&` is [the bitwise AND operator](http://rx4ajax-jscore.com/resource/glossary/glossb.html#bitwise_and_operator) * `|` is [the bitwise OR operator](http://rx4ajax-jscore.com/resource/glossary/glossb.html#bitwise_or_operator) * `&&` is [the logical AND operator](http://www.devguru.com/technologies/ecmascript/quickref/l...
In Javascript perspective, there is more to it. ``` var a = 42; var b = "abc"; var c = null; a || b; // 42 a && b; // "abc" c || b; // "abc" c && b; // null ``` Both || and && operators perform a boolean test on the first operand (a or c). If the operand is not already boolean (as it's not, here), ...
6,922,365
I have a web part that for new and edit functionality for custom list. I need a cancel button on it same as ``` <SharePoint:SaveButton /> ``` tag outputs the default save button in sharepoint.
2011/08/03
[ "https://Stackoverflow.com/questions/6922365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/314230/" ]
You can do: ``` <HTML dir="RTL"> ``` To make things attach to the right. For top to bottom you'd have to do that yourself, or in a script. Just for fun I'll see if I can write something using jQuery. I'll post it here. Try this: ``` function rev(el) { $('>*', el).each(function () { rev(this); $(this).p...
Oh, that's rather easy if you are using a laptop or a tablet. If you have a desktop, however, it can be harder to get the display to stay upright. Sometimes duct tape and some creative woodwork can help. If your monitor is attached, however, then no. HTML always renders from the top down.
35,224,575
I have ansible (v2.0.0.2) and python (v2.7.6) and i'm running the 'maven\_artifact' module. As a direct ansible command, it works fine ``` ansible localhost -m maven_artifact -a "group_id=commons-collections artifact_id=commons-collections dest=/tmp/commons-collections-latest.jar" -vvvv ``` but when i do the same v...
2016/02/05
[ "https://Stackoverflow.com/questions/35224575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55794/" ]
It seems that ansible was trying to execute the 'maven\_artifact' command on the remote target host, which didn't have the required python libraries. In my case I only wanted to run the command on the local 'ansible\_host' so I just added the 'local\_action' prefix and the command runs. ``` - name: download via maven...
Just do > > sudo apt-get install python-lxml > > >
35,224,575
I have ansible (v2.0.0.2) and python (v2.7.6) and i'm running the 'maven\_artifact' module. As a direct ansible command, it works fine ``` ansible localhost -m maven_artifact -a "group_id=commons-collections artifact_id=commons-collections dest=/tmp/commons-collections-latest.jar" -vvvv ``` but when i do the same v...
2016/02/05
[ "https://Stackoverflow.com/questions/35224575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55794/" ]
It seems that ansible was trying to execute the 'maven\_artifact' command on the remote target host, which didn't have the required python libraries. In my case I only wanted to run the command on the local 'ansible\_host' so I just added the 'local\_action' prefix and the command runs. ``` - name: download via maven...
You need to install lxml in [test01vm1]. ``` pip install lxml ```
35,224,575
I have ansible (v2.0.0.2) and python (v2.7.6) and i'm running the 'maven\_artifact' module. As a direct ansible command, it works fine ``` ansible localhost -m maven_artifact -a "group_id=commons-collections artifact_id=commons-collections dest=/tmp/commons-collections-latest.jar" -vvvv ``` but when i do the same v...
2016/02/05
[ "https://Stackoverflow.com/questions/35224575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55794/" ]
It seems that ansible was trying to execute the 'maven\_artifact' command on the remote target host, which didn't have the required python libraries. In my case I only wanted to run the command on the local 'ansible\_host' so I just added the 'local\_action' prefix and the command runs. ``` - name: download via maven...
Verify that target machine has python lxml module, and ansible selects the python interpreter where you have installed the lxml module. ``` [ec2-user@i-05f345345aas6b bin]$ pip list | grep xml lxml 3.2.1 ``` And then double check that ansible picks that python version by adding: ``` ansible_python_interp...
35,224,575
I have ansible (v2.0.0.2) and python (v2.7.6) and i'm running the 'maven\_artifact' module. As a direct ansible command, it works fine ``` ansible localhost -m maven_artifact -a "group_id=commons-collections artifact_id=commons-collections dest=/tmp/commons-collections-latest.jar" -vvvv ``` but when i do the same v...
2016/02/05
[ "https://Stackoverflow.com/questions/35224575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55794/" ]
What I usually do is to call: ``` - name: Install PIP apt: name=python-pip state=present - name: Install lxml pip: name=lxml ```
Just do > > sudo apt-get install python-lxml > > >
35,224,575
I have ansible (v2.0.0.2) and python (v2.7.6) and i'm running the 'maven\_artifact' module. As a direct ansible command, it works fine ``` ansible localhost -m maven_artifact -a "group_id=commons-collections artifact_id=commons-collections dest=/tmp/commons-collections-latest.jar" -vvvv ``` but when i do the same v...
2016/02/05
[ "https://Stackoverflow.com/questions/35224575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55794/" ]
What I usually do is to call: ``` - name: Install PIP apt: name=python-pip state=present - name: Install lxml pip: name=lxml ```
You need to install lxml in [test01vm1]. ``` pip install lxml ```
35,224,575
I have ansible (v2.0.0.2) and python (v2.7.6) and i'm running the 'maven\_artifact' module. As a direct ansible command, it works fine ``` ansible localhost -m maven_artifact -a "group_id=commons-collections artifact_id=commons-collections dest=/tmp/commons-collections-latest.jar" -vvvv ``` but when i do the same v...
2016/02/05
[ "https://Stackoverflow.com/questions/35224575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55794/" ]
What I usually do is to call: ``` - name: Install PIP apt: name=python-pip state=present - name: Install lxml pip: name=lxml ```
Verify that target machine has python lxml module, and ansible selects the python interpreter where you have installed the lxml module. ``` [ec2-user@i-05f345345aas6b bin]$ pip list | grep xml lxml 3.2.1 ``` And then double check that ansible picks that python version by adding: ``` ansible_python_interp...
35,224,575
I have ansible (v2.0.0.2) and python (v2.7.6) and i'm running the 'maven\_artifact' module. As a direct ansible command, it works fine ``` ansible localhost -m maven_artifact -a "group_id=commons-collections artifact_id=commons-collections dest=/tmp/commons-collections-latest.jar" -vvvv ``` but when i do the same v...
2016/02/05
[ "https://Stackoverflow.com/questions/35224575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55794/" ]
Just do > > sudo apt-get install python-lxml > > >
You need to install lxml in [test01vm1]. ``` pip install lxml ```
35,224,575
I have ansible (v2.0.0.2) and python (v2.7.6) and i'm running the 'maven\_artifact' module. As a direct ansible command, it works fine ``` ansible localhost -m maven_artifact -a "group_id=commons-collections artifact_id=commons-collections dest=/tmp/commons-collections-latest.jar" -vvvv ``` but when i do the same v...
2016/02/05
[ "https://Stackoverflow.com/questions/35224575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55794/" ]
Just do > > sudo apt-get install python-lxml > > >
Verify that target machine has python lxml module, and ansible selects the python interpreter where you have installed the lxml module. ``` [ec2-user@i-05f345345aas6b bin]$ pip list | grep xml lxml 3.2.1 ``` And then double check that ansible picks that python version by adding: ``` ansible_python_interp...
34,381,239
In my form i have about 36 buttons and for each i have the following code ``` button3.BackColor = Color.DarkGreen; button_click("A1"); button3.Enabled = false; nr_l++; textBox4.Text = Convert.ToString(nr_l); ``` which means I will have this code x 36 times, I want to make a me...
2015/12/20
[ "https://Stackoverflow.com/questions/34381239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5562950/" ]
You're correct, `a.f()` is not a constant expression. And variable length arrays are not allowed by the c++ standard. The GNU compiler, however, supports them as a [language extension](https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html). You can ask the compiler to give you a warning when you use non-standard exte...
The following non-standard code ``` int x = std::rand(); int r[x] = { 1,2,3 }; ``` compiles under g++, not because `g++` mistakenly treats `std::rand()` as a constant expression, but because it implements VLAs by default. Use `-pedantic` or `-Wvla` to warn about them, `-Werror=vla` to turn these warnings into errors...
48,566,174
I've googled and googled and either google is failing me or you can't do this. This warning comes up when you turn on `-Wpedantic`... > > ISO C++ forbids zero-size array ‘variable’ [-Wpedantic] > > > I want to turn off this one warning, not all pedantic warnings. Normally, I'd just add `-Wno-xyz` but I can't find...
2018/02/01
[ "https://Stackoverflow.com/questions/48566174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12386/" ]
The good news: You *can* do this. The bad news: You can't use any commandline option. The `[-Wpedantic]` at the end of the diagnostic tells you that `-Wno-pedantic` is the narrowest option that will disable the diagnostic, and that's no use to you if you want to preserve all other pedantic diagnostics. You'll have to ...
Well, you can use a pragma to disable it, but if you want to be portable, you can use a zero-size `std::array` instead: ``` #include <array> //... std::array<int, 0> ar; ``` Using `std::array` over plain arrays is recommended anyway.