qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
38,114,832 | I'm currently setting up Keycloak to offer protection for some services. There will be both external customers and internal services consuming the same endpoints on my services.
Can I set the token expiry on a user or role or client level, or use a mix of tokens and Basic auth? | 2016/06/30 | [
"https://Stackoverflow.com/questions/38114832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/921713/"
] | It is possible to configure a different lifespan for access tokens on a per client basis. In Keycloak admin console go to a client settings page and expand the "Advanced Settings" section.
This screenshot is taken from Keycloak **4.8.1.Final**.
[](... | [](https://i.stack.imgur.com/rkKOE.png)
It can be done on realm only, correctly mentioned by @maslick as Keycloak do SSO and expects multiple clients in one realm.
Although, you can code accordingly in your application picking the Keycloak session if... |
55,801,893 | I'm building a ReactJS search component for data filtering through search.
The idea is that the user types a word, letter after letter, and the system will filter all registers containing that word. The basic component is detailed below:
```
class SearchInput extends Component {
static propTypes = {
onKe... | 2019/04/22 | [
"https://Stackoverflow.com/questions/55801893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2697571/"
] | It is not necessary to commit prior to making the query again. As a general principle, updates within a transaction (session) will be visible to subsequent queries in that same transaction, even prior to a commit.
Having said that, doing the same exact query twice within a transaction might be "code smell". It's worth... | It's not necessary to do both commits, as each transaction is visible to subsequent actions in the database (or queries).
You can just put the commit at the end, although I am not sure if multiple commits will affect runtime. |
63,333,088 | I'm developing a game in libgdx and I'm using an external jar to work with JSON, and I know libgdx has it's own but I've worked with this jar before and I know how to use it. Anyways I added it to my build.gradle in my root directory and synced. But now when I try to build the project, I get this big error message:
``... | 2020/08/10 | [
"https://Stackoverflow.com/questions/63333088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13457242/"
] | So why is your LCP a `p` tag?
Its only on mobile a p tag, and here take a look at the mobile size.
[](https://i.stack.imgur.com/WHn1L.png)
Its clearly to see that the `p` tag takes the most place here.
You could try to make the image bigger on mobi... | There are some Gatsby users complaining recently about a huge fall and decreasing of Lighthouse score and everyone agrees on the same: the score of the Lighthouse has decreased a lot due to a high LCP (Largest Contentful Paint) response time.
This is the result of the changes in the [new Lighthouse version (v6)](https... |
63,333,088 | I'm developing a game in libgdx and I'm using an external jar to work with JSON, and I know libgdx has it's own but I've worked with this jar before and I know how to use it. Anyways I added it to my build.gradle in my root directory and synced. But now when I try to build the project, I get this big error message:
``... | 2020/08/10 | [
"https://Stackoverflow.com/questions/63333088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13457242/"
] | People seems to completely misunderstand the purpose of the Largest Contentful Paint metric. It is designed to show you when the majority of the above the fold content is ready.
**What** item is the Largest Contentful Paint is not as important as **when** it occurs. **What** item is only useful in determining what cou... | There are some Gatsby users complaining recently about a huge fall and decreasing of Lighthouse score and everyone agrees on the same: the score of the Lighthouse has decreased a lot due to a high LCP (Largest Contentful Paint) response time.
This is the result of the changes in the [new Lighthouse version (v6)](https... |
63,333,088 | I'm developing a game in libgdx and I'm using an external jar to work with JSON, and I know libgdx has it's own but I've worked with this jar before and I know how to use it. Anyways I added it to my build.gradle in my root directory and synced. But now when I try to build the project, I get this big error message:
``... | 2020/08/10 | [
"https://Stackoverflow.com/questions/63333088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13457242/"
] | People seems to completely misunderstand the purpose of the Largest Contentful Paint metric. It is designed to show you when the majority of the above the fold content is ready.
**What** item is the Largest Contentful Paint is not as important as **when** it occurs. **What** item is only useful in determining what cou... | So why is your LCP a `p` tag?
Its only on mobile a p tag, and here take a look at the mobile size.
[](https://i.stack.imgur.com/WHn1L.png)
Its clearly to see that the `p` tag takes the most place here.
You could try to make the image bigger on mobi... |
7,995,085 | I have a program which is alerting the user. But right now it is only allerting on the default audio device. That is a problem if the user has pluged in a headset but don't wear it. So my question is: "***Is it possible to set the allert sound to all audio devices instead of the default device only?"***
I am programmi... | 2011/11/03 | [
"https://Stackoverflow.com/questions/7995085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1012636/"
] | Ok but I like to use this way, so that whenever original image is not available you can load your default image that may be your favorite smiley or image saying Sorry ! Not Available, But in case if both the images are missing you can use text to display. where you can also you smiley then. have a look almost covers ev... | Try using `border=0` in the `img` tag to make the ugly square go away.
`<img src="someimage.png" border="0" alt="some alternate text" />` |
7,995,085 | I have a program which is alerting the user. But right now it is only allerting on the default audio device. That is a problem if the user has pluged in a headset but don't wear it. So my question is: "***Is it possible to set the allert sound to all audio devices instead of the default device only?"***
I am programmi... | 2011/11/03 | [
"https://Stackoverflow.com/questions/7995085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1012636/"
] | You can show an alternative text by adding `alt`:
```
<img src="my_img.png" alt="alternative text" border="0" />
``` | Solution - I removed the height and width elements of the img and then the alt text worked.
```
<img src="smiley.gif" alt="Smiley face" width="32" height="32" />
```
TO
```
<img src="smiley.gif" alt="Smiley face" />
```
Thank you all. |
7,995,085 | I have a program which is alerting the user. But right now it is only allerting on the default audio device. That is a problem if the user has pluged in a headset but don't wear it. So my question is: "***Is it possible to set the allert sound to all audio devices instead of the default device only?"***
I am programmi... | 2011/11/03 | [
"https://Stackoverflow.com/questions/7995085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1012636/"
] | For the alternative, if the image doesn't exist - show nothing at all. (what I was looking for)
You can swap the function from Robby Shaw's answer in the "onerror" attribute to "this.remove()".
```html
<img id="currentPhoto" src="SomeImage.jpg" alt='1' width="100" height="120">
<img id="currentPhoto" src="SomeImage.... | simple way to handle this, just add an background image. |
7,995,085 | I have a program which is alerting the user. But right now it is only allerting on the default audio device. That is a problem if the user has pluged in a headset but don't wear it. So my question is: "***Is it possible to set the allert sound to all audio devices instead of the default device only?"***
I am programmi... | 2011/11/03 | [
"https://Stackoverflow.com/questions/7995085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1012636/"
] | Ok but I like to use this way, so that whenever original image is not available you can load your default image that may be your favorite smiley or image saying Sorry ! Not Available, But in case if both the images are missing you can use text to display. where you can also you smiley then. have a look almost covers ev... | This one worked for me. using the srcset. I have just learnt about it so i dont know if browsers support it but it has worked for me. Try it and later give me your feed back.
```
<img src="smiley.gif" srcset="alternatve.gif" width="32" height="32" />
``` |
7,995,085 | I have a program which is alerting the user. But right now it is only allerting on the default audio device. That is a problem if the user has pluged in a headset but don't wear it. So my question is: "***Is it possible to set the allert sound to all audio devices instead of the default device only?"***
I am programmi... | 2011/11/03 | [
"https://Stackoverflow.com/questions/7995085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1012636/"
] | Try using `border=0` in the `img` tag to make the ugly square go away.
`<img src="someimage.png" border="0" alt="some alternate text" />` | try PHP
```
if (file_exists('url/img/' . $Image)) {
$show_img_URL = "Image.jpg";
} else {
$show_img_URL = "Image_not_found.jpg";
}
``` |
7,995,085 | I have a program which is alerting the user. But right now it is only allerting on the default audio device. That is a problem if the user has pluged in a headset but don't wear it. So my question is: "***Is it possible to set the allert sound to all audio devices instead of the default device only?"***
I am programmi... | 2011/11/03 | [
"https://Stackoverflow.com/questions/7995085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1012636/"
] | You can show an alternative text by adding `alt`:
```
<img src="my_img.png" alt="alternative text" border="0" />
``` | try PHP
```
if (file_exists('url/img/' . $Image)) {
$show_img_URL = "Image.jpg";
} else {
$show_img_URL = "Image_not_found.jpg";
}
``` |
7,995,085 | I have a program which is alerting the user. But right now it is only allerting on the default audio device. That is a problem if the user has pluged in a headset but don't wear it. So my question is: "***Is it possible to set the allert sound to all audio devices instead of the default device only?"***
I am programmi... | 2011/11/03 | [
"https://Stackoverflow.com/questions/7995085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1012636/"
] | You can show an alternative text by adding `alt`:
```
<img src="my_img.png" alt="alternative text" border="0" />
``` | This one worked for me. using the srcset. I have just learnt about it so i dont know if browsers support it but it has worked for me. Try it and later give me your feed back.
```
<img src="smiley.gif" srcset="alternatve.gif" width="32" height="32" />
``` |
7,995,085 | I have a program which is alerting the user. But right now it is only allerting on the default audio device. That is a problem if the user has pluged in a headset but don't wear it. So my question is: "***Is it possible to set the allert sound to all audio devices instead of the default device only?"***
I am programmi... | 2011/11/03 | [
"https://Stackoverflow.com/questions/7995085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1012636/"
] | The best way to solve your problem:
```
<img id="currentPhoto" src="SomeImage.jpg" onerror="this.onerror=null; this.src='Default.jpg'" alt="" width="100" height="120">
```
`onerror` is a good thing for you :)
Just change the image file name and try yourself. | Here Check below code snippet which, In this, I miss-spelled the image name. So, just because of that it is showing the alternative image as not found image ( 404.svg ).
```html
<img id="currentPhoto" src="https://www.ccrharrow.org/Images/content/953/741209.pg" onerror="this.src='https://www.unesale.com/ProductImages... |
7,995,085 | I have a program which is alerting the user. But right now it is only allerting on the default audio device. That is a problem if the user has pluged in a headset but don't wear it. So my question is: "***Is it possible to set the allert sound to all audio devices instead of the default device only?"***
I am programmi... | 2011/11/03 | [
"https://Stackoverflow.com/questions/7995085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1012636/"
] | For the alternative, if the image doesn't exist - show nothing at all. (what I was looking for)
You can swap the function from Robby Shaw's answer in the "onerror" attribute to "this.remove()".
```html
<img id="currentPhoto" src="SomeImage.jpg" alt='1' width="100" height="120">
<img id="currentPhoto" src="SomeImage.... | I wanted to hide the space occupied by `<img>` tag so this worked for me
`<img src = "source.jpg" alt = "" >` |
7,995,085 | I have a program which is alerting the user. But right now it is only allerting on the default audio device. That is a problem if the user has pluged in a headset but don't wear it. So my question is: "***Is it possible to set the allert sound to all audio devices instead of the default device only?"***
I am programmi... | 2011/11/03 | [
"https://Stackoverflow.com/questions/7995085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1012636/"
] | I added a parent div around the image and used the following onerror event handler to hide the original image because in IE there was still an ugly image-not-found image shown after using the alt attribute:
```
<div style=" width:300px; height:150px; float:left; margin-left:5px; margin-top:50px;">
<img src='@U... | This one worked for me. using the srcset. I have just learnt about it so i dont know if browsers support it but it has worked for me. Try it and later give me your feed back.
```
<img src="smiley.gif" srcset="alternatve.gif" width="32" height="32" />
``` |
23,194,706 | Still learning and am trying to create a simple multidimensional array with 4 records and 4 values in each record - a string; 2x floats and an int. The reference documentation on Objective-C seems to be mute on this, unless I have been struck blind or am using the wrong terminology.
Any ideas?
Regards,
Bruckner | 2014/04/21 | [
"https://Stackoverflow.com/questions/23194706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3556027/"
] | Objective C does not contain a concept of contiguous multidimensional arrays (like in C). You can implement using array of arrays, as suggested by @GrzegorzKrukowski, but you risk mixing up indexes and order.
Here are two better solutions:
* Use a `NSDictionary` object with `NSIndexPath` objects as keys to note your ... | ```
NSMutableArray *arr = [NSMutableArray arrayWithObjects:
[NSMutableArray array],
[NSMutableArray array],
[NSMutableArray array],
[NSMutableArray array], nil];
```
To add int, float into any array use: NSNumber numberWithInt: or numberWithFloat:
```
[[arr objectAtIndex:0] addObject:[NSNumber numberWithInt:10]];
`... |
23,194,706 | Still learning and am trying to create a simple multidimensional array with 4 records and 4 values in each record - a string; 2x floats and an int. The reference documentation on Objective-C seems to be mute on this, unless I have been struck blind or am using the wrong terminology.
Any ideas?
Regards,
Bruckner | 2014/04/21 | [
"https://Stackoverflow.com/questions/23194706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3556027/"
] | Objective C does not contain a concept of contiguous multidimensional arrays (like in C). You can implement using array of arrays, as suggested by @GrzegorzKrukowski, but you risk mixing up indexes and order.
Here are two better solutions:
* Use a `NSDictionary` object with `NSIndexPath` objects as keys to note your ... | You can achieve this using below code,
```
NSMutableArray *arrFinal=[[NSMutableArray alloc]init];
NSMutableArray *arr=[[NSMutableArray alloc]init];
[arr addObject:@"String"];
[arr addObject:[NSString stringWithFormat:@"%f",floatNumber1]];
[arr addObject:[NSString stringWithFormat:@"%f",floatNumbe... |
56,904,895 | I'm setting up a script where I need to take several variable from my config at the same time. I've set my config as: `config = configparser.ConfigParser()`.
I've tried to take these variables using `*` symbol.
```py
[part1]
variable1 = 10
variable2 = 20
```
I've tried to take it with:
```py
variable = config.get... | 2019/07/05 | [
"https://Stackoverflow.com/questions/56904895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Do
```
cfg_items = config.items('part1')
```
to get all the configs in the section.
Then filter the dictionary keys using the regex you defined.
You can do it in a single step
```
cfg_list = [val for var, val in config.items('part1') if var.startswith('variable')]
``` | I would just use a list comprehension to iterate over the variables you want.
```
to_get = ('variable1', 'variable2')
values = [config.get('part1', x) for x in to_get]
```
The problem with `variable*` is that it assumes the config file will only contain the options you *expect*. Be explicit, and only fetch the ones ... |
18,066,214 | I have a situation where two view controllers are loaded on top of the initial view controller, and when the third view controller is loaded I would like to dismiss the two view controllers for the action of a button on the third view controller. Right now the button is only dismissing one view controller with the foll... | 2013/08/05 | [
"https://Stackoverflow.com/questions/18066214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/708807/"
] | I was having a similar issue with CORS and AJAX, then I followed jhamm suggestion. Then, I got "ERROR [launcher]: Cannot start chrome\_without\_security Can not find the binary chrome\_without\_security".
Since my issue was with CORS, I found out [here](https://github.com/karma-runner/karma-chrome-launcher/issues/154)... | If it really is a CORS issue, you can disable the cross-domain by starting karma like this:
```
karma start --browsers chrome_without_security
```
Chrome has the ability to be started with the security disabled
```
open -a Google\ Chrome --args --disable-web-security
```
And the Karma team just takes advantage of... |
7,530,969 | In my Java GUI app I have a `JButton` and when clicked it calls a `function` to connect to a `database`, then calls a `function` to `clear` a `table` in the `DB`, then calls a `function` that reads text from one file and loads `variables`, which calls a `function` that reads text from another file, compares the `data` ... | 2011/09/23 | [
"https://Stackoverflow.com/questions/7530969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/776647/"
] | The problem is probably related to connecting to doing expensive operations in the UI thread (connecting to a database, reading from a file, calling other functions). Under no circumstances should you call code that uses excessive CPU time from the UI thread, as the entire interface can't proceed while it is executing ... | One method to handle progressbars are to extend `SwingWorker` in a class.
`SwingWorker` takes care of running background tasks for you and so you do not have to implement your own threading that can end up in unknown issues.
To begin with, your class that takes care of progress bar UI should implement `PropertyChangeLi... |
7,530,969 | In my Java GUI app I have a `JButton` and when clicked it calls a `function` to connect to a `database`, then calls a `function` to `clear` a `table` in the `DB`, then calls a `function` that reads text from one file and loads `variables`, which calls a `function` that reads text from another file, compares the `data` ... | 2011/09/23 | [
"https://Stackoverflow.com/questions/7530969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/776647/"
] | The problem is probably related to connecting to doing expensive operations in the UI thread (connecting to a database, reading from a file, calling other functions). Under no circumstances should you call code that uses excessive CPU time from the UI thread, as the entire interface can't proceed while it is executing ... | >
> Could I create the new thread when the action is performed and call the new functions in the thread, or should I do the threading within the actual function itself?
>
>
>
You can start a [`SwingWorker`](http://download.oracle.com/javase/7/docs/api/javax/swing/SwingWorker.html) from your button's handler, as sh... |
7,530,969 | In my Java GUI app I have a `JButton` and when clicked it calls a `function` to connect to a `database`, then calls a `function` to `clear` a `table` in the `DB`, then calls a `function` that reads text from one file and loads `variables`, which calls a `function` that reads text from another file, compares the `data` ... | 2011/09/23 | [
"https://Stackoverflow.com/questions/7530969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/776647/"
] | The problem is probably related to connecting to doing expensive operations in the UI thread (connecting to a database, reading from a file, calling other functions). Under no circumstances should you call code that uses excessive CPU time from the UI thread, as the entire interface can't proceed while it is executing ... | ```
progressBar.setIndeterminate(true);
progressBar.setValue(0);
dbConnect(); //connects to DB
progressBar.setIndeterminate(true);
progressBar.setValue(10);
clearSchedules(); // deletes data in ta... |
7,530,969 | In my Java GUI app I have a `JButton` and when clicked it calls a `function` to connect to a `database`, then calls a `function` to `clear` a `table` in the `DB`, then calls a `function` that reads text from one file and loads `variables`, which calls a `function` that reads text from another file, compares the `data` ... | 2011/09/23 | [
"https://Stackoverflow.com/questions/7530969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/776647/"
] | One method to handle progressbars are to extend `SwingWorker` in a class.
`SwingWorker` takes care of running background tasks for you and so you do not have to implement your own threading that can end up in unknown issues.
To begin with, your class that takes care of progress bar UI should implement `PropertyChangeLi... | ```
progressBar.setIndeterminate(true);
progressBar.setValue(0);
dbConnect(); //connects to DB
progressBar.setIndeterminate(true);
progressBar.setValue(10);
clearSchedules(); // deletes data in ta... |
7,530,969 | In my Java GUI app I have a `JButton` and when clicked it calls a `function` to connect to a `database`, then calls a `function` to `clear` a `table` in the `DB`, then calls a `function` that reads text from one file and loads `variables`, which calls a `function` that reads text from another file, compares the `data` ... | 2011/09/23 | [
"https://Stackoverflow.com/questions/7530969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/776647/"
] | >
> Could I create the new thread when the action is performed and call the new functions in the thread, or should I do the threading within the actual function itself?
>
>
>
You can start a [`SwingWorker`](http://download.oracle.com/javase/7/docs/api/javax/swing/SwingWorker.html) from your button's handler, as sh... | ```
progressBar.setIndeterminate(true);
progressBar.setValue(0);
dbConnect(); //connects to DB
progressBar.setIndeterminate(true);
progressBar.setValue(10);
clearSchedules(); // deletes data in ta... |
611,258 | Derby doesn't support this syntax:
```
UPDATE x SET (col1, col2, ...) = ( SELECT a,b,... FROM y ... )
```
(see [this bug](https://issues.apache.org/jira/browse/DERBY-4074)). Does anyone have a workaround other than creating a loop in Java which does the select and sends N updates back?
**[EDIT]** Note that I have 5... | 2009/03/04 | [
"https://Stackoverflow.com/questions/611258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34088/"
] | I too would do it the was rbobby siad but I'm also a MSSQL person.
Have you tried:
```
UPDATE x
SET (col1)= ( SELECT a FROM y where y.fkfield = x.pkidfield),
(col21)= ( SELECT b FROM y where y.fkfield = x.pkidfield), )
``` | I'm not sure that's valid sql (I'm more a MS SQL guy so I could be way way off).
Normally I'd do:
```
update Orders
set Orders.Code = OtherOrders.Code,
Orders.Name = OtherOrders.Name
from Orders inner join Orders as OtherOrders
on OtherOrders.OrderId = Orders.OrderId
``` |
69,330,328 | first-time poster here. I'm pretty new to React & JS in general, and I've been working in NextJS. Interestingly, my project runs just fine when I run `next dev`, but fails when I use `next build`.
I get the following error:
```
Error: React Hook "useFunction" cannot be called inside a callback. React Hooks must be ca... | 2021/09/25 | [
"https://Stackoverflow.com/questions/69330328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17004291/"
] | The data on the website sent an invalid response, so the issue was not in the code but the website data itself. | Try adding Try Catch to your functions. |
1,053,483 | Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my purposes. My application needs to be able to draw tens of thousands of particles (coloured circles, very preferably anti-aliased) in a full screen resolution at 20+ frames per second.
I'm hesitant to step away from GDI+ since I also require... | 2009/06/27 | [
"https://Stackoverflow.com/questions/1053483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/81947/"
] | If you want to use VB.NET, then you can go with XNA or SlimDX.
I have some experience in creating games with GDI+ and XNA, and I can understand that GDI+ is giving you trouble.
If I where you I'd check out XNA, it's much faster than GDI+ because it actually uses your video card for drawing and it has a lot of good do... | As you're working in VB.net, have you tried using WPF (Part of .net since 3.0)? As WPF is based on DirectX rather than GDI+, that should give you the speed you need, although developing WPF is not straight-forward at all. |
1,053,483 | Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my purposes. My application needs to be able to draw tens of thousands of particles (coloured circles, very preferably anti-aliased) in a full screen resolution at 20+ frames per second.
I'm hesitant to step away from GDI+ since I also require... | 2009/06/27 | [
"https://Stackoverflow.com/questions/1053483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/81947/"
] | If you want to use VB.NET, then you can go with XNA or SlimDX.
I have some experience in creating games with GDI+ and XNA, and I can understand that GDI+ is giving you trouble.
If I where you I'd check out XNA, it's much faster than GDI+ because it actually uses your video card for drawing and it has a lot of good do... | The only way to get the speed you need is to move away from software rendering to hardware rendering... and unfortunately that does mean moving to OpenGL or DirectX.
The alternative is to try and optimise your graphics routines to only draw the particles that need to be drawn, not the whole screen/window.
I would agr... |
1,053,483 | Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my purposes. My application needs to be able to draw tens of thousands of particles (coloured circles, very preferably anti-aliased) in a full screen resolution at 20+ frames per second.
I'm hesitant to step away from GDI+ since I also require... | 2009/06/27 | [
"https://Stackoverflow.com/questions/1053483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/81947/"
] | If you want to use VB.NET, then you can go with XNA or SlimDX.
I have some experience in creating games with GDI+ and XNA, and I can understand that GDI+ is giving you trouble.
If I where you I'd check out XNA, it's much faster than GDI+ because it actually uses your video card for drawing and it has a lot of good do... | The most significant speed increase I found, when writing a game maker with GDI+, was to convert my bitmaps to Format32bppPArgb;-
SuperFastBitmap = ConvertImagePixelFormat(SlowBitmap, Imaging.PixelFormat.Format32bppPArgb)
If they are not in this format already, you'll see the difference immediately when you convert. |
1,053,483 | Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my purposes. My application needs to be able to draw tens of thousands of particles (coloured circles, very preferably anti-aliased) in a full screen resolution at 20+ frames per second.
I'm hesitant to step away from GDI+ since I also require... | 2009/06/27 | [
"https://Stackoverflow.com/questions/1053483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/81947/"
] | If you want to use VB.NET, then you can go with XNA or SlimDX.
I have some experience in creating games with GDI+ and XNA, and I can understand that GDI+ is giving you trouble.
If I where you I'd check out XNA, it's much faster than GDI+ because it actually uses your video card for drawing and it has a lot of good do... | Because the GDI+ is not moved by the graphics card, it's slow to render because it uses the CPU to render. At least, you can use DirectX or SlimDX.
**(sorry for bad english)**
---
See This: <http://msdn.microsoft.com/en-us/library/windows/desktop/ff729480%28v=vs.85%29.aspx>
<http://www.codeproject.com/Articles/15958... |
1,053,483 | Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my purposes. My application needs to be able to draw tens of thousands of particles (coloured circles, very preferably anti-aliased) in a full screen resolution at 20+ frames per second.
I'm hesitant to step away from GDI+ since I also require... | 2009/06/27 | [
"https://Stackoverflow.com/questions/1053483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/81947/"
] | As you're working in VB.net, have you tried using WPF (Part of .net since 3.0)? As WPF is based on DirectX rather than GDI+, that should give you the speed you need, although developing WPF is not straight-forward at all. | Because the GDI+ is not moved by the graphics card, it's slow to render because it uses the CPU to render. At least, you can use DirectX or SlimDX.
**(sorry for bad english)**
---
See This: <http://msdn.microsoft.com/en-us/library/windows/desktop/ff729480%28v=vs.85%29.aspx>
<http://www.codeproject.com/Articles/15958... |
1,053,483 | Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my purposes. My application needs to be able to draw tens of thousands of particles (coloured circles, very preferably anti-aliased) in a full screen resolution at 20+ frames per second.
I'm hesitant to step away from GDI+ since I also require... | 2009/06/27 | [
"https://Stackoverflow.com/questions/1053483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/81947/"
] | The only way to get the speed you need is to move away from software rendering to hardware rendering... and unfortunately that does mean moving to OpenGL or DirectX.
The alternative is to try and optimise your graphics routines to only draw the particles that need to be drawn, not the whole screen/window.
I would agr... | As you're working in VB.net, have you tried using WPF (Part of .net since 3.0)? As WPF is based on DirectX rather than GDI+, that should give you the speed you need, although developing WPF is not straight-forward at all. |
1,053,483 | Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my purposes. My application needs to be able to draw tens of thousands of particles (coloured circles, very preferably anti-aliased) in a full screen resolution at 20+ frames per second.
I'm hesitant to step away from GDI+ since I also require... | 2009/06/27 | [
"https://Stackoverflow.com/questions/1053483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/81947/"
] | As Jared said,
it could be that a significant fraction of your cycles are not going into GDI, and you might be able to reduce those.
A simple way to find those is to halt it at random a few times and examine the stack. The chance that you will catch it in the act of wasting time is equal to the fraction of time being... | As you're working in VB.net, have you tried using WPF (Part of .net since 3.0)? As WPF is based on DirectX rather than GDI+, that should give you the speed you need, although developing WPF is not straight-forward at all. |
1,053,483 | Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my purposes. My application needs to be able to draw tens of thousands of particles (coloured circles, very preferably anti-aliased) in a full screen resolution at 20+ frames per second.
I'm hesitant to step away from GDI+ since I also require... | 2009/06/27 | [
"https://Stackoverflow.com/questions/1053483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/81947/"
] | If you want to use VB.NET, then you can go with XNA or SlimDX.
I have some experience in creating games with GDI+ and XNA, and I can understand that GDI+ is giving you trouble.
If I where you I'd check out XNA, it's much faster than GDI+ because it actually uses your video card for drawing and it has a lot of good do... | It's possible the problem is in your algorithm and not GDI+. Profiling is the only way to know for sure. Without a profile it's very possible you will switch to a new GUI framework and hit the exact same problems.
If you did profile, what part of GDI+ was causing a problem? |
1,053,483 | Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my purposes. My application needs to be able to draw tens of thousands of particles (coloured circles, very preferably anti-aliased) in a full screen resolution at 20+ frames per second.
I'm hesitant to step away from GDI+ since I also require... | 2009/06/27 | [
"https://Stackoverflow.com/questions/1053483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/81947/"
] | The most significant speed increase I found, when writing a game maker with GDI+, was to convert my bitmaps to Format32bppPArgb;-
SuperFastBitmap = ConvertImagePixelFormat(SlowBitmap, Imaging.PixelFormat.Format32bppPArgb)
If they are not in this format already, you'll see the difference immediately when you convert. | As you're working in VB.net, have you tried using WPF (Part of .net since 3.0)? As WPF is based on DirectX rather than GDI+, that should give you the speed you need, although developing WPF is not straight-forward at all. |
1,053,483 | Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my purposes. My application needs to be able to draw tens of thousands of particles (coloured circles, very preferably anti-aliased) in a full screen resolution at 20+ frames per second.
I'm hesitant to step away from GDI+ since I also require... | 2009/06/27 | [
"https://Stackoverflow.com/questions/1053483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/81947/"
] | It's possible the problem is in your algorithm and not GDI+. Profiling is the only way to know for sure. Without a profile it's very possible you will switch to a new GUI framework and hit the exact same problems.
If you did profile, what part of GDI+ was causing a problem? | As you're working in VB.net, have you tried using WPF (Part of .net since 3.0)? As WPF is based on DirectX rather than GDI+, that should give you the speed you need, although developing WPF is not straight-forward at all. |
1,517,899 | $$2x + 2^x = 4$$
So it's clear that $x$ will equal $1$ but how can it be solved through an algebraic method to be able to determine $x$ with more complex numbers.
I've tried to transform the exponent into a logarithm
$ 2x + \log\_2 2^x = 4$
$2x +x = 4$
$x = \frac43$
But it didn't work... | 2015/11/07 | [
"https://math.stackexchange.com/questions/1517899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/135517/"
] | As you said, $x=1$ is solution. Moreover, if $f(x)=2x+2^x$,$$f'(x)=2+\ln(2)2^x>0$$ and thus, $f$ is injective. Therefore, $x=1$ is the unique solution. | If you consider the function
$$
f(x)=2x+2^x
$$
you see that
$$
\lim\_{x\to-\infty}f(x)=-\infty,
\qquad
\lim\_{x\to\infty}f(x)=\infty
$$
and
$$
f'(x)=2+2^x\log 2>0
$$
for every $x$. Thus the function is strictly increasing and so it takes exactly once every possible real value.
Since, clearly,
$$
f(1)=2\cdot1+2^1=4
$$
... |
32,182,578 | I have a file like this (this is a simplified version):
```
james sfsf qef qef
qef qef qe fff
qqew james james qef
qefq ffgrsf wsef
qef james eq james
```
I want to replace each iteration of 'james' with a different value. Here's what I have in my test code:
```
f=open('file_to_be_read.txt','r')
text=f.read()
matc... | 2015/08/24 | [
"https://Stackoverflow.com/questions/32182578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5255941/"
] | you're discarding the updated string - try this:
```
text = re.sub(r'james', str(x), text, count=1)
``` | ```
new_text=re.sub(r'james',str(number),text,count=1)
```
You are working on `text` each time. You give it the same input text to work with, rather than processing your `new_text`.
Try this:
```
new_text = text
for x in range(matches):
new_text=re.sub(r'james',str(number),new_text,count=1)
number+=1
number... |
32,182,578 | I have a file like this (this is a simplified version):
```
james sfsf qef qef
qef qef qe fff
qqew james james qef
qefq ffgrsf wsef
qef james eq james
```
I want to replace each iteration of 'james' with a different value. Here's what I have in my test code:
```
f=open('file_to_be_read.txt','r')
text=f.read()
matc... | 2015/08/24 | [
"https://Stackoverflow.com/questions/32182578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5255941/"
] | you're discarding the updated string - try this:
```
text = re.sub(r'james', str(x), text, count=1)
``` | `re.sub` can take a function as the replacement value. This does roughly what you want
```
import re
with open('file_to_be_read.txt', 'r') as f:
text = f.read()
number = 0
def do_replace( matchobj ):
global number
replacement = str(number)
number += 1
return replacement
new_text = re.sub(r'james... |
32,182,578 | I have a file like this (this is a simplified version):
```
james sfsf qef qef
qef qef qe fff
qqew james james qef
qefq ffgrsf wsef
qef james eq james
```
I want to replace each iteration of 'james' with a different value. Here's what I have in my test code:
```
f=open('file_to_be_read.txt','r')
text=f.read()
matc... | 2015/08/24 | [
"https://Stackoverflow.com/questions/32182578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5255941/"
] | I would recommend using [`itertools.count`](https://docs.python.org/2/library/itertools.html#itertools.count) for this:
```
>>> from itertools import count
>>> import re
>>> s = '''james sfsf qef qef
qef qef qe fff
qqew james james qef
qefq ffgrsf wsef
qef james eq james'''
>>> print re.sub(r'james', lambda x, c=count... | ```
new_text=re.sub(r'james',str(number),text,count=1)
```
You are working on `text` each time. You give it the same input text to work with, rather than processing your `new_text`.
Try this:
```
new_text = text
for x in range(matches):
new_text=re.sub(r'james',str(number),new_text,count=1)
number+=1
number... |
32,182,578 | I have a file like this (this is a simplified version):
```
james sfsf qef qef
qef qef qe fff
qqew james james qef
qefq ffgrsf wsef
qef james eq james
```
I want to replace each iteration of 'james' with a different value. Here's what I have in my test code:
```
f=open('file_to_be_read.txt','r')
text=f.read()
matc... | 2015/08/24 | [
"https://Stackoverflow.com/questions/32182578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5255941/"
] | I would recommend using [`itertools.count`](https://docs.python.org/2/library/itertools.html#itertools.count) for this:
```
>>> from itertools import count
>>> import re
>>> s = '''james sfsf qef qef
qef qef qe fff
qqew james james qef
qefq ffgrsf wsef
qef james eq james'''
>>> print re.sub(r'james', lambda x, c=count... | `re.sub` can take a function as the replacement value. This does roughly what you want
```
import re
with open('file_to_be_read.txt', 'r') as f:
text = f.read()
number = 0
def do_replace( matchobj ):
global number
replacement = str(number)
number += 1
return replacement
new_text = re.sub(r'james... |
67,462,313 | I am trying to create a very simple webpage with a button that runs this script in js. I have a js file and an html file.
```css
//var button = document.querySelector("button")
//button.onclick = function() {
demo = function() {
const CambDict = require("camb-dict");
const dictionary = new CambDict.Dictionary... | 2021/05/09 | [
"https://Stackoverflow.com/questions/67462313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15881001/"
] | You can solve this with math.
```
return $alias + 10 + ((ceil($alias / 8)-1) * 2)
``` | If you look carefully you discover there is a formula:
```php
$alias = 11;
$row = ceil($alias / 8);
switch ($row)
{
case 1:
return $alias + 10;//(1*2-2)+10 = 0+10 = 10
case 2:
return $alias + 12;//(2*2-2)+10 = (4-2)+10 = 2+10 = 12
case 3:
return $alias + 14;//(3*2-2)+10 = (6-2)+10 =... |
18,835,750 | I have a lockscreen app, my activity is the first when the user hits unlock power button. I have a website link on the lockscreen-app. When the pattern-unlock is disabled , chrome gets fired with the the website link. But when I enable the security pattern, after the user enters his pattern, chrome app opens but the we... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18835750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2478235/"
] | I would open the web page as follows:
```
public void OpenUrl() {
private WebView View;
View = (WebView) WebDialog.findViewById(R.id.ticketline);
View.setWebViewClient(new WebConn());
View.setScrollbarFadingEnabled(true);
View.setHorizontalScrollBarEnabled(false);
View.getSetti... | I have got the same problem, I believe this is a bug in Chrome as other browsers, like Firefox and Opera, they work properly. But I found a workaround
[Android lock screen notification is not able to open Browser on double tapping](https://stackoverflow.com/questions/39285006/android-lock-screen-notification-is-not-ab... |
1,483,564 | I have a method which returns an File object. I need to know when the file is getting closed. This is not as simple as overwriting the close method. The close method is not called if the file is closed by the destructor.
It should work like this:
```
def something
get_lock_on_file
file File.new("foobar")
... | 2009/09/27 | [
"https://Stackoverflow.com/questions/1483564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174896/"
] | I am afraid there is nothing you can do. If the `File#close` method doesn't get called, then it's somewhat likely that the file will actually only be automatically closed by the operating system, when the Ruby interpreter exits. In other words: at the time that the file is closed, the Ruby interpreter (or at least your... | Define *something* like this ...
```
def something
get_lock_on_file
yield file
release_lock_on_file
end
```
.. and use it like that:
```
something do |file|
...
end
```
Wrap yield with an error handling block if you need it. |
24,962,111 | **Note: I am not looking for Sample Data.**
What Real Data sets are exposed for Free To Public in different domains:
For example :
1. **Financial Reports for FCM.**
<http://www.cftc.gov/MarketReports/FinancialDataforFCMs/HistoricalFCMReports/index.htm>
2. **YouTube Data:** (Popularity Metrics and Stats of Channels)
... | 2014/07/25 | [
"https://Stackoverflow.com/questions/24962111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1853458/"
] | Yes, This is right forum, there are many places data sets are available for free, I collected following links over the periods, many of them for learning purpose, there are few for real serious for problem solving.
UCI have famous data repository at <http://archive.ics.uci.edu/ml/>
Very good weather data at for at <h... | Here are some off the top of my head.
Amazon Web Services available public data sets:
<https://aws.amazon.com/datasets>
Socrata is startup software platform for cities to publish their data:
<https://opendata.socrata.com/>
Among the cities that use Socrata are San Francisco and New York City:
<https://data.sfgov.... |
10,689,342 | Eclipse 3.7.2
I just implemented an `@Rule` in some JUnit 4 tests, but when I run them in Eclipse the `MethodRule` methods are not being called. It's like the Eclipse test runner doesn't recognize the `@Rule` implementations and doesn't do anything special with fields that are annotated with `@Rule`.
I even tried usi... | 2012/05/21 | [
"https://Stackoverflow.com/questions/10689342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/639520/"
] | It turns out that somebody had included a seemingly "required" JAR on the runtime classpath of the project in question. That JAR embeds, among other things it should not, the JUnit packages! So there is this JAR, named something innocuous like `our_runtime_library.jar` that has some app-specific code along with some un... | It should work, at least in my Eclipse(in embeded JUnit 4.8).
So you could show your code.
Additional, JavaDoc says: `Note that MethodRule is now deprecated, you should be using TestRule instead.` |
18,470 | Recently at the American Museum of Natural History in New York, I saw a display set that claimed erosion makes mountains rise higher, counterintuitively. The explanation was that the material removed from a mountain due to erosion makes it much lighter. Since the mountain sits on a landmass that is floating atop magma,... | 2019/11/15 | [
"https://earthscience.stackexchange.com/questions/18470",
"https://earthscience.stackexchange.com",
"https://earthscience.stackexchange.com/users/17342/"
] | This actually does happen, a feedback loop between the [Himalayas](https://en.wikipedia.org/wiki/Himalayas) and the Indian [monsoon](https://en.wikipedia.org/wiki/Monsoon).
The [Indian Plate](https://en.wikipedia.org/wiki/Indian_Plate) is actively shoving itself under the [Eurasian Plate](https://en.wikipedia.org/wik... | It depends where the mountain is. Usually it is plate tectonics or volcanism that makes mountains higher, but in some circumstances it could be erosion. During the Ice Age,there were a couple of kilometres of ice pressing down on northern Britain. When the ice melted, it did so quite rapidly in geological terms. The ic... |
37,714,959 | I am looking for option to automatically add my addins to users excel file. before 2013 office we had a xla and xlam file which i could place in **XLSTART folder of office excel** and then when i open office, it will prompt me to include addins in excel file if its not trusted or automatically included it if its alread... | 2016/06/09 | [
"https://Stackoverflow.com/questions/37714959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1565393/"
] | I tend to use split in situations like this:
```
str = "key: Bob value: 5000,330,200"
=> "key: Bob value: 5000,330,200"
arr = str.split
=> ["key:", "Bob", "value:", "5000,330,200"]
if arr[0] == "key:" && arr[2] == "value:" && arr[3].split(",").none?(&:empty?)
# do stuff
end
```
Easier for me to suss out. | ["affirmative" match](https://regex101.com/r/qP6vW8/1#pcre):
`^key:\s\w+\svalue:\s(\d+,?)+$ //better validation`
["negative" match](https://regex101.com/r/qP6vW8/2):
`^(?!.*,,).*$ //simple negative lookahead` |
4,981,471 | I've recently started using GSON library for deserializing JSON that comes from web service but I can't make it work. I decide to test GSON on some simple input - can't make it any simpler and it still doesn't work. I've looked through similar issues like [Converting JSON to Java](https://stackoverflow.com/questions/16... | 2011/02/12 | [
"https://Stackoverflow.com/questions/4981471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/258825/"
] | I think your problem is your JSON string.
Try changing:
```
{"A":{"name":"qwrety","value1":1,"value2":2}}
```
to:
```
{"name":"qwrety","value1":1,"value2":2}
```
**EDIT:**
I think the problem might be your JSON string has "A" and that is case-sensitive. Try changing your member variable to an uppercase "A". Sorr... | The problem is, it's looking for a field in your object called "A", but instead it's finding fields "name", "value1" and "value2".
The json you want to be sending to gson is:
```
{"name":"qwrety","value1":1,"value2":2}
``` |
4,981,471 | I've recently started using GSON library for deserializing JSON that comes from web service but I can't make it work. I decide to test GSON on some simple input - can't make it any simpler and it still doesn't work. I've looked through similar issues like [Converting JSON to Java](https://stackoverflow.com/questions/16... | 2011/02/12 | [
"https://Stackoverflow.com/questions/4981471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/258825/"
] | I think your problem is your JSON string.
Try changing:
```
{"A":{"name":"qwrety","value1":1,"value2":2}}
```
to:
```
{"name":"qwrety","value1":1,"value2":2}
```
**EDIT:**
I think the problem might be your JSON string has "A" and that is case-sensitive. Try changing your member variable to an uppercase "A". Sorr... | After changes, your field name is still "a" but JSON uses "A". So you need to either rename field, or add annotation to indicate that JSON uses "A" as name (@SerializedName("A") I think). |
4,981,471 | I've recently started using GSON library for deserializing JSON that comes from web service but I can't make it work. I decide to test GSON on some simple input - can't make it any simpler and it still doesn't work. I've looked through similar issues like [Converting JSON to Java](https://stackoverflow.com/questions/16... | 2011/02/12 | [
"https://Stackoverflow.com/questions/4981471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/258825/"
] | The problem is, it's looking for a field in your object called "A", but instead it's finding fields "name", "value1" and "value2".
The json you want to be sending to gson is:
```
{"name":"qwrety","value1":1,"value2":2}
``` | After changes, your field name is still "a" but JSON uses "A". So you need to either rename field, or add annotation to indicate that JSON uses "A" as name (@SerializedName("A") I think). |
32,692,936 | In my project(play 2.4 with slick 3.0), I have a setup: using MySQL for production and H2 for unit testing(start to feel that it is a horrible idea). To do that, I have to import `slick.driver.JdbcProfile` instead of any specific driver (e.g. `slick.driver.MySQLDriver`) and import its `api._` in my DAO class, like this... | 2015/09/21 | [
"https://Stackoverflow.com/questions/32692936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1425866/"
] | You are using path-dependent types. They are literally dependent on paths, not on its content.
Consider that example:
```
class Store {
case class Box[T](box : T)
def box[T](b : T) = Box[T](b)
def unbox[T](b : Box[T]) : T = b.box
}
object Assign {
val x = new Store()
val y = x
val box = x.box[Int](2)
v... | Reduce the pain by moving the type definition to a `object`, therefore the type is imported statically.
Still not sure how to inherit types and how to introduce some dynamic components into this `object`
**UPDATE:** it is actually called "Path Dependent Types" in Scala. |
14,734,744 | I have an array of objects, a objects can look something like this:
```
{name: "object1", type: "event", props: {internalid: 1}}
{name: "object2", type: "event", props: {internalid: 1}}
```
I want to loop through the array of these objects and I want to create a new array of the objects with no duplicates (For me tw... | 2013/02/06 | [
"https://Stackoverflow.com/questions/14734744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/218183/"
] | **Note:** I'm the [**EclipseLink JAXB (MOXy)**](http://www.eclipse.org/eclipselink/moxy.php) lead and a member of the [**JAXB (JSR-222)**](http://jcp.org/en/jsr/detail?id=222) expert group.
Below is an example of how you can use MOXy's JSON-binding to support this use case.
**JAVA MODEL**
Below is an example domain ... | Sure, but don't think of it as converting between XML and JSON -- this is pretty much the wrong thing to do, causing compatibility issues -- but that of converting Java Objects (POJOs) to/from JSON and XML. You can use one or two tools for this: one common combination is to use Jackson for JSON, and JAXB for XML, to us... |
51,536,966 | [](https://i.stack.imgur.com/lJjao.png)
I have designed a program which will rerun when the user enters "y" when asked if they wish to continue. The problem I am having is once the user enters "n" the program is supposed to display the total amount payable from all ticket... | 2018/07/26 | [
"https://Stackoverflow.com/questions/51536966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7230166/"
] | I have fixed issues and also updated code for better performance.
```
package test;
import java.util.Scanner;
public class CSE1PGX_A2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
final float childCost = 18;
final float adultCost = 36;
... | Try this code. I hope it helps.
```
public static void main(String[] args) {
int option, quantity, confirm; //minor change
float childTotal = 0;
float adultTotal = 0;
float seniorTotal = 0;
float finalTotal = 0; //minor change
final doub... |
51,536,966 | [](https://i.stack.imgur.com/lJjao.png)
I have designed a program which will rerun when the user enters "y" when asked if they wish to continue. The problem I am having is once the user enters "n" the program is supposed to display the total amount payable from all ticket... | 2018/07/26 | [
"https://Stackoverflow.com/questions/51536966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7230166/"
] | I have fixed issues and also updated code for better performance.
```
package test;
import java.util.Scanner;
public class CSE1PGX_A2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
final float childCost = 18;
final float adultCost = 36;
... | I wished to play and did not fully understand the problem...so i developed from scratch the application. Suryakant was faster so please accept his answer (if it solves your problem). I simply post this here since i worked on it :-)
```
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public c... |
11,438,150 | I have a standalone HTML document I want to distribute, without any external dependencies. I'm using a non-standard font in this document that only some of my users will have installed.
For those users that do not have the font installed, I am including a copy of the font in an embedded SVG document at the top of the ... | 2012/07/11 | [
"https://Stackoverflow.com/questions/11438150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1114/"
] | Convert the font to a data URI and embedded it in the CSS declaration: ([fiddle](http://jsfiddle.net/jeremy/eCtKa/))
```
<style>
@font-face {
font-family: "My Font";
src: url("data:application/octet-stream;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly... | Specify the local font name first in the css, then the embedded font name:
```css
p {
font-family: MyFontLocalName, MyFontEmbeddedName;
}
```
<http://jsfiddle.net/gilly3/xX6Bv/5/>
If the `MyFontLocalName` is installed on the user's computer, that font will be used, otherwise `MyFontEmbeddedName` will be used. |
38,644,962 | I have a `TextBlock` and a `CheckBox`, as such:
```
<StackPanel >
<TextBlock Text="Colors"/>
<CheckBox Content="Blue" IsChecked="{Binding Model.Blue, ValidatesOnNotifyDataErrors=False}"/>
</StackPanel>
```
In my model I am implementing `INotifyDataErrorInfo` and validating whether the checkbox is checked or ... | 2016/07/28 | [
"https://Stackoverflow.com/questions/38644962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322228/"
] | First of all setting `ValidatesOnNotifyDataErrors`is not the right way to get rid of the red border. It will cause your data to not be validated at all. What you want is this:
```
<CheckBox Content="Blue" IsChecked="{Binding Model.Blue, ValidatesOnNotifyDataErrors=True}" Validation.ErrorTemplate="{x:Null}"/>
```
Sec... | With Karina K's insight I used the following code in order to achieve the desired result:
```
<TextBlock Text="Color">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=checkBox, Path=(Validation.HasError)}" Value="True"... |
43,807,140 | When I go to the home page of my website, it does not have a default id in url.
How can I set a default id to my home page's url.
I want this : www.afgclick.com&id = 2 | 2017/05/05 | [
"https://Stackoverflow.com/questions/43807140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4432962/"
] | Just add a check to see if and `id` is set, and if not, redirect to the same url WITH that `id`.
In PHP: (thanks @Albzi)
```
if (!$_GET['id']) $_GET['id'] = 1;
``` | If you need that parameter in the URL but you dont own the link that gets you to that page then try using something like:
**HTML version**
1. Create an index.html file containing the following code in the head section:
`<meta http-equiv="refresh" content="0; url=www.afgclick.com&id=2" />`
**Javascript version**
``... |
17,394,427 | I added to a project a set of sources that don't have tests and I don't want them spoil my test coverage statistics. I configured Jacoco in the next way :
```
test {
jacoco{
excludes = ['org/bla/**']
includes = ['com/bla/**']
append = false
}
}
jacocoTestReport {
dependsOn test
... | 2013/06/30 | [
"https://Stackoverflow.com/questions/17394427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696792/"
] | Ok, found a workaround :
```
jacocoTestReport.doFirst{
classDirectories = files('build/classes/main/com/bla')
}
```
This overrides classDirectories set by JacocoPlugin class. | If you have a task names something other than
```
test
```
that runs unit tests, you should be able to generate the report adding the following task to your build.gradle file:
```
jacocoTestReport {
group = "Reporting"
description = "Generates Jacoco coverage reports for unit tests"
executionData = file... |
47,063,953 | I am using radish bdd with selenium to test my django app, however sometimes django ask to delete database because it's already exists in database. here's my `terrain.py`:
```
import os
import django
from django.test.runner import DiscoverRunner
from django.test import LiveServerTestCase
from radish import before, af... | 2017/11/01 | [
"https://Stackoverflow.com/questions/47063953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7271853/"
] | [set! Doc](https://clojuredocs.org/clojure.core/set!)
you cannot assign to function params
or local bindings. Only Java fields, Vars, Refs and Agents are mutable in
Clojure. See <http://clojure.org/special_forms> for more information. | If you want to write imperative-style code in Clojure, just use an `atom` any place you would use a Java variable:
```
(ns tst.demo.core
(:use demo.core ) )
(defn gcd [a b]
(if (zero? b)
a
(recur b (mod a b))))
(defn euler-phi [n]
(let [x (atom 0)]
(loop [idx 1]
(when (= 1 (gcd idx n))
... |
14,707,812 | My mysql query is working fine
```
INSERT INTO donor_location (pc_id)
SELECT id
FROM pc
WHERE postcode= ?
```
i.e gets the postcode id from a postcode table then inserts that id into donor\_location table.
I am using mysqli and prepared statements
without the select part it would be quite easy - something like
```... | 2013/02/05 | [
"https://Stackoverflow.com/questions/14707812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1841287/"
] | What you do is almost the same, just changing the query bit.
To select all records from charity\_donor where the id is 25, you would do the follwing query:
```
SELECT *
FROM donor_charity
WHERE id = 25
```
Now to query this, first you have to prepare it:
```
$stmt = $mysqli->prepare("
SELECT *
FROM ... | Hope this post helps, it's so simple.
<http://www.java2s.com/Code/Java/Database-SQL-JDBC/InsertRecordsUsingPreparedStatement.htm> |
14,707,812 | My mysql query is working fine
```
INSERT INTO donor_location (pc_id)
SELECT id
FROM pc
WHERE postcode= ?
```
i.e gets the postcode id from a postcode table then inserts that id into donor\_location table.
I am using mysqli and prepared statements
without the select part it would be quite easy - something like
```... | 2013/02/05 | [
"https://Stackoverflow.com/questions/14707812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1841287/"
] | You need to use Bind\_param after Prepare statement.
```
$sql = "INSERT INTO donor_charity(
id) values (?)
";
/* create a prepared statement */
if (!$stmt = $db->prepare($sql)) {
echo 'Database prepare error';
exit;
}
/* bind parameters for markers */
$stmt->bind_param('ssssss', $id);
$id = '123456';... | Hope this post helps, it's so simple.
<http://www.java2s.com/Code/Java/Database-SQL-JDBC/InsertRecordsUsingPreparedStatement.htm> |
14,707,812 | My mysql query is working fine
```
INSERT INTO donor_location (pc_id)
SELECT id
FROM pc
WHERE postcode= ?
```
i.e gets the postcode id from a postcode table then inserts that id into donor\_location table.
I am using mysqli and prepared statements
without the select part it would be quite easy - something like
```... | 2013/02/05 | [
"https://Stackoverflow.com/questions/14707812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1841287/"
] | What you do is almost the same, just changing the query bit.
To select all records from charity\_donor where the id is 25, you would do the follwing query:
```
SELECT *
FROM donor_charity
WHERE id = 25
```
Now to query this, first you have to prepare it:
```
$stmt = $mysqli->prepare("
SELECT *
FROM ... | You need to use Bind\_param after Prepare statement.
```
$sql = "INSERT INTO donor_charity(
id) values (?)
";
/* create a prepared statement */
if (!$stmt = $db->prepare($sql)) {
echo 'Database prepare error';
exit;
}
/* bind parameters for markers */
$stmt->bind_param('ssssss', $id);
$id = '123456';... |
6,533,988 | I am trying to load my next screen with (nib) file. whenever I am clicking on button I am getting an error EXC\_BAD\_ACCESS in onjcSend\_disassembly\_0x0109809b.nasm.
I also see when I was trying to connect my buutons with FilesOwner in interface builder, I was not getting it to connect. So I connect with function by ... | 2011/06/30 | [
"https://Stackoverflow.com/questions/6533988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518537/"
] | My normal approach in these kinds of cases is to expand the data into a more table-friendly format, rather than spend a lot of time customizing the HTML.
```
$collection |
select ComputerName -ExpandProperty Disks |
ConvertTo-Html -Fragment -Property ComputerName,Name,Capacity,'Free Space'
```
This expands the l... | You can convert them into a string beforehand:
```
Get-Foo | foreach { $_.Disks = $_.Disks -join ', ' } | ConvertTo-HTML
```
or maybe without actually changing your objects:
```
Get-Foo | select Computername,@{L=Disks;E={$_.Disks -join ', '}}
``` |
680,722 | which event is the most suitable to check for Session expired? i'm trying to trap each server request, and if Session is null, redirect to a different page. | 2009/03/25 | [
"https://Stackoverflow.com/questions/680722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can determine if a new session is being created by hooking Session\_OnStart - <http://msdn.microsoft.com/en-us/library/ms178583(VS.80).aspx>
>
> You can handle the Session\_OnStart
> event by adding a subroutine named
> Session\_OnStart to the Global.asax
> file. The Session\_OnStart subroutine
> is run at th... | This is often best achieved by using a base Page class for all otehr classes, and implementing this in the Page\_Load method. |
680,722 | which event is the most suitable to check for Session expired? i'm trying to trap each server request, and if Session is null, redirect to a different page. | 2009/03/25 | [
"https://Stackoverflow.com/questions/680722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can determine if a new session is being created by hooking Session\_OnStart - <http://msdn.microsoft.com/en-us/library/ms178583(VS.80).aspx>
>
> You can handle the Session\_OnStart
> event by adding a subroutine named
> Session\_OnStart to the Global.asax
> file. The Session\_OnStart subroutine
> is run at th... | Use BasePage class, which inherits from Page class. Let every aspx page inherits that BasePage class. In BasePage class, override OnInit event, in which you can check for Session or Cookie, and redirect user to login page (for example).
I use this approach for all mine webforms apps, because it's easy to implement a... |
9,708,068 | I have this data frame, this is a daily data. For every day, I have free space for each file system. I like to graph this. I was thinking to put each file system on its own column to create R graphs. How can I go about doing this. Without moving them to their own columns, can I create a chart for each file system for e... | 2012/03/14 | [
"https://Stackoverflow.com/questions/9708068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1148098/"
] | There are many possibilities for this in R... Something like this?
However if you want to plot for each file system *and* each day, there would be only one bar (don`t if this is much usefull...).
```
df <- read.table(header = TRUE, text = "Date fileSystem FreeSpace
2011-12-03 /var 99... | Your data is hard to read in in that format; here is a reproducible version:
```
DF <-
structure(list(Date = structure(c(15311, 15311, 15311, 15311,
15311, 15312, 15312, 15312, 15312, 15312), class = "Date"), fileSystem = structure(c(5L,
2L, 4L, 1L, 3L, 5L, 2L, 4L, 1L, 3L), .Label = c("/data", "/opt",
"/ora", "/tmp... |
9,708,068 | I have this data frame, this is a daily data. For every day, I have free space for each file system. I like to graph this. I was thinking to put each file system on its own column to create R graphs. How can I go about doing this. Without moving them to their own columns, can I create a chart for each file system for e... | 2012/03/14 | [
"https://Stackoverflow.com/questions/9708068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1148098/"
] | There are many possibilities for this in R... Something like this?
However if you want to plot for each file system *and* each day, there would be only one bar (don`t if this is much usefull...).
```
df <- read.table(header = TRUE, text = "Date fileSystem FreeSpace
2011-12-03 /var 99... | With lattice::xyplot you have many options:
```
require(lattice)
xyplot(FreeSpace ~ Date + fileSystem, data=df1)
xyplot(FreeSpace ~ Date | fileSystem, data=df1)
xyplot(FreeSpace ~ Date , group= fileSystem, data=df1)
xyplot(FreeSpace ~ Date , group= fileSystem, data=df1, type="b")
```
The lattice equivalent of the ba... |
9,708,068 | I have this data frame, this is a daily data. For every day, I have free space for each file system. I like to graph this. I was thinking to put each file system on its own column to create R graphs. How can I go about doing this. Without moving them to their own columns, can I create a chart for each file system for e... | 2012/03/14 | [
"https://Stackoverflow.com/questions/9708068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1148098/"
] | With lattice::xyplot you have many options:
```
require(lattice)
xyplot(FreeSpace ~ Date + fileSystem, data=df1)
xyplot(FreeSpace ~ Date | fileSystem, data=df1)
xyplot(FreeSpace ~ Date , group= fileSystem, data=df1)
xyplot(FreeSpace ~ Date , group= fileSystem, data=df1, type="b")
```
The lattice equivalent of the ba... | Your data is hard to read in in that format; here is a reproducible version:
```
DF <-
structure(list(Date = structure(c(15311, 15311, 15311, 15311,
15311, 15312, 15312, 15312, 15312, 15312), class = "Date"), fileSystem = structure(c(5L,
2L, 4L, 1L, 3L, 5L, 2L, 4L, 1L, 3L), .Label = c("/data", "/opt",
"/ora", "/tmp... |
29,231,587 | I have been trying to find a way to determine Ajax calls in Laravel but I have not found any documentation about it.
I have an `index()` controller function where I want to handle the response differently based on the nature of the request. Basically this is a resource controller method that is bound to GET request.
... | 2015/03/24 | [
"https://Stackoverflow.com/questions/29231587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2812955/"
] | To check an ajax request you can use `if (Request::ajax())`
Note:
If you are using laravel 5, then in the controller replace
```
use Illuminate\Http\Request;
```
with
```
use Request;
```
I hope it'll work. | ```
public function index()
{
if(!$this->isLogin())
return Redirect::to('login');
if(Request::ajax()) // This is check ajax request
{
return $JSON;
}
$data = array();
$data['records'] = $this->table->fetchAll();
$this->setLayout(compact('data'));
}
``` |
29,231,587 | I have been trying to find a way to determine Ajax calls in Laravel but I have not found any documentation about it.
I have an `index()` controller function where I want to handle the response differently based on the nature of the request. Basically this is a resource controller method that is bound to GET request.
... | 2015/03/24 | [
"https://Stackoverflow.com/questions/29231587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2812955/"
] | Maybe this helps. You have to refer the @param
```
/**
* Display a listing of the resource.
*
* @param Illuminate\Http\Request $request
* @return Response
*/
public function index(Request $request)
{
if($request->ajax()){
... | You are using the wrong `Request` class. If you want to use the Facade like: `Request::ajax()` you have to import this class:
```
use Illuminate\Support\Facades\Request;
```
And not `Illumiante\Http\Request`
---
Another solution would be injecting an instance of the real request class:
```
public function index(R... |
29,231,587 | I have been trying to find a way to determine Ajax calls in Laravel but I have not found any documentation about it.
I have an `index()` controller function where I want to handle the response differently based on the nature of the request. Basically this is a resource controller method that is bound to GET request.
... | 2015/03/24 | [
"https://Stackoverflow.com/questions/29231587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2812955/"
] | $request->wantsJson()
=====================
You can try `$request->wantsJson()` if `$request->ajax()` does not work
`$request->ajax()` works if your JavaScript library sets an X-Requested-With HTTP header.
By default Laravel set this header in js/bootstrap.js
```
window.axios = require('axios');
window.axios.defau... | Those who prefer to use laravel helpers they can check if a request is ajax using laravel `request()` helper.
```
if(request()->ajax())
// code
``` |
29,231,587 | I have been trying to find a way to determine Ajax calls in Laravel but I have not found any documentation about it.
I have an `index()` controller function where I want to handle the response differently based on the nature of the request. Basically this is a resource controller method that is bound to GET request.
... | 2015/03/24 | [
"https://Stackoverflow.com/questions/29231587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2812955/"
] | Maybe this helps. You have to refer the @param
```
/**
* Display a listing of the resource.
*
* @param Illuminate\Http\Request $request
* @return Response
*/
public function index(Request $request)
{
if($request->ajax()){
... | $request->wantsJson()
=====================
You can try `$request->wantsJson()` if `$request->ajax()` does not work
`$request->ajax()` works if your JavaScript library sets an X-Requested-With HTTP header.
By default Laravel set this header in js/bootstrap.js
```
window.axios = require('axios');
window.axios.defau... |
29,231,587 | I have been trying to find a way to determine Ajax calls in Laravel but I have not found any documentation about it.
I have an `index()` controller function where I want to handle the response differently based on the nature of the request. Basically this is a resource controller method that is bound to GET request.
... | 2015/03/24 | [
"https://Stackoverflow.com/questions/29231587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2812955/"
] | Maybe this helps. You have to refer the @param
```
/**
* Display a listing of the resource.
*
* @param Illuminate\Http\Request $request
* @return Response
*/
public function index(Request $request)
{
if($request->ajax()){
... | ```
Do something like this
public function functionName(User $user): string
{
(string) $message = "";
// check if request is ajax
if(request()->ajax())
{
if($this->isOwner($user->id)){
$message = 'success';
}else{
$message = "You are unauthorized to perform this a... |
29,231,587 | I have been trying to find a way to determine Ajax calls in Laravel but I have not found any documentation about it.
I have an `index()` controller function where I want to handle the response differently based on the nature of the request. Basically this is a resource controller method that is bound to GET request.
... | 2015/03/24 | [
"https://Stackoverflow.com/questions/29231587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2812955/"
] | ```
if(Request::ajax())
```
Looks to be the right answer.
<http://laravel.com/api/5.0/Illuminate/Http/Request.html#method_ajax> | after writing the jquery code perform this validation in your route or in controller.
```
$.ajax({
url: "/id/edit",
data:
name:name,
method:'get',
success:function(data){
console.log(data);}
});
Route::get('/', function(){
if(Request::ajax()){
return 'it's ajax request';}
});
``` |
29,231,587 | I have been trying to find a way to determine Ajax calls in Laravel but I have not found any documentation about it.
I have an `index()` controller function where I want to handle the response differently based on the nature of the request. Basically this is a resource controller method that is bound to GET request.
... | 2015/03/24 | [
"https://Stackoverflow.com/questions/29231587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2812955/"
] | Maybe this helps. You have to refer the @param
```
/**
* Display a listing of the resource.
*
* @param Illuminate\Http\Request $request
* @return Response
*/
public function index(Request $request)
{
if($request->ajax()){
... | For those working with **AngularJS** front-end, it does not use the Ajax header laravel is expecting. ([Read more](https://stackoverflow.com/a/24947865/922522))
Use [Request::wantsJson()](http://laravel.com/docs/4.2/requests#request-information) for AngularJS:
```
if(Request::wantsJson()) {
// Client wants JSON ... |
29,231,587 | I have been trying to find a way to determine Ajax calls in Laravel but I have not found any documentation about it.
I have an `index()` controller function where I want to handle the response differently based on the nature of the request. Basically this is a resource controller method that is bound to GET request.
... | 2015/03/24 | [
"https://Stackoverflow.com/questions/29231587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2812955/"
] | You are using the wrong `Request` class. If you want to use the Facade like: `Request::ajax()` you have to import this class:
```
use Illuminate\Support\Facades\Request;
```
And not `Illumiante\Http\Request`
---
Another solution would be injecting an instance of the real request class:
```
public function index(R... | Sometimes `Request::ajax()` doesn't work, then use `\Request::ajax()` |
29,231,587 | I have been trying to find a way to determine Ajax calls in Laravel but I have not found any documentation about it.
I have an `index()` controller function where I want to handle the response differently based on the nature of the request. Basically this is a resource controller method that is bound to GET request.
... | 2015/03/24 | [
"https://Stackoverflow.com/questions/29231587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2812955/"
] | $request->wantsJson()
=====================
You can try `$request->wantsJson()` if `$request->ajax()` does not work
`$request->ajax()` works if your JavaScript library sets an X-Requested-With HTTP header.
By default Laravel set this header in js/bootstrap.js
```
window.axios = require('axios');
window.axios.defau... | ```
if(Request::ajax())
```
Looks to be the right answer.
<http://laravel.com/api/5.0/Illuminate/Http/Request.html#method_ajax> |
29,231,587 | I have been trying to find a way to determine Ajax calls in Laravel but I have not found any documentation about it.
I have an `index()` controller function where I want to handle the response differently based on the nature of the request. Basically this is a resource controller method that is bound to GET request.
... | 2015/03/24 | [
"https://Stackoverflow.com/questions/29231587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2812955/"
] | $request->wantsJson()
=====================
You can try `$request->wantsJson()` if `$request->ajax()` does not work
`$request->ajax()` works if your JavaScript library sets an X-Requested-With HTTP header.
By default Laravel set this header in js/bootstrap.js
```
window.axios = require('axios');
window.axios.defau... | after writing the jquery code perform this validation in your route or in controller.
```
$.ajax({
url: "/id/edit",
data:
name:name,
method:'get',
success:function(data){
console.log(data);}
});
Route::get('/', function(){
if(Request::ajax()){
return 'it's ajax request';}
});
``` |
18,357,423 | I face a issue when designing a login page. And this issue is only for Firefox.
That is, when I selecting a previous login id and pressing Enter then caused the submit.
in IE and Chrome, it only select the data and doesn't submit.
my code is like :
```
<input type="text" name="t1"><br>
<input type="text" name="t2">... | 2013/08/21 | [
"https://Stackoverflow.com/questions/18357423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2537593/"
] | CakePHP is a PHP framework. According to [Wikipedia](http://en.wikipedia.org/wiki/Perl_module), a `.pm` file contains Perl source code basically composed of function definitions. From the PHP point of view, that's as reusable as the blueprints of a Toyota. I suppose it's technically possible to write a PHP extension th... | Depending on how your perl scripts work(I have no idea what the difference between .pm and .pl is ), you could create a model or component and access the data using PHP's exec function like so:
```
exec("path_to_perl /path/to/script.pl arguments to be passed",$output);
```
Wrap the perl output in your model/componen... |
6,974 | We have a "princess type" shih tzu (the small type, but not teacup type, which are the smallest), and she's about 4+ months old by now.
To cut the story short, we think we've gotten ill advice on how to feed our puppy and we think we've been giving her way too little food since we got her. (Something like 2 tablespoon... | 2014/12/08 | [
"https://pets.stackexchange.com/questions/6974",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/3279/"
] | The problem with serving the food based on the weight of the dog is that logically, it will be wrong if the dog is skinny and weights less than it should.(1)
For puppies up to 9-12 months, you should always leave them water available at all time and feed them at least feed 3 times a day (2); if the puppy is underweigh... | Be sure to go with healthy brands. Don't use supermarket brands. And yes as the other person said be sure to leave food at all times. |
312,892 | I created a virtual machine and installed Debian 6 on it, and then copied the hard drive to be used by another virtual machine. For the newly copied virtual machine, I changed the IP address, hostname and MAC address. Now, whenever I start up the machine, it comes up with these failure messages:
"Starting NFS Common... | 2011/09/19 | [
"https://serverfault.com/questions/312892",
"https://serverfault.com",
"https://serverfault.com/users/95092/"
] | Hotmail does not use live DNS for Sender ID. They have a DNS cache that they update twice per day. All TempError means is that your domain's SPF record is not in their cache. To get your record added to their cache, send an e-mail message to senderid@microsoft.com with your domain in it. They will add it, but be patien... | You now have to submit your domain to their Sender ID cache here:
<https://support.msn.com/default.aspx?productKey=senderid&locale=en-us&st=1&wfxredirect=1> |
1,554,670 | I'm looking for a tool that's able to create "setup" packages for Linux, just like the Windows install creators do (NSIS, InstallShield, etc.). I want it to be able to present a graphical interface to the user (or ncurses based), where he can select some options and install the package.
Any ideas of such a tool? I'm a... | 2009/10/12 | [
"https://Stackoverflow.com/questions/1554670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48736/"
] | You might want to have a look to the SQL reference for:
* Unique
* Distinct
* Group By | Try this:
```
select a.valueA, b.valueB, b.valueC
from table1 a join table2 b on <join condition>
group by a.valueA, b.valueB, b.valueC;
``` |
1,554,670 | I'm looking for a tool that's able to create "setup" packages for Linux, just like the Windows install creators do (NSIS, InstallShield, etc.). I want it to be able to present a graphical interface to the user (or ncurses based), where he can select some options and install the package.
Any ideas of such a tool? I'm a... | 2009/10/12 | [
"https://Stackoverflow.com/questions/1554670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48736/"
] | ```
SELECT DISTINCT * FROM Table1, Table2
```
will do what you want.
However, your SELECT statement does not include an criteria to tell the system *how* to join the rows together. You will therefore get a cartesian product, containing a number of rows equal to the number of rows in Table1 times the number of rows i... | You might want to have a look to the SQL reference for:
* Unique
* Distinct
* Group By |
1,554,670 | I'm looking for a tool that's able to create "setup" packages for Linux, just like the Windows install creators do (NSIS, InstallShield, etc.). I want it to be able to present a graphical interface to the user (or ncurses based), where he can select some options and install the package.
Any ideas of such a tool? I'm a... | 2009/10/12 | [
"https://Stackoverflow.com/questions/1554670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48736/"
] | ```
SELECT DISTINCT * FROM Table1, Table2
```
will do what you want.
However, your SELECT statement does not include an criteria to tell the system *how* to join the rows together. You will therefore get a cartesian product, containing a number of rows equal to the number of rows in Table1 times the number of rows i... | ```
SELECT DISTINCT *
FROM table1, table2
``` |
1,554,670 | I'm looking for a tool that's able to create "setup" packages for Linux, just like the Windows install creators do (NSIS, InstallShield, etc.). I want it to be able to present a graphical interface to the user (or ncurses based), where he can select some options and install the package.
Any ideas of such a tool? I'm a... | 2009/10/12 | [
"https://Stackoverflow.com/questions/1554670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48736/"
] | Select Distinct \* from table1, table2 | Try this:
```
select a.valueA, b.valueB, b.valueC
from table1 a join table2 b on <join condition>
group by a.valueA, b.valueB, b.valueC;
``` |
1,554,670 | I'm looking for a tool that's able to create "setup" packages for Linux, just like the Windows install creators do (NSIS, InstallShield, etc.). I want it to be able to present a graphical interface to the user (or ncurses based), where he can select some options and install the package.
Any ideas of such a tool? I'm a... | 2009/10/12 | [
"https://Stackoverflow.com/questions/1554670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48736/"
] | You might want to have a look to the SQL reference for:
* Unique
* Distinct
* Group By | How about this?
```
SELECT DISTINCT * FROM Table1, Table2
``` |
1,554,670 | I'm looking for a tool that's able to create "setup" packages for Linux, just like the Windows install creators do (NSIS, InstallShield, etc.). I want it to be able to present a graphical interface to the user (or ncurses based), where he can select some options and install the package.
Any ideas of such a tool? I'm a... | 2009/10/12 | [
"https://Stackoverflow.com/questions/1554670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48736/"
] | ```
SELECT DISTINCT *
FROM table1, table2
``` | How about this?
```
SELECT DISTINCT * FROM Table1, Table2
``` |
1,554,670 | I'm looking for a tool that's able to create "setup" packages for Linux, just like the Windows install creators do (NSIS, InstallShield, etc.). I want it to be able to present a graphical interface to the user (or ncurses based), where he can select some options and install the package.
Any ideas of such a tool? I'm a... | 2009/10/12 | [
"https://Stackoverflow.com/questions/1554670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48736/"
] | Use `SELECT DISTINCT` ?
As in:
```
SELECT DISTINCT value1, value2, value3 FROM table1, table2
``` | Try this:
```
select a.valueA, b.valueB, b.valueC
from table1 a join table2 b on <join condition>
group by a.valueA, b.valueB, b.valueC;
``` |
1,554,670 | I'm looking for a tool that's able to create "setup" packages for Linux, just like the Windows install creators do (NSIS, InstallShield, etc.). I want it to be able to present a graphical interface to the user (or ncurses based), where he can select some options and install the package.
Any ideas of such a tool? I'm a... | 2009/10/12 | [
"https://Stackoverflow.com/questions/1554670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48736/"
] | ```
SELECT DISTINCT * FROM Table1, Table2
```
will do what you want.
However, your SELECT statement does not include an criteria to tell the system *how* to join the rows together. You will therefore get a cartesian product, containing a number of rows equal to the number of rows in Table1 times the number of rows i... | Use `SELECT DISTINCT` ?
As in:
```
SELECT DISTINCT value1, value2, value3 FROM table1, table2
``` |
1,554,670 | I'm looking for a tool that's able to create "setup" packages for Linux, just like the Windows install creators do (NSIS, InstallShield, etc.). I want it to be able to present a graphical interface to the user (or ncurses based), where he can select some options and install the package.
Any ideas of such a tool? I'm a... | 2009/10/12 | [
"https://Stackoverflow.com/questions/1554670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48736/"
] | ```
SELECT DISTINCT * FROM Table1, Table2
```
will do what you want.
However, your SELECT statement does not include an criteria to tell the system *how* to join the rows together. You will therefore get a cartesian product, containing a number of rows equal to the number of rows in Table1 times the number of rows i... | Select Distinct \* from table1, table2 |
1,554,670 | I'm looking for a tool that's able to create "setup" packages for Linux, just like the Windows install creators do (NSIS, InstallShield, etc.). I want it to be able to present a graphical interface to the user (or ncurses based), where he can select some options and install the package.
Any ideas of such a tool? I'm a... | 2009/10/12 | [
"https://Stackoverflow.com/questions/1554670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48736/"
] | ```
SELECT DISTINCT *
FROM table1, table2
``` | Try this:
```
select a.valueA, b.valueB, b.valueC
from table1 a join table2 b on <join condition>
group by a.valueA, b.valueB, b.valueC;
``` |
34,299,596 | I have been creating a social networking site and have a friends system in place where the users can add/remove each other and it displays the users friends and profile pictures. All i need now is just to retrieve a total number of friends rather than the friends being listed individually for example (Sam has 21 friend... | 2015/12/15 | [
"https://Stackoverflow.com/questions/34299596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5683908/"
] | [This](https://stackoverflow.com/q/18113345/4945059) question is related to yours. Basically, you don’t need `GlobalErrorHandlerBehaviourAttribute`. You can add behaviour to your service manually. What you have to do is to create your `ServiceHost`. In [this answer](https://stackoverflow.com/a/34395819/4945059) I expla... | This is interesting question but setting up DI container is not that straight forward in WCF.
You have perform following setup:
1. Create a custom Instance provider
2. Create a custom service host
3. If its not self-hosting then a custom ServiceHostFactory setup.
See the complete code sample on MSDN for [how to setu... |
53,068,991 | I have an array of structs of type can\_frame, defined in can.h as the following:
```
struct can_frame {
canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */
__u8 can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */
__u8 __pad; /* padding */
__u8 __res0; /* reserved / padding... | 2018/10/30 | [
"https://Stackoverflow.com/questions/53068991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3617426/"
] | Auto-implemented properties:
```
public String Mark { get; set; }
public String Model { get; set; }
```
When you declare a auto-implemented as shown in your example, the compiler creates a private, anonymous backing field that can only be accessed through the property's get and set accessors.
```
private string mar... | In
```
class Car
{
public string Mark { get; set; }
string Model { get; set; }
}
```
* The class `Car` is internal.
* The property `Mark` is public.
* The property `Model` is private.
---
The comments seem to indicate that you are asking about the accessibility of the backing fields.
Both properties are ... |
22,939,078 | Problem solved!
```
mysql_set_charset('utf8',$conn);
```
The following mysql query works fine if i run that directly on the server. If i try to run this via php i got no error nor a result... any suggestions?
*Query*
```
Select Distinct
users.last_name,
accounts.name,
Max(Distinct tasks.date_entered... | 2014/04/08 | [
"https://Stackoverflow.com/questions/22939078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3511168/"
] | It's actually nothing special at all needed to use `@Autowired`. From the [Spring documentation](http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/validation.html#validation-beanvalidation-spring-constraints):
>
> ...a ConstraintValidator implementation may have its dependencies
> @Autowired li... | ```
@Component
public class MultipartFileNotEmptyValidator
```
Then you can use `@Autowired` and have dependencies injected. Works like a charm for me. |
12,073,416 | I have a string (confirm to be of decimal expression)
0.4351242134
I want to convert to a string with two decimal place
0.44
How should I do in C#? | 2012/08/22 | [
"https://Stackoverflow.com/questions/12073416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1497720/"
] | Well I would do:
```
var d = "0.4351242134";
Console.WriteLine(decimal.Parse(d).ToString("N2"));
``` | ```
float myNumber = float.Parse("0.4351242134");
Console.WriteLine(string.Format("{0:f2}", myNumber ));
```
<https://msdn.microsoft.com/en-us/library/s8s7t687.aspx> |
12,073,416 | I have a string (confirm to be of decimal expression)
0.4351242134
I want to convert to a string with two decimal place
0.44
How should I do in C#? | 2012/08/22 | [
"https://Stackoverflow.com/questions/12073416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1497720/"
] | ```
var d = decimal.Parse("0.4351242134");
Console.WriteLine(decimal.Round(d, 2));
``` | ```
float myNumber = float.Parse("0.4351242134");
Console.WriteLine(string.Format("{0:f2}", myNumber ));
```
<https://msdn.microsoft.com/en-us/library/s8s7t687.aspx> |
12,073,416 | I have a string (confirm to be of decimal expression)
0.4351242134
I want to convert to a string with two decimal place
0.44
How should I do in C#? | 2012/08/22 | [
"https://Stackoverflow.com/questions/12073416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1497720/"
] | ```
float f = float.Parse("0.4351242134");
Console.WriteLine(string.Format("{0:0.00}", f));
```
See [this](http://www.csharp-examples.net/string-format-double/) for string.Format. | ```
Convert.ToDecimal(Value).ToString("N2")
``` |
12,073,416 | I have a string (confirm to be of decimal expression)
0.4351242134
I want to convert to a string with two decimal place
0.44
How should I do in C#? | 2012/08/22 | [
"https://Stackoverflow.com/questions/12073416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1497720/"
] | ```
var probablyDecimalString = "0.4351242134";
decimal value;
if (Decimal.TryParse(probablyDecimalString , out value))
Console.WriteLine ( value.ToString("0.##") );
else
Console.WriteLine ("not a Decimal");
``` | Would this help
```
double ValBefore= 0.4351242134;
double ValAfter= Math.Round(ValBefore, 2, MidpointRounding.AwayFromZero); //Rounds"up"
``` |
12,073,416 | I have a string (confirm to be of decimal expression)
0.4351242134
I want to convert to a string with two decimal place
0.44
How should I do in C#? | 2012/08/22 | [
"https://Stackoverflow.com/questions/12073416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1497720/"
] | Well I would do:
```
var d = "0.4351242134";
Console.WriteLine(decimal.Parse(d).ToString("N2"));
``` | Would this help
```
double ValBefore= 0.4351242134;
double ValAfter= Math.Round(ValBefore, 2, MidpointRounding.AwayFromZero); //Rounds"up"
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.