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
36,714,152
``` var PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; var iceServers = []; var optional = { optional: [] }; var constraints = { 'offerToReceiveAudio': true, 'offerToReceiveVideo': true }; ...
2016/04/19
[ "https://Stackoverflow.com/questions/36714152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6223899/" ]
I should say your code worked fine for me in Firefox (I see 'ok'). That said, your code is problematic. I realize this is a test function, but `peer` is a local variable inside `promiseCreateOffer`, so once `promiseCreateOffer` returns (which it does immediately), you have zero references to `peer`, so what prevents i...
I was getting this issue because I had code in the `onnegotiationneeded` event that was not returning. I think `createoffer` waits for `onnegotiationneeded` to return before continuing.
60,020,447
I want to show an element and hide an element at the same time, 2 seconds after the page has loaded, I know the below code is not right, but I am just using it to help understand the logic I am trying to achieve. ``` delay(2000).$('#customer_contact').hide().$('#customer_contact_edit_cont').show(); ``` How could thi...
2020/02/01
[ "https://Stackoverflow.com/questions/60020447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2305490/" ]
Aside from the syntax issues, the `delay()` function is intended to delay animations from happening which are scheduled to run on jQuery's `fx` queue. If you want to delay an action from occurring outside of animation then you can use `setTimeout()`, like this: ``` setTimeout(function() { $('#customer_contact').hid...
You should use the `setTimeout` function. ``` setTimeout( function(){ //Do something }, 5000); ``` Here `5000` being the time in milliseconds. (`1 sec = 1000 ms`)
58,130,477
When I publish with VS, an app\_offline.htm file is generated on my IIS website root folder. There is a way to custom this last please ?
2019/09/27
[ "https://Stackoverflow.com/questions/58130477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11265167/" ]
In previous versions this was only changeable by tracking down the file in the VS installation. I've not seen anything to suggest this has changed in 2019.
I'm afraid we can no longer customize VS app\_offline template any more. But I think you can create a custom app\_offline.htm in the root folder of your project. Then You only have to specify the operation to this file in your web deploy publish profile. <https://learn.microsoft.com/en-us/aspnet/web-forms/overview/dep...
29,459,428
I can't figure out why this loop does not execute even once: ``` String s = "1 2\n3 4"; Scanner scanner = new Scanner(s); while(scanner.hasNext("\\d\\s\\d")) { System.out.printf("%d %d\n", scanner.nextInt(), scanner.nextInt()); } ``` To my understanding, "\d\s\d" means digit followed by whitespace followed by an...
2015/04/05
[ "https://Stackoverflow.com/questions/29459428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1986520/" ]
Avoid `while` loops if speed is a concern. The loop lends itself to a `for` loop as start and end are fixed. Additionally, your code does a lot of copying which isn't really necessary. The rewritten function: ``` def ContextualWindows (arrb4,arrb5,pfire): ''' arrb4,arrb5,pfire are 31*31 sampling windows from ...
I've run some time tests with `ContextualWindows` and variants. One `i` step takes about 50us, all ten about 500. This simple iteration takes about the same time: ``` [np.ma.count(arrb4[15-i:16+i,15-i:16+i]) for i in range(5,16)] ``` The iteration mechanism, and the 'copying' arrays are minor parts of the time. Whe...
44,948,894
I am creating a login form and I need to redirect the user to his/her profile page! I am using AJAX Requests so header redirect is not working at all. It just stays on the homepage. So how can I redirect the user to another page in pure javascript PHP ajax call? Please give the answer in pure javascript. I don't l...
2017/07/06
[ "https://Stackoverflow.com/questions/44948894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8220749/" ]
Make an ajax call. ``` <?php header('Content-Type: application/json'); echo json_encode(['location'=>'/user/profile/']); exit; ?> ``` The ajax response will return something like ``` {'location':'/user/profile/'} ``` In your ajax success javascript function ``` xhr.onreadystatechange = function () { ...
try this bill if its works. ``` window.location.replace("http://www.google.com"); ```
44,948,894
I am creating a login form and I need to redirect the user to his/her profile page! I am using AJAX Requests so header redirect is not working at all. It just stays on the homepage. So how can I redirect the user to another page in pure javascript PHP ajax call? Please give the answer in pure javascript. I don't l...
2017/07/06
[ "https://Stackoverflow.com/questions/44948894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8220749/" ]
I landed here looking for an Ajax solution, nevertheless MontrealDevOne's answer provided useful. If anyone else is curious about the ajax method too, here you go: ``` $('body').on('submit', '#form_register', function (e) { var form = $(this); $.ajax({ type: 'POST', url: 'form_submissions.p...
try this bill if its works. ``` window.location.replace("http://www.google.com"); ```
44,948,894
I am creating a login form and I need to redirect the user to his/her profile page! I am using AJAX Requests so header redirect is not working at all. It just stays on the homepage. So how can I redirect the user to another page in pure javascript PHP ajax call? Please give the answer in pure javascript. I don't l...
2017/07/06
[ "https://Stackoverflow.com/questions/44948894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8220749/" ]
Make an ajax call. ``` <?php header('Content-Type: application/json'); echo json_encode(['location'=>'/user/profile/']); exit; ?> ``` The ajax response will return something like ``` {'location':'/user/profile/'} ``` In your ajax success javascript function ``` xhr.onreadystatechange = function () { ...
I landed here looking for an Ajax solution, nevertheless MontrealDevOne's answer provided useful. If anyone else is curious about the ajax method too, here you go: ``` $('body').on('submit', '#form_register', function (e) { var form = $(this); $.ajax({ type: 'POST', url: 'form_submissions.p...
12,813,171
Lets take an example of a table adapter (typed data-sets) I am storing data-set in session. but I don't know what is better for table adapters. In general, will creating object hit performance badly when compared to storing and getting from session ?
2012/10/10
[ "https://Stackoverflow.com/questions/12813171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1365053/" ]
The two alternatives uses different resources. Creating a new instance of an object uses time. Storing the instance in the session uses memory. If you create a new instance each time you need one, it will only take up memory for the short while that you are using it. If you store it in the session, it will take up me...
I am not sure, Why Would you store it in session, But Remember Session is the most **expensive** resource in web development.
12,813,171
Lets take an example of a table adapter (typed data-sets) I am storing data-set in session. but I don't know what is better for table adapters. In general, will creating object hit performance badly when compared to storing and getting from session ?
2012/10/10
[ "https://Stackoverflow.com/questions/12813171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1365053/" ]
I am not sure, Why Would you store it in session, But Remember Session is the most **expensive** resource in web development.
It all depends upon your requirement what you want to do and how much the data you have. according to me session is not a good option to store data-set because once it occupies the memory will not be available.and session has some limitations like if your session has expired then it can throw error of null, you will n...
12,813,171
Lets take an example of a table adapter (typed data-sets) I am storing data-set in session. but I don't know what is better for table adapters. In general, will creating object hit performance badly when compared to storing and getting from session ?
2012/10/10
[ "https://Stackoverflow.com/questions/12813171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1365053/" ]
The two alternatives uses different resources. Creating a new instance of an object uses time. Storing the instance in the session uses memory. If you create a new instance each time you need one, it will only take up memory for the short while that you are using it. If you store it in the session, it will take up me...
Thats always depends on your requirement. If the data in dataset is less and you are making call to database very frequently to get same data again and again than its better to store that in session, But if data is same for all user than you should make use of Cache because its faster than session. But if the data is...
12,813,171
Lets take an example of a table adapter (typed data-sets) I am storing data-set in session. but I don't know what is better for table adapters. In general, will creating object hit performance badly when compared to storing and getting from session ?
2012/10/10
[ "https://Stackoverflow.com/questions/12813171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1365053/" ]
Thats always depends on your requirement. If the data in dataset is less and you are making call to database very frequently to get same data again and again than its better to store that in session, But if data is same for all user than you should make use of Cache because its faster than session. But if the data is...
It all depends upon your requirement what you want to do and how much the data you have. according to me session is not a good option to store data-set because once it occupies the memory will not be available.and session has some limitations like if your session has expired then it can throw error of null, you will n...
12,813,171
Lets take an example of a table adapter (typed data-sets) I am storing data-set in session. but I don't know what is better for table adapters. In general, will creating object hit performance badly when compared to storing and getting from session ?
2012/10/10
[ "https://Stackoverflow.com/questions/12813171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1365053/" ]
The two alternatives uses different resources. Creating a new instance of an object uses time. Storing the instance in the session uses memory. If you create a new instance each time you need one, it will only take up memory for the short while that you are using it. If you store it in the session, it will take up me...
It all depends upon your requirement what you want to do and how much the data you have. according to me session is not a good option to store data-set because once it occupies the memory will not be available.and session has some limitations like if your session has expired then it can throw error of null, you will n...
29,069,051
I'm trying to use ckeditor with code snippet. The easiest would be to use the CDN and include it as a script tag. But the default ck editor doesn't have the code snippet plugin. If I download a custom package with code snippet included, then I have to modify all the files to work with Rails asset pipeline, which I don'...
2015/03/16
[ "https://Stackoverflow.com/questions/29069051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2951835/" ]
You can still use CKEditor official CDN, but use full-all build, which includes all the official CKEditor plugins. ``` <script src="//cdn.ckeditor.com/4.4.7/full-all/ckeditor.js"></script> ``` And you're good to go. Don't forget to load this plugin, e.g. using [config.extraPlugins](http://docs.ckeditor.com/#!/api/CK...
Install additional plugins gem 'ckeditor' codesnippet ``` //adding app/assets/javascripts/ckeditor/plugins/codesnippet //app/assets/javascripts/ckeditor/config.js CKEDITOR.editorConfig = function (config) { config.extraPlugins = 'codesnippet'; } ``` <https://github.com/galetahub/ckeditor#install-additional-plugins...
22,654,446
I am dynamically loading content in a page using jQuery Ajax. The content contains images, so I need to know at what point all the images will be loaded, something like DOM Ready. Initially content will be hidden. After the images were loaded successfully I display the div containing them. Is there a method to detect ...
2014/03/26
[ "https://Stackoverflow.com/questions/22654446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1422404/" ]
If you have just inserted a bunch of HTML into your document (containing some `<img>` tags) and you want to know when all those new images are loaded, you can do it like this. Let's suppose that the dynamic content was all inserted into the `#root` object. Right after you've inserted the dynamic contend, you can run th...
**ajax** ``` $.ajax({ type: "POST", url: "myfile.*", data: {data : params}, cache: false, success: function(return_data){ //here you have the answer to Ajax //at this point you have the content ready for use //in your case here you would find the images that you got back from ...
22,654,446
I am dynamically loading content in a page using jQuery Ajax. The content contains images, so I need to know at what point all the images will be loaded, something like DOM Ready. Initially content will be hidden. After the images were loaded successfully I display the div containing them. Is there a method to detect ...
2014/03/26
[ "https://Stackoverflow.com/questions/22654446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1422404/" ]
If you have just inserted a bunch of HTML into your document (containing some `<img>` tags) and you want to know when all those new images are loaded, you can do it like this. Let's suppose that the dynamic content was all inserted into the `#root` object. Right after you've inserted the dynamic contend, you can run th...
you can use the on method with load. Count how many items you have in total and use the load event to have a number of total images loaded. You can even build a progress bar like this. Something like that and after you have finished with the ajax call ``` $('img').on('load', function(){ // Count items here ...
18,487,386
I have an app with login screen. When checking if login is ok, I show a "Loading" `Dialog`. If I change screen orientation, `Dialog`disappears and I think check of login starts again, but app crashes after that. I've read some solutions, but I can't do it works. **Here is my code:** **MainActivity.java** ``` publi...
2013/08/28
[ "https://Stackoverflow.com/questions/18487386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088643/" ]
Try this in your manifest... ``` <activity android:name="Your Activity Name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:windowSoftInputMode="adjustPan"/> ```
Android recreates the Activity on every orientation change. In order to persist the current activity state you need to save `instance state` and later retrieve it if possible. Refer to this tutorial: <http://www.intertech.com/Blog/saving-and-retrieving-android-instance-state-part-1/> Though easyer solution would be t...
61,824,118
I've been working on integrating FCM in my Vue PWA app. So far I've managed to get the background notification working, but handling notifications when the app's on the foreground doesn't work. Here's my code. ### `src/App.vue` ```js import firebase from './plugins/firebase' export default { // Other stuff here......
2020/05/15
[ "https://Stackoverflow.com/questions/61824118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2190916/" ]
I've found a solution in another QA here in StackOverflow (which I can't find anymore for some reason). Turns out you have to use Firebase API v7.8.0 instead of 5.5.6 like the docs said at the time. So those first two lines in `public/firebase-messaging-sw.js` should read like this instead: ```js importScripts('https...
In my case the version on `package.json` (8.2.1) was different from the actual SDK\_VERSION (8.0.1) After changed service-workers with the same version worked..
61,824,118
I've been working on integrating FCM in my Vue PWA app. So far I've managed to get the background notification working, but handling notifications when the app's on the foreground doesn't work. Here's my code. ### `src/App.vue` ```js import firebase from './plugins/firebase' export default { // Other stuff here......
2020/05/15
[ "https://Stackoverflow.com/questions/61824118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2190916/" ]
I've found a solution in another QA here in StackOverflow (which I can't find anymore for some reason). Turns out you have to use Firebase API v7.8.0 instead of 5.5.6 like the docs said at the time. So those first two lines in `public/firebase-messaging-sw.js` should read like this instead: ```js importScripts('https...
I had a bunch of issues setting firebase push notifications for Vue 3 (with Vite), and I had PWA support enabled with `vite-plugin-pwa`, so it felt like I was flying blind half the time. I was finally able to set up support for PWA, but then I ran into the following issues: * I was getting notifications in the backgro...
61,824,118
I've been working on integrating FCM in my Vue PWA app. So far I've managed to get the background notification working, but handling notifications when the app's on the foreground doesn't work. Here's my code. ### `src/App.vue` ```js import firebase from './plugins/firebase' export default { // Other stuff here......
2020/05/15
[ "https://Stackoverflow.com/questions/61824118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2190916/" ]
Same issue i was faced. In my case firebase version in **"package.json"** and **"firebase-messaging-sw.js"** importScripts version was different. After set same version in **"firebase-messaging-sw.js"** importScripts which was in **"package.json"**, my issue is resolved. **Before change** ``` **"package.json"** "f...
In my case the version on `package.json` (8.2.1) was different from the actual SDK\_VERSION (8.0.1) After changed service-workers with the same version worked..
61,824,118
I've been working on integrating FCM in my Vue PWA app. So far I've managed to get the background notification working, but handling notifications when the app's on the foreground doesn't work. Here's my code. ### `src/App.vue` ```js import firebase from './plugins/firebase' export default { // Other stuff here......
2020/05/15
[ "https://Stackoverflow.com/questions/61824118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2190916/" ]
Same issue i was faced. In my case firebase version in **"package.json"** and **"firebase-messaging-sw.js"** importScripts version was different. After set same version in **"firebase-messaging-sw.js"** importScripts which was in **"package.json"**, my issue is resolved. **Before change** ``` **"package.json"** "f...
I had a bunch of issues setting firebase push notifications for Vue 3 (with Vite), and I had PWA support enabled with `vite-plugin-pwa`, so it felt like I was flying blind half the time. I was finally able to set up support for PWA, but then I ran into the following issues: * I was getting notifications in the backgro...
27,322,408
[JSFIDDLE demo](http://jsfiddle.net/rd61ao0f/1) HTML ``` <div class="ratio-1439-330 bg-cover" style="background-image: url('https://www.agtinternational.com/wp-content/uploads/2013/11/City-solution.jpg');"> <div class="l-center" style="max-width: 1240px;"> <div class="square-logo bg-cover" st...
2014/12/05
[ "https://Stackoverflow.com/questions/27322408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/524666/" ]
You are calling cellForRowAtIndexPath outside of a tableView reload. This will either give you a reused cell or a brand new instance but not the cell shown on the screen at the time. What you should do is call `reloadRowsAtIndexPaths:withRowAnimation.` Your code should have a dataSource that you update where you are...
I don't think accessing a cell the way you did is a good idea. I would suggest this in your - (UITableViewCell \*)tableView:(UITableView \*)tableView cellForRowAtIndexPath:(NSIndexPath \*)indexPath have the following line ``` cell.bottomLabel.text = [NSString stringWithFormat:@"%.1f MB of %.1f MB", megaBytesDownloade...
27,322,408
[JSFIDDLE demo](http://jsfiddle.net/rd61ao0f/1) HTML ``` <div class="ratio-1439-330 bg-cover" style="background-image: url('https://www.agtinternational.com/wp-content/uploads/2013/11/City-solution.jpg');"> <div class="l-center" style="max-width: 1240px;"> <div class="square-logo bg-cover" st...
2014/12/05
[ "https://Stackoverflow.com/questions/27322408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/524666/" ]
You are calling cellForRowAtIndexPath outside of a tableView reload. This will either give you a reused cell or a brand new instance but not the cell shown on the screen at the time. What you should do is call `reloadRowsAtIndexPaths:withRowAnimation.` Your code should have a dataSource that you update where you are...
I would try using: ``` - (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation ``` Instead directly assigning values to table cell.
32,070,949
I would like to prompt the user to give me input in my android application using a dialog. When the user puts the figure it will go to another screen, but it does not give the user to input the value it does not waiting to the user its going to another activity directly. What can i do to waiting the user to input the v...
2015/08/18
[ "https://Stackoverflow.com/questions/32070949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4881731/" ]
You are using the default modifier,declare the fields as public then you'll be able to access it in such way: ``` user.name; user.surname; ```
You did'nt call of a right way the attributes in your method, you have to change `userObject.getUserName()` for `userObject.name.toString()` The code will be like this: --------------------------- ``` public void readUsersSugarDB() { // SUGAR DB TEST try { List<User> users = User.listAll(U...
9,537,636
I have a site which has been redeveloped and the URLs are totally different. I've hundreds or 301 to do (the original URLs many were very long - I have no idea why) and I'm getting some funny results where some redirects are happening and others are redirecting, but to odd URLs. I was wondering if there is a specific o...
2012/03/02
[ "https://Stackoverflow.com/questions/9537636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1245615/" ]
You need to place the most specific at the top and the least specific at the bottom. Also, make sure you're halting processing using [L] after each redirect rule to make sure apache doesn't process additional rewrite rules after it has found a rule that matches. Could you please post your .htaccess file?
Order is only important if there are multiple match lines (e.g. if you are also using `RedirectMatch` or the mod\_rewrite `RewriteEngine On` which can interact with redirect directives. You will experience a performance hit parsing 100s of rule in an htaccess file, especially if the match rate is now small. If your cu...
4,773,208
How any method of WCF application can return custom collection to calling environment. please help with sample code. thanks.
2011/01/23
[ "https://Stackoverflow.com/questions/4773208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/508127/" ]
Give this a try ``` Update t Set t.yyyy = q.Name From TableToUpdate t Join AddressTable q on q.Address = t.Address ``` This assumes that Address field (which you are joining on) is a one to one relationship with the Address field in the table you are updating This can also be written ``` Update TableToUpdate Set y...
If you're using SQL Server 2005 or up (which you didn't specify ....), you can use a Common Table Expression (CTE): ``` ;WITH UpdateData AS ( SELECT FullName, Address FROM dbo.SomeTableYouUse WHERE (some critiera) ) UPDATE dbo.yyy SET fullname = ud.FullName FROM Up...
52,626,696
Is it safe to use 'com.apple.system.config.network\_change' notification to detect network reachability changes? Or is it considered to be a private API? For now my code looks like this: ``` CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), nil, ...
2018/10/03
[ "https://Stackoverflow.com/questions/52626696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10363555/" ]
Write your listener code inside `onCreate` or other function & call from `onCreate`. Like this : ``` @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //initialize the button Button btn = (Button) findViewById(R.id....
`Button` initialize and set `OnClickListener` should be in `onCreate` method. Like this: ``` public class MainActivity extends AppCompatActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main) /...
52,626,696
Is it safe to use 'com.apple.system.config.network\_change' notification to detect network reachability changes? Or is it considered to be a private API? For now my code looks like this: ``` CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), nil, ...
2018/10/03
[ "https://Stackoverflow.com/questions/52626696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10363555/" ]
Write your listener code inside `onCreate` or other function & call from `onCreate`. Like this : ``` @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //initialize the button Button btn = (Button) findViewById(R.id....
Try this code in java.. ``` public class MainActivity2 extends AppCompatActivity implements View.OnClickListener { private Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } /** * this method initialized a...
52,626,696
Is it safe to use 'com.apple.system.config.network\_change' notification to detect network reachability changes? Or is it considered to be a private API? For now my code looks like this: ``` CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), nil, ...
2018/10/03
[ "https://Stackoverflow.com/questions/52626696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10363555/" ]
Write your listener code inside `onCreate` or other function & call from `onCreate`. Like this : ``` @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //initialize the button Button btn = (Button) findViewById(R.id....
Try this `onCreate` method: ``` //initialize the button Button btn = (Button) findViewById(R.id.button); // set the button action btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { goToSecondPage(); } }) ```
52,626,696
Is it safe to use 'com.apple.system.config.network\_change' notification to detect network reachability changes? Or is it considered to be a private API? For now my code looks like this: ``` CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), nil, ...
2018/10/03
[ "https://Stackoverflow.com/questions/52626696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10363555/" ]
`Button` initialize and set `OnClickListener` should be in `onCreate` method. Like this: ``` public class MainActivity extends AppCompatActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main) /...
Try this code in java.. ``` public class MainActivity2 extends AppCompatActivity implements View.OnClickListener { private Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } /** * this method initialized a...
52,626,696
Is it safe to use 'com.apple.system.config.network\_change' notification to detect network reachability changes? Or is it considered to be a private API? For now my code looks like this: ``` CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), nil, ...
2018/10/03
[ "https://Stackoverflow.com/questions/52626696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10363555/" ]
`Button` initialize and set `OnClickListener` should be in `onCreate` method. Like this: ``` public class MainActivity extends AppCompatActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main) /...
Try this `onCreate` method: ``` //initialize the button Button btn = (Button) findViewById(R.id.button); // set the button action btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { goToSecondPage(); } }) ```
52,626,696
Is it safe to use 'com.apple.system.config.network\_change' notification to detect network reachability changes? Or is it considered to be a private API? For now my code looks like this: ``` CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), nil, ...
2018/10/03
[ "https://Stackoverflow.com/questions/52626696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10363555/" ]
Try this code in java.. ``` public class MainActivity2 extends AppCompatActivity implements View.OnClickListener { private Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } /** * this method initialized a...
Try this `onCreate` method: ``` //initialize the button Button btn = (Button) findViewById(R.id.button); // set the button action btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { goToSecondPage(); } }) ```
25,855,308
I need to take a long (max resolution) image and wrap it into a circle. So imagine bending a steel bar so that it is now circular with each end touching. ![quick and dirty illustration](https://i.imgur.com/KUfqEYP.jpg) I have been banging my head against threejs for the last 8 hours and have so far managed to apply ...
2014/09/15
[ "https://Stackoverflow.com/questions/25855308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1031830/" ]
I had the same issue with Luna. I installed Java 1.7.0\_80, which then allowed me to change to the C/C++ Perspective and create new C/C++ projects. My system previously only had Java 1.6.0\_45, which was sufficient to run Luna but apparently insufficient to run CDT in its entirety.
Your JDK version is below 1.6 which is too old. You should upgrade it to 1.7 or higher.
25,855,308
I need to take a long (max resolution) image and wrap it into a circle. So imagine bending a steel bar so that it is now circular with each end touching. ![quick and dirty illustration](https://i.imgur.com/KUfqEYP.jpg) I have been banging my head against threejs for the last 8 hours and have so far managed to apply ...
2014/09/15
[ "https://Stackoverflow.com/questions/25855308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1031830/" ]
I had the same issue with Luna. I installed Java 1.7.0\_80, which then allowed me to change to the C/C++ Perspective and create new C/C++ projects. My system previously only had Java 1.6.0\_45, which was sufficient to run Luna but apparently insufficient to run CDT in its entirety.
I had the same problem - installing java 8 helped.
25,855,308
I need to take a long (max resolution) image and wrap it into a circle. So imagine bending a steel bar so that it is now circular with each end touching. ![quick and dirty illustration](https://i.imgur.com/KUfqEYP.jpg) I have been banging my head against threejs for the last 8 hours and have so far managed to apply ...
2014/09/15
[ "https://Stackoverflow.com/questions/25855308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1031830/" ]
I had the same issue with Luna. I installed Java 1.7.0\_80, which then allowed me to change to the C/C++ Perspective and create new C/C++ projects. My system previously only had Java 1.6.0\_45, which was sufficient to run Luna but apparently insufficient to run CDT in its entirety.
I had exactly the same problem, using Luna SR 1a on Ubuntu 12.04 LTS. Switching from Java 1.6.0\_34 to 1.7.0\_75 fixed the issue - everything works now
21,509,619
I need to place two EditText side by side, the left one can be multiline, but the right one has to be just one line. I've used a table layout with just one row but I have the following problem, the second column should have just the enough room to show the one single line text but not more. How can I achive that? Thank...
2014/02/02
[ "https://Stackoverflow.com/questions/21509619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1331539/" ]
Make second TextView without `android:layout_weight="1"`
***Just change in your 2nd TextView:*** ``` android:layout_width="0dp" ``` > > Instead of > > > ``` android:layout_width="wrap_content" ```
59,576,738
I am working on a Ecommerce Site which needs API's for its mobile application. Seeing the implementation issues at first of GraphQL made me think of integrating **GraphQL** for querying data and **REST** for the mutation operations (store, update, delete). Is it ok to do these things or should I just stick with any on...
2020/01/03
[ "https://Stackoverflow.com/questions/59576738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3871887/" ]
There's plenty of individual cases where it's more appropriate or even necessary to have separate endpoints. To name a few: authentication, file uploads, third-party webhooks, or any requests that should return something other than JSON. Saying that all operations with side-effects should be done through separate end...
I would recommend to stick with a single approach because of the following reasons 1) predictive changes to cached data after the operation otherwise you would have to write lot of duct tape code to ensure that the `REST` based updates mutates the cached data on the client. 2) Single pattern for code maintenance and ...
60,361,470
I am new to phaser and game development. I followed the below tutorial. <https://medium.com/@michaelwesthadley/modular-game-worlds-in-phaser-3-tilemaps-1-958fc7e6bbd6> I downloaded and Tiled software and made a simple map with a tileset I got from OpenGameArt.org. Unfortunately, nothing gets loaded on the browser sc...
2020/02/23
[ "https://Stackoverflow.com/questions/60361470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9066431/" ]
UPDATE: Check this file structure -- <https://next.plnkr.co/edit/OqywHzLC80aZMGeF> ====== Need to see the JSON file to completely understand the issue, but I will just try to speculate. Make sure your JSON file has below settings correctly: ``` "tilesets":[ { "image":"path/to/GoldBricks.png", "n...
I had a similar problem myself, the solution was going back to Tiled software and check: 'Embed tileset' on each tileset of the map.
60,361,470
I am new to phaser and game development. I followed the below tutorial. <https://medium.com/@michaelwesthadley/modular-game-worlds-in-phaser-3-tilemaps-1-958fc7e6bbd6> I downloaded and Tiled software and made a simple map with a tileset I got from OpenGameArt.org. Unfortunately, nothing gets loaded on the browser sc...
2020/02/23
[ "https://Stackoverflow.com/questions/60361470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9066431/" ]
UPDATE: Check this file structure -- <https://next.plnkr.co/edit/OqywHzLC80aZMGeF> ====== Need to see the JSON file to completely understand the issue, but I will just try to speculate. Make sure your JSON file has below settings correctly: ``` "tilesets":[ { "image":"path/to/GoldBricks.png", "n...
Alright, I asked in the phaser community forum itself and got some help. The tilemap layer is taller than the game canvas so the visible tiles are out of sight. The solution is to add the below code in the `create` function. ``` this.cameras.main.centerOn(800, 1300); ```
60,361,470
I am new to phaser and game development. I followed the below tutorial. <https://medium.com/@michaelwesthadley/modular-game-worlds-in-phaser-3-tilemaps-1-958fc7e6bbd6> I downloaded and Tiled software and made a simple map with a tileset I got from OpenGameArt.org. Unfortunately, nothing gets loaded on the browser sc...
2020/02/23
[ "https://Stackoverflow.com/questions/60361470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9066431/" ]
Alright, I asked in the phaser community forum itself and got some help. The tilemap layer is taller than the game canvas so the visible tiles are out of sight. The solution is to add the below code in the `create` function. ``` this.cameras.main.centerOn(800, 1300); ```
I had a similar problem myself, the solution was going back to Tiled software and check: 'Embed tileset' on each tileset of the map.
12,384,188
In rails, if I want to override an attribute method, eg. a setter, or getter etc, I might need the instance method to be defined. However, activerecord does not define attribute methods until an instance is first synchronized. This can be seen in: ``` class MyModel < ActiveRecord::Base end MyModel.attribute_methods...
2012/09/12
[ "https://Stackoverflow.com/questions/12384188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1578925/" ]
<https://github.com/claudemamo/file-attach-cordova-upload-jqm> use this
This JavaScript function, confirms that the user has selected a file to upload. If the user has not selected a file, then the function displays an error message. ``` <script type="text/javascript"> function checkForFile() { if (document.getElementById('file').value) { return true; } document.getElemen...
41,592,833
I have this input: `<input type="checkbox" ng-model="area.id" data-id="{{area.id}}"/>` and some `ng-click` action above, I'm trying to collect all selected checkboxes id's but after check action `data-id` attribute turns to `true/false`, why? Function from controller: ``` collectSelectedAreas($event) { let sele...
2017/01/11
[ "https://Stackoverflow.com/questions/41592833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1029486/" ]
Use `float: left;` for the `p` inside `.inline-block`: ```css .inline-block { display: inline-block; width: 100%; } .inline-block p{ float: left; } ``` ```html <link href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" rel="stylesheet" /> <script src="https://ajax.googleapis.co...
Just add this code to your CSS ``` .inline-block > p { float: left; } ```
41,592,833
I have this input: `<input type="checkbox" ng-model="area.id" data-id="{{area.id}}"/>` and some `ng-click` action above, I'm trying to collect all selected checkboxes id's but after check action `data-id` attribute turns to `true/false`, why? Function from controller: ``` collectSelectedAreas($event) { let sele...
2017/01/11
[ "https://Stackoverflow.com/questions/41592833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1029486/" ]
Just add this code to your CSS ``` .inline-block > p { float: left; } ```
Just modify your css with this ```css .inline-block { display: inline-block; } p{ display:inline-block; } select{ display:inline-block; } ``` ```html <link href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" rel="stylesheet" /> <script src="https://ajax.googleapis.com/ajax/libs/jquer...
41,592,833
I have this input: `<input type="checkbox" ng-model="area.id" data-id="{{area.id}}"/>` and some `ng-click` action above, I'm trying to collect all selected checkboxes id's but after check action `data-id` attribute turns to `true/false`, why? Function from controller: ``` collectSelectedAreas($event) { let sele...
2017/01/11
[ "https://Stackoverflow.com/questions/41592833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1029486/" ]
Just add this code to your CSS ``` .inline-block > p { float: left; } ```
You can specify your CSS as : ``` .inline-block { /* select the class */ display: inline-block; } .inline-block *{ /* select all the child element */ display: inline-block; } ``` Adding any element to your class will be aligned in a single line.
41,592,833
I have this input: `<input type="checkbox" ng-model="area.id" data-id="{{area.id}}"/>` and some `ng-click` action above, I'm trying to collect all selected checkboxes id's but after check action `data-id` attribute turns to `true/false`, why? Function from controller: ``` collectSelectedAreas($event) { let sele...
2017/01/11
[ "https://Stackoverflow.com/questions/41592833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1029486/" ]
Use `float: left;` for the `p` inside `.inline-block`: ```css .inline-block { display: inline-block; width: 100%; } .inline-block p{ float: left; } ``` ```html <link href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" rel="stylesheet" /> <script src="https://ajax.googleapis.co...
Just modify your css with this ```css .inline-block { display: inline-block; } p{ display:inline-block; } select{ display:inline-block; } ``` ```html <link href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" rel="stylesheet" /> <script src="https://ajax.googleapis.com/ajax/libs/jquer...
41,592,833
I have this input: `<input type="checkbox" ng-model="area.id" data-id="{{area.id}}"/>` and some `ng-click` action above, I'm trying to collect all selected checkboxes id's but after check action `data-id` attribute turns to `true/false`, why? Function from controller: ``` collectSelectedAreas($event) { let sele...
2017/01/11
[ "https://Stackoverflow.com/questions/41592833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1029486/" ]
Use `float: left;` for the `p` inside `.inline-block`: ```css .inline-block { display: inline-block; width: 100%; } .inline-block p{ float: left; } ``` ```html <link href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" rel="stylesheet" /> <script src="https://ajax.googleapis.co...
You can specify your CSS as : ``` .inline-block { /* select the class */ display: inline-block; } .inline-block *{ /* select all the child element */ display: inline-block; } ``` Adding any element to your class will be aligned in a single line.
30,936,170
I'm having trouble getting Angular, CORS, SpringSecurity and Basic Authentication to play nicely. I have the following Angular Ajax call where I'm trying to set the header to include a Basic Authorization header in the request. ``` var headerObj = {headers: {'Authorization': 'Basic am9lOnNlY3JldA=='}}; return $http.ge...
2015/06/19
[ "https://Stackoverflow.com/questions/30936170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5027831/" ]
The problem was that angular was sending an HTTP OPTIONS request without the HTTP Authorization header. Spring security was then processing that request and sending back a 401 Unauthorized response. So my angular app was getting a 401 response from spring on the OPTIONS request rather than a 200 response telling angula...
A bit late to the party, but I encountered a similar problem, and thought my soulution might help someone. Joe Rice's soulution really helped me, but I had to make some modifications. I should also mention that I'm not an expert on Spring or Tomcat, so this is probably not a perfect solution. I have a setup with a Rea...
18,833,968
Let's say I have the following for example's sake: ``` $string = "^4Hello World ^5Foo^8Bar"; ``` I'm currently using the following function to replace the carets and adjoining numbers, which is the closest I could get to what I wanted. ``` function addColours($input) { $var = $input; $var = str_replace('^0'...
2013/09/16
[ "https://Stackoverflow.com/questions/18833968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2615209/" ]
How about this then? ``` function addColours($input) { $out = ''; $replacements = array( '1' => '000000', '2' => 'ff0000' ); foreach(explode('^', $input) as $span) { if(in_array($span[0], array_keys($replacements))) { $out .= '<span style="color: #' . $repl...
You really need to be running a preg replace, not a strreplace. The problem you will still run into here is that you need to find a patter such as '^4Some Sentance ^' so that you can end the span correctly. But what would happen if the entry was the last time a tag was used and it wasn't closed? It would fail. I recom...
18,833,968
Let's say I have the following for example's sake: ``` $string = "^4Hello World ^5Foo^8Bar"; ``` I'm currently using the following function to replace the carets and adjoining numbers, which is the closest I could get to what I wanted. ``` function addColours($input) { $var = $input; $var = str_replace('^0'...
2013/09/16
[ "https://Stackoverflow.com/questions/18833968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2615209/" ]
This is what i was talking about in the comments: ``` $colorMap = array( '000000', // 0 'ff0000', // 1 '00ff00', // 2... ); $template = '<span style="color:#%s">%s</span>'; // split by "^" followed by 0-9 $parts = preg_split('/\^(\d)/', $string, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTU...
You really need to be running a preg replace, not a strreplace. The problem you will still run into here is that you need to find a patter such as '^4Some Sentance ^' so that you can end the span correctly. But what would happen if the entry was the last time a tag was used and it wasn't closed? It would fail. I recom...
18,833,968
Let's say I have the following for example's sake: ``` $string = "^4Hello World ^5Foo^8Bar"; ``` I'm currently using the following function to replace the carets and adjoining numbers, which is the closest I could get to what I wanted. ``` function addColours($input) { $var = $input; $var = str_replace('^0'...
2013/09/16
[ "https://Stackoverflow.com/questions/18833968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2615209/" ]
This is what i was talking about in the comments: ``` $colorMap = array( '000000', // 0 'ff0000', // 1 '00ff00', // 2... ); $template = '<span style="color:#%s">%s</span>'; // split by "^" followed by 0-9 $parts = preg_split('/\^(\d)/', $string, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTU...
How about this then? ``` function addColours($input) { $out = ''; $replacements = array( '1' => '000000', '2' => 'ff0000' ); foreach(explode('^', $input) as $span) { if(in_array($span[0], array_keys($replacements))) { $out .= '<span style="color: #' . $repl...
18,833,968
Let's say I have the following for example's sake: ``` $string = "^4Hello World ^5Foo^8Bar"; ``` I'm currently using the following function to replace the carets and adjoining numbers, which is the closest I could get to what I wanted. ``` function addColours($input) { $var = $input; $var = str_replace('^0'...
2013/09/16
[ "https://Stackoverflow.com/questions/18833968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2615209/" ]
How about this then? ``` function addColours($input) { $out = ''; $replacements = array( '1' => '000000', '2' => 'ff0000' ); foreach(explode('^', $input) as $span) { if(in_array($span[0], array_keys($replacements))) { $out .= '<span style="color: #' . $repl...
Here's my two cents. It's the closest to the OPs code, and doesn't require manual rebuilding of the string. ``` function addColours($input) { $var = $input; $var = preg_replace('/\^0(.*?)((\^\d)|($))/', '<span style="color: #000000">$1</span>$2', $var); $var = preg_replace('/\^1(.*?)((\^\d)|($))/', '<span styl...
18,833,968
Let's say I have the following for example's sake: ``` $string = "^4Hello World ^5Foo^8Bar"; ``` I'm currently using the following function to replace the carets and adjoining numbers, which is the closest I could get to what I wanted. ``` function addColours($input) { $var = $input; $var = str_replace('^0'...
2013/09/16
[ "https://Stackoverflow.com/questions/18833968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2615209/" ]
This is what i was talking about in the comments: ``` $colorMap = array( '000000', // 0 'ff0000', // 1 '00ff00', // 2... ); $template = '<span style="color:#%s">%s</span>'; // split by "^" followed by 0-9 $parts = preg_split('/\^(\d)/', $string, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTU...
Here's my two cents. It's the closest to the OPs code, and doesn't require manual rebuilding of the string. ``` function addColours($input) { $var = $input; $var = preg_replace('/\^0(.*?)((\^\d)|($))/', '<span style="color: #000000">$1</span>$2', $var); $var = preg_replace('/\^1(.*?)((\^\d)|($))/', '<span styl...
26,982,032
**Edit:** TL;DR Is there anyone who uses Magento Rest API with angularjs and could give me some hints on how to get started with OAuth? I'm trying to use the magento Rest API with angularjs. My Problem is that I don't even get the initiate endpoint to work. To calculate the signature I used <https://github.com/bet...
2014/11/17
[ "https://Stackoverflow.com/questions/26982032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4262924/" ]
After a lot of help from Nic Raboy we got it included in his OAuth Library: [ng-cordova-oauth](https://github.com/nraboy/ng-cordova-oauth) The library does all the signing, nonce calculation and everything else that is needed. It does however require to run on cordova (using the inAppBrowser plugin). Before that wor...
I am just using OAuth in PHP. I hope to it help you. Look this example link. When use 'oauth/initiate', oauth\_callback is included on URL. Write it both sides <http://www.magentocommerce.com/api/rest/authentication/oauth_authentication.html#OAuthAuthentication-PHPExamples> And I saw other OAuth header there are usi...
47,586,867
> > I want to calculate how many number of months in particular year? For example > In 1.5 year how many month are ? It's simple but programmatically how do i calculate this?? > Please can anybody tell me?? > > >
2017/12/01
[ "https://Stackoverflow.com/questions/47586867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4823598/" ]
If you know the number of Year(s), `1.5`, you would calculate this by multiplying it by the number of Months in a year, `12`. ``` function calcMonths($y){ return $y * 12; } ``` Input: 1.5, Output: 18.
If you have Start Date and End Date then it will easy to calculate months between those two dates try below Code. ``` $date1 = '2000-01-25'; $date2 = '2010-02-20'; $ts1 = strtotime($date1); $ts2 = strtotime($date2); $year1 = date('Y', $ts1); $year2 = date('Y', $ts2); $month1 = date('m', $ts1); $month2 = date('m', $...
82,247
Please suggest some good books for the person who is going to setup windows server 2008 & sql server 2008 for shared hosting service.
2009/11/06
[ "https://serverfault.com/questions/82247", "https://serverfault.com", "https://serverfault.com/users/21002/" ]
"Windows Server 2008 Unleashed" by SAMS Publishing and "Introducing Microsoft SQL Server 2008" by Microsoft Press are good books.
Whenever somebody asks for a book recommendation, I always feel compelled to mention O'Reilly's [Safari Books Online](http://www.safaribooksonline.com/Corporate/Index/). It's an amazing resource of online books from many publishers. I think I pay about $40 per month and I get full access to thousands of titles. (actual...
82,247
Please suggest some good books for the person who is going to setup windows server 2008 & sql server 2008 for shared hosting service.
2009/11/06
[ "https://serverfault.com/questions/82247", "https://serverfault.com", "https://serverfault.com/users/21002/" ]
"Windows Server 2008 Unleashed" by SAMS Publishing and "Introducing Microsoft SQL Server 2008" by Microsoft Press are good books.
After you are comfortable with the technology side of Windows and SQL Server then you should be ready for the looking at Systems Administration as a profession - [The Practice of System and Network Administration](http://rads.stackoverflow.com/amzn/click/0321492668).
82,247
Please suggest some good books for the person who is going to setup windows server 2008 & sql server 2008 for shared hosting service.
2009/11/06
[ "https://serverfault.com/questions/82247", "https://serverfault.com", "https://serverfault.com/users/21002/" ]
Whenever somebody asks for a book recommendation, I always feel compelled to mention O'Reilly's [Safari Books Online](http://www.safaribooksonline.com/Corporate/Index/). It's an amazing resource of online books from many publishers. I think I pay about $40 per month and I get full access to thousands of titles. (actual...
After you are comfortable with the technology side of Windows and SQL Server then you should be ready for the looking at Systems Administration as a profession - [The Practice of System and Network Administration](http://rads.stackoverflow.com/amzn/click/0321492668).
34,901,756
``` import re phoneNumberRegex = re.compile(r'\d{3}-\d{3}-\d{4}') mo = phoneNumberRegex.search('My number is 415-55-4242.') print('Phone number found: ' + mo.group(0)) ``` This is the method I have used tried to find some mistakes with the code all resulted in this error ``` Traceback (most recent call last): Fil...
2016/01/20
[ "https://Stackoverflow.com/questions/34901756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5406550/" ]
Usage of [`MatchObject.group`](https://docs.python.org/3/library/re.html#re.match.group) is okay. But, `415-55-4242` does not match `\d{3}-\d{3}-\d{4}` because the middle part of the string contains only 2 digits. ``` >>> import re >>> re.search(r'\d{3}-\d{3}-\d{4}', 'My number is 415-55-4242.') # does not match => ...
It works -- group is the right method. However, you need a capturing group in you regex, and the regex is also a bit wrong. Use this code instead: ``` import re phoneNumberRegex = re.compile(r'(\d{3}-\d{2}-\d{4})') mo = phoneNumberRegex.search('My number is 415-55-4242.') print(mo.group(0)) ```
3,333,990
For what values of $\alpha,\beta \in \mathbb{R}$ will the function $$f:(0,1]\times(0,1] \to \mathbb{R}: (x,y) \mapsto x^\alpha y^\alpha (x+y)^\beta$$ be integrable? Normally, I don't have problems solving these integrals using Fubini's theorem and by a change of variables. However, I don't seem to find the right chang...
2019/08/25
[ "https://math.stackexchange.com/questions/3333990", "https://math.stackexchange.com", "https://math.stackexchange.com/users/356160/" ]
Let $C = (0, 1]^2$. I assume by $f$ being integrable you mean that $\int\_C f < \infty$ (here and throughout I use $\int\_A f$ to denote $\iint\_A f \,dxdy$). First we'll show that $\int\_C f < \infty$ implies $\alpha > -1$. Let $D = (0, 1] \times [1/2, 1]$, so since $D \subset C$ we have $\int\_C f \geq \int\_D f ...
In the meantime, I did find some change of variables which might allow a simpler way to verify the integrability. If we perform a change of variables $y\mapsto xy$, this gives the integral $$\int\_0^1\int\_0^{1/x}x^{2\alpha +\beta+1} y^\alpha(1+y)^\beta dy\, dx$$ where the integrability can be easily verified.
229,501
During the COVID-19 pandemic, many of us are working from home using meeting apps like Zoom. It's all over the news that Zoom is lacking in its E2E encryption. Let's assume we're using Zoom and can't switch apps. Considering only the traffic, how can we make these meetings secured/encrypted? The solution can be hard...
2020/04/09
[ "https://security.stackexchange.com/questions/229501", "https://security.stackexchange.com", "https://security.stackexchange.com/users/206331/" ]
You cannot magically secure applications like Zoom without changing the application and the infrastructure it relies on. The missing end-to-end encryption you want to have fixed is due to the basic architecture of Zoom, in which media streams are processed and mixed together on a central server (which is owned by Zoo...
A somewhat trite answer - don't use zoom's native software.. Instead - look around for the "dial-in number" and call the meeting using a regular telephone. Downsides, you won't get the video stream, and the user creating the meeting has to be in credit and a paying customer. These are not available in the free accou...
229,501
During the COVID-19 pandemic, many of us are working from home using meeting apps like Zoom. It's all over the news that Zoom is lacking in its E2E encryption. Let's assume we're using Zoom and can't switch apps. Considering only the traffic, how can we make these meetings secured/encrypted? The solution can be hard...
2020/04/09
[ "https://security.stackexchange.com/questions/229501", "https://security.stackexchange.com", "https://security.stackexchange.com/users/206331/" ]
You cannot magically secure applications like Zoom without changing the application and the infrastructure it relies on. The missing end-to-end encryption you want to have fixed is due to the basic architecture of Zoom, in which media streams are processed and mixed together on a central server (which is owned by Zoo...
*TL;DR: Specifically for Zoom, take a look at [Zoom Meeting Connector](https://support.zoom.us/hc/en-us/sections/200305473-Meeting-Connector)* First off, to get it out of the way, **encrypted** is not the same as **secure**, and **secure** can be vague depending context. As schroeder♦ have commented, you need to be c...
229,501
During the COVID-19 pandemic, many of us are working from home using meeting apps like Zoom. It's all over the news that Zoom is lacking in its E2E encryption. Let's assume we're using Zoom and can't switch apps. Considering only the traffic, how can we make these meetings secured/encrypted? The solution can be hard...
2020/04/09
[ "https://security.stackexchange.com/questions/229501", "https://security.stackexchange.com", "https://security.stackexchange.com/users/206331/" ]
You cannot magically secure applications like Zoom without changing the application and the infrastructure it relies on. The missing end-to-end encryption you want to have fixed is due to the basic architecture of Zoom, in which media streams are processed and mixed together on a central server (which is owned by Zoo...
While it is not possible to make E2E encrypted connections with Zoom, your company can probably use an open-source and self-hosted solution like Jitsi. It encrypts the connections between the participants and the server, and only the participants and the server will have the data unencrypted. So, because you can host ...
229,501
During the COVID-19 pandemic, many of us are working from home using meeting apps like Zoom. It's all over the news that Zoom is lacking in its E2E encryption. Let's assume we're using Zoom and can't switch apps. Considering only the traffic, how can we make these meetings secured/encrypted? The solution can be hard...
2020/04/09
[ "https://security.stackexchange.com/questions/229501", "https://security.stackexchange.com", "https://security.stackexchange.com/users/206331/" ]
*TL;DR: Specifically for Zoom, take a look at [Zoom Meeting Connector](https://support.zoom.us/hc/en-us/sections/200305473-Meeting-Connector)* First off, to get it out of the way, **encrypted** is not the same as **secure**, and **secure** can be vague depending context. As schroeder♦ have commented, you need to be c...
A somewhat trite answer - don't use zoom's native software.. Instead - look around for the "dial-in number" and call the meeting using a regular telephone. Downsides, you won't get the video stream, and the user creating the meeting has to be in credit and a paying customer. These are not available in the free accou...
229,501
During the COVID-19 pandemic, many of us are working from home using meeting apps like Zoom. It's all over the news that Zoom is lacking in its E2E encryption. Let's assume we're using Zoom and can't switch apps. Considering only the traffic, how can we make these meetings secured/encrypted? The solution can be hard...
2020/04/09
[ "https://security.stackexchange.com/questions/229501", "https://security.stackexchange.com", "https://security.stackexchange.com/users/206331/" ]
While it is not possible to make E2E encrypted connections with Zoom, your company can probably use an open-source and self-hosted solution like Jitsi. It encrypts the connections between the participants and the server, and only the participants and the server will have the data unencrypted. So, because you can host ...
A somewhat trite answer - don't use zoom's native software.. Instead - look around for the "dial-in number" and call the meeting using a regular telephone. Downsides, you won't get the video stream, and the user creating the meeting has to be in credit and a paying customer. These are not available in the free accou...
229,501
During the COVID-19 pandemic, many of us are working from home using meeting apps like Zoom. It's all over the news that Zoom is lacking in its E2E encryption. Let's assume we're using Zoom and can't switch apps. Considering only the traffic, how can we make these meetings secured/encrypted? The solution can be hard...
2020/04/09
[ "https://security.stackexchange.com/questions/229501", "https://security.stackexchange.com", "https://security.stackexchange.com/users/206331/" ]
*TL;DR: Specifically for Zoom, take a look at [Zoom Meeting Connector](https://support.zoom.us/hc/en-us/sections/200305473-Meeting-Connector)* First off, to get it out of the way, **encrypted** is not the same as **secure**, and **secure** can be vague depending context. As schroeder♦ have commented, you need to be c...
While it is not possible to make E2E encrypted connections with Zoom, your company can probably use an open-source and self-hosted solution like Jitsi. It encrypts the connections between the participants and the server, and only the participants and the server will have the data unencrypted. So, because you can host ...
48,313,291
I'm trying to use AWS Cognito in a Lambda function to authorize a user. I have some sample code from a Udemy Course (no longer available): <https://www.udemy.com/minimum-viable-aws-cognito-user-auth-in-javascript> The code uses the script files: aws-cognito-sdk.min.js amazon-cognito-identity.min.js The second seems...
2018/01/18
[ "https://Stackoverflow.com/questions/48313291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1481505/" ]
Got this working. package.json needs dependencies: ``` "amazon-cognito-identity-js": "^1.31.0", "aws-sdk": "^2.182.0", ``` AWS Lambda does not use Javascript ES6 and so you can't use the 'import' keyword. ``` const AWS = require('aws-sdk'); var AmazonCognitoIdentity = require('amazon-cognito-ident...
I believe you are referring to the amazon-cognito-identity-js npm package here: <https://www.npmjs.com/package/amazon-cognito-identity-js> The NPM package includes both files. The package includes the cognito SDK calls (aws-cognito-sdk). It also depends on the core AWS SDK.
48,313,291
I'm trying to use AWS Cognito in a Lambda function to authorize a user. I have some sample code from a Udemy Course (no longer available): <https://www.udemy.com/minimum-viable-aws-cognito-user-auth-in-javascript> The code uses the script files: aws-cognito-sdk.min.js amazon-cognito-identity.min.js The second seems...
2018/01/18
[ "https://Stackoverflow.com/questions/48313291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1481505/" ]
For Lambdas use the `aws-sdk` module as such: ``` const { CognitoIdentityServiceProvider } = require('aws-sdk') //or const CognitoIdentityServiceProvider = require('aws-sdk/clients/cognitoidentityserviceprovider') // Much smaller size ``` For authentication use the [AdminInitiateAuth](https://docs.aws.amazon.com/co...
I believe you are referring to the amazon-cognito-identity-js npm package here: <https://www.npmjs.com/package/amazon-cognito-identity-js> The NPM package includes both files. The package includes the cognito SDK calls (aws-cognito-sdk). It also depends on the core AWS SDK.
34,513,367
Are there any Fabric.JS Wizards out there? I've done my fair research and I can't seem to find much of an explanation on how to add an image to the fabric.JS canvas. User Journey: a) User uploads an image from an input file type button. b) As soon as they have selected an image from their computer I want to place...
2015/12/29
[ "https://Stackoverflow.com/questions/34513367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5070590/" ]
Upload image from computer with Fabric js. ```js var canvas = new fabric.Canvas('canvas'); document.getElementById('file').addEventListener("change", function (e) { var file = e.target.files[0]; var reader = new FileReader(); reader.onload = function (f) { var data = f.target.result; ...
once you have a dataURL done, you can do either: ``` reader.onload = function(event) { // This stores the image to scope fabric.Image.fromURL(event.target.result, function(img) { canvas.add(img); }); scope.$apply(); }; ``` Or you put on your image tag an onload event...
34,513,367
Are there any Fabric.JS Wizards out there? I've done my fair research and I can't seem to find much of an explanation on how to add an image to the fabric.JS canvas. User Journey: a) User uploads an image from an input file type button. b) As soon as they have selected an image from their computer I want to place...
2015/12/29
[ "https://Stackoverflow.com/questions/34513367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5070590/" ]
Upload image from computer with Fabric js. ```js var canvas = new fabric.Canvas('canvas'); document.getElementById('file').addEventListener("change", function (e) { var file = e.target.files[0]; var reader = new FileReader(); reader.onload = function (f) { var data = f.target.result; ...
This is for drag and drop from desktop using the dataTransfer interface. ``` canvas.on('drop', function(event) { // prevent the file to open in new tab event.e.stopPropagation(); event.e.stopImmediatePropagation(); event.e.preventDefault(); // Use DataTransfer interface to access the file(s) ...
116,421
The words in headlines are capitalized. I'm interested in the history of this. Where and why were capital letters first used in headlines? Where is this practice of capitalization of words in English titles derived from? Is it derived from German?
2013/06/12
[ "https://english.stackexchange.com/questions/116421", "https://english.stackexchange.com", "https://english.stackexchange.com/users/32658/" ]
That seems like an interesting question, so I did a bit of research. The short version of what I found is that headlines have been capitalized as long has there have been newspaper headlines. Read on for the long version. ### Everything Started In All Caps I started with a quick look at the overall development of c...
When and where was there first a "headline"? Capital letters came **first**. Lowercase letters are strictly a recent invention, dating from certain medieval hands; they weren't completely rectified until 1800 or so, when English dropped the "long lowercase S" in words like *ſize* and *poiſon.* Ngram graphs for "poiso...
72,029,069
i have created a new environment and i installed the jupyterlab server and notebook . But i can't find the jupyterlab widget on the Anaconda navigator home , i mean i can start the jupyterlab server with the conda prompt , but sometimes i accidentally close it and all my work is gone. [Where i want to find the jupyterl...
2022/04/27
[ "https://Stackoverflow.com/questions/72029069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18343968/" ]
Did you maybe install the "wrong" version of Jupyterlab or Jupyter Notebook? I did, and when I uninstalled that version, reinstalled a new version, the widget showed up. I installed the version 3.4.2 of JupyterLab and the widget didn't show up. Then I uninstalled it from conda prompt with `conda uninstall jupyterlab`,...
Do you have checked <https://www.geeksforgeeks.org/how-to-setup-conda-environment-with-jupyter-notebook/> or <https://medium.com/@nrk25693/how-to-add-your-conda-environment-to-your-jupyter-notebook-in-just-4-steps-abeab8b8d084> ? Otherwise, I can help in another way. You can also you deepnote for example. It is free, ...
30,877,180
There is a very simple class: ``` public class LinkInformation { public LinkInformation(string link, string text, string group) { this.Link = link; this.Text = text; this.Group = group; } public string Link { get; set; } public string Text { get; set; } public string Gr...
2015/06/16
[ "https://Stackoverflow.com/questions/30877180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/863502/" ]
You need to actually pass the `IEqualityComparer` that you've created to `Disctinct` when you call it. It has two overloads, one accepting no parameters and one accepting an `IEqualityComparer`. If you don't provide a comparer the default is used, and the default comparer doesn't compare the objects as you want them to...
If you want to return distinct elements from sequences of objects of some custom data type, you have to implement the IEquatable generic interface in the class. here is a sample implementation: ``` public class Product : IEquatable<Product> { public string Name { get; set; } public int Code { get; set; } ...
30,877,180
There is a very simple class: ``` public class LinkInformation { public LinkInformation(string link, string text, string group) { this.Link = link; this.Text = text; this.Group = group; } public string Link { get; set; } public string Text { get; set; } public string Gr...
2015/06/16
[ "https://Stackoverflow.com/questions/30877180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/863502/" ]
You need to actually pass the `IEqualityComparer` that you've created to `Disctinct` when you call it. It has two overloads, one accepting no parameters and one accepting an `IEqualityComparer`. If you don't provide a comparer the default is used, and the default comparer doesn't compare the objects as you want them to...
If you are happy with defining the "distinctness" by a single property, you can do ``` list .GroupBy(x => x.Text) .Select(x => x.First()) ``` to get a list of "unique" items. No need to mess around with `IEqualityComparer` et al.
30,877,180
There is a very simple class: ``` public class LinkInformation { public LinkInformation(string link, string text, string group) { this.Link = link; this.Text = text; this.Group = group; } public string Link { get; set; } public string Text { get; set; } public string Gr...
2015/06/16
[ "https://Stackoverflow.com/questions/30877180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/863502/" ]
You need to actually pass the `IEqualityComparer` that you've created to `Disctinct` when you call it. It has two overloads, one accepting no parameters and one accepting an `IEqualityComparer`. If you don't provide a comparer the default is used, and the default comparer doesn't compare the objects as you want them to...
Without using Distinct nor the comparer, how about: ``` list.GroupBy(x => x.ToString()).Select(x => x.First()) ``` I know this solution is not the answer for the exact question, but I think is valid to be open for other solutions.
22,155,827
I am trying to write data into a txt file, but It won't work. there is no error. it just won't work. here is the code ``` if (isset($_REQUEST['submit'])) { $hour = $_REQUEST['hour']; $family = $_REQUEST['family']; $how = $_REQUEST['how']; $will = $_REQUEST['will']; $f...
2014/03/03
[ "https://Stackoverflow.com/questions/22155827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2870449/" ]
You cannot write to it since you are opening it as read-only: ``` $handle = fopen('/1.txt', "r"); ``` Instead: ``` $handle = fopen('/1.txt', "w"); // to write only, if you need to read and write use 'w+' ``` You also need to store fopen in a $handle so you can write to it later. Documentation: <http://www.php.ne...
You have to pass in a 'w' to write to a file. ``` $handle = fopen('/1.txt', "w"); ``` Passing in 'r' makes it so you are opening a 'read-only' file.
22,155,827
I am trying to write data into a txt file, but It won't work. there is no error. it just won't work. here is the code ``` if (isset($_REQUEST['submit'])) { $hour = $_REQUEST['hour']; $family = $_REQUEST['family']; $how = $_REQUEST['how']; $will = $_REQUEST['will']; $f...
2014/03/03
[ "https://Stackoverflow.com/questions/22155827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2870449/" ]
You cannot write to it since you are opening it as read-only: ``` $handle = fopen('/1.txt', "r"); ``` Instead: ``` $handle = fopen('/1.txt', "w"); // to write only, if you need to read and write use 'w+' ``` You also need to store fopen in a $handle so you can write to it later. Documentation: <http://www.php.ne...
You are opening the file as read-only, with the `r`use `w` instead. And you need to pass [`fwrite`](http://at2.php.net/fwrite) the return of `fopen` as first argument, not the filename: ``` $f = fopen('/1.txt', "w"); fwrite($f,"hour :" . $hour . "<br />" . "family" . $family . "<br />" . "تطابفق با درس" . $how . "<br ...
22,155,827
I am trying to write data into a txt file, but It won't work. there is no error. it just won't work. here is the code ``` if (isset($_REQUEST['submit'])) { $hour = $_REQUEST['hour']; $family = $_REQUEST['family']; $how = $_REQUEST['how']; $will = $_REQUEST['will']; $f...
2014/03/03
[ "https://Stackoverflow.com/questions/22155827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2870449/" ]
You cannot write to it since you are opening it as read-only: ``` $handle = fopen('/1.txt', "r"); ``` Instead: ``` $handle = fopen('/1.txt', "w"); // to write only, if you need to read and write use 'w+' ``` You also need to store fopen in a $handle so you can write to it later. Documentation: <http://www.php.ne...
Much simpler: ``` file_put_contents('/1.txt', $text); ```
22,155,827
I am trying to write data into a txt file, but It won't work. there is no error. it just won't work. here is the code ``` if (isset($_REQUEST['submit'])) { $hour = $_REQUEST['hour']; $family = $_REQUEST['family']; $how = $_REQUEST['how']; $will = $_REQUEST['will']; $f...
2014/03/03
[ "https://Stackoverflow.com/questions/22155827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2870449/" ]
You are opening the file as read-only, with the `r`use `w` instead. And you need to pass [`fwrite`](http://at2.php.net/fwrite) the return of `fopen` as first argument, not the filename: ``` $f = fopen('/1.txt', "w"); fwrite($f,"hour :" . $hour . "<br />" . "family" . $family . "<br />" . "تطابفق با درس" . $how . "<br ...
You have to pass in a 'w' to write to a file. ``` $handle = fopen('/1.txt', "w"); ``` Passing in 'r' makes it so you are opening a 'read-only' file.
22,155,827
I am trying to write data into a txt file, but It won't work. there is no error. it just won't work. here is the code ``` if (isset($_REQUEST['submit'])) { $hour = $_REQUEST['hour']; $family = $_REQUEST['family']; $how = $_REQUEST['how']; $will = $_REQUEST['will']; $f...
2014/03/03
[ "https://Stackoverflow.com/questions/22155827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2870449/" ]
You are opening the file as read-only, with the `r`use `w` instead. And you need to pass [`fwrite`](http://at2.php.net/fwrite) the return of `fopen` as first argument, not the filename: ``` $f = fopen('/1.txt', "w"); fwrite($f,"hour :" . $hour . "<br />" . "family" . $family . "<br />" . "تطابفق با درس" . $how . "<br ...
Much simpler: ``` file_put_contents('/1.txt', $text); ```
18,304,672
I am a C++ programmer and I am new to R. Somebody told me that using a for loop in R is a bad idea and that it is better to use `sapply`. I wrote the following code to calculate the probability of a [birthday coincidence](http://en.wikipedia.org/wiki/Birthday_problem): ``` prob <- 1 # prob of no coincidence ...
2013/08/18
[ "https://Stackoverflow.com/questions/18304672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1664088/" ]
You could do: ``` m <- (days - seq_len(k) + 1) / days probability <- 1 - sapply(seq_along(m), function(x) prod(m[1:x])) ``` but that would be missing on the useful `cumprod` function: ``` probability <- 1 - cumprod(m) ``` which will be a lot faster. (Also gave you a peak at `seq_along` and `seq_len` which are mo...
For you specific question it's probably best to just use the built-in birthday probability calculator ``` sapply(1:50, pbirthday) ```
31,813,588
I have got SDL2\_image library installed on /usr/include/SDL2 (in this directory I can find SDL\_image.h). When I compile with CLion all works fine but, in the editor, either include and functions of SDL2\_image librarie appear with error (this library is found by the compiler but It is not found by the editor). This...
2015/08/04
[ "https://Stackoverflow.com/questions/31813588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4296783/" ]
Use this FindSDL2\_image.cmake file: ``` # Locate SDL2_image library # This module defines # SDL2_IMAGE_LIBRARY, the name of the library to link against # SDL2_IMAGE_FOUND, if false, do not try to link to SDL2_image # SDL2_IMAGE_INCLUDE_DIR, where to find SDL_image.h # # Additional Note: If you see an empty SDL2_IMAGE...
`FindPkgConfig` module invoke `pkg-config` command to get the link/compiler flags. In your case it's possible that the `pkg-config` does not find the settings, so CMake failed to get that information. Please try opening the console/terminal (or msys, msys2, whatever you're using). Then calls `pkg-config SDL2_image --l...
31,813,588
I have got SDL2\_image library installed on /usr/include/SDL2 (in this directory I can find SDL\_image.h). When I compile with CLion all works fine but, in the editor, either include and functions of SDL2\_image librarie appear with error (this library is found by the compiler but It is not found by the editor). This...
2015/08/04
[ "https://Stackoverflow.com/questions/31813588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4296783/" ]
Use this FindSDL2\_image.cmake file: ``` # Locate SDL2_image library # This module defines # SDL2_IMAGE_LIBRARY, the name of the library to link against # SDL2_IMAGE_FOUND, if false, do not try to link to SDL2_image # SDL2_IMAGE_INCLUDE_DIR, where to find SDL_image.h # # Additional Note: If you see an empty SDL2_IMAGE...
depends what compiler you are using, and maybe other factors, depending on what error you are getting exactly. on your `TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES} ${SDL2IMAGE_LIBRARIES})` you might need more linkers or they might not be picking up correctly for some reason. mine looks about like this ...
28,023,726
showing error when trying to get date from Sql server which is in the format like 1986-02-02 00:00:00.0000000. need to display in dd/MM/yyyy format. working fine with format like 2015-01-14.tried different ways but didn't work. pls help. ``` //c# string dt = reader[6].ToString(); dob_lbl.Text = DateTime.Pars...
2015/01/19
[ "https://Stackoverflow.com/questions/28023726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4442557/" ]
change this becuase your input string does not match the pattern that you are passing in to the parser ``` "M/dd/yyyy hh:mm:ss tt" ``` to ``` "yyyy/mm/dd hh:mm:ss tt" ``` So like this ``` dob_lbl.Text = DateTime.ParseExact(dt, "yyyy/mm/dd hh:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture).ToStrin...
At first you should get the data as recogniced sqlDateTime by using ``` DateTime dt = reader.GetDateTime(6); ``` Now `dt.ToString("dd/MM/yyyy");` should work.
28,023,726
showing error when trying to get date from Sql server which is in the format like 1986-02-02 00:00:00.0000000. need to display in dd/MM/yyyy format. working fine with format like 2015-01-14.tried different ways but didn't work. pls help. ``` //c# string dt = reader[6].ToString(); dob_lbl.Text = DateTime.Pars...
2015/01/19
[ "https://Stackoverflow.com/questions/28023726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4442557/" ]
change this becuase your input string does not match the pattern that you are passing in to the parser ``` "M/dd/yyyy hh:mm:ss tt" ``` to ``` "yyyy/mm/dd hh:mm:ss tt" ``` So like this ``` dob_lbl.Text = DateTime.ParseExact(dt, "yyyy/mm/dd hh:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture).ToStrin...
*Clearly*, your string and format doesn't match. Use `yyyy-MM-dd HH:mm:ss.fffffff` format instead when you parse `1986-02-02 00:00:00.0000000` string. ``` string s = "1986-02-02 00:00:00.0000000"; DateTime dt; if(DateTime.TryParseExact(s, "yyyy-MM-dd HH:mm:ss.fffffff", CultureInfo.InvariantCulture, ...
22,527,173
I have a script that sends an email, but instead of the sender name being "admin@foo.bar", I want it to say "Foobar Admin". How can I do this? Thanks!
2014/03/20
[ "https://Stackoverflow.com/questions/22527173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2228694/" ]
``` /^[a-zA-Z\s\-\'\"]*$/ ``` use this. This will contain any alphabet([upper/lower]case) ,space, hiphen, ", ' **update** If you are using it inside NSPredicate then make sure that you put the `-` in the end, as it throws error. Move it to the end of the sequence to be the last character before the closing square ...
Maybe try this: ``` \b[a-zA-Z \-\']+\b ``` <http://regex101.com/r/oQ5nU9>
22,527,173
I have a script that sends an email, but instead of the sender name being "admin@foo.bar", I want it to say "Foobar Admin". How can I do this? Thanks!
2014/03/20
[ "https://Stackoverflow.com/questions/22527173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2228694/" ]
``` /^[a-zA-Z\s\-\'\"]*$/ ``` use this. This will contain any alphabet([upper/lower]case) ,space, hiphen, ", ' **update** If you are using it inside NSPredicate then make sure that you put the `-` in the end, as it throws error. Move it to the end of the sequence to be the last character before the closing square ...
If you want only the alphabets and space, `'` and `-` then: ``` /^[-a-zA-Z\s\']+$/ ``` Notice the `+` from above instead of `*`. If you use `*` then it will match with empty string, where the `+` sign means to have at least one character in your input. Now, if you want to match any alphabets with any special charac...
22,527,173
I have a script that sends an email, but instead of the sender name being "admin@foo.bar", I want it to say "Foobar Admin". How can I do this? Thanks!
2014/03/20
[ "https://Stackoverflow.com/questions/22527173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2228694/" ]
``` /^[a-zA-Z\s\-\'\"]*$/ ``` use this. This will contain any alphabet([upper/lower]case) ,space, hiphen, ", ' **update** If you are using it inside NSPredicate then make sure that you put the `-` in the end, as it throws error. Move it to the end of the sequence to be the last character before the closing square ...
You can use it defiantly work it ``` [a-zA-Z._^%$#!~@,-]+ ``` this code work fine you can try it....
22,527,173
I have a script that sends an email, but instead of the sender name being "admin@foo.bar", I want it to say "Foobar Admin". How can I do this? Thanks!
2014/03/20
[ "https://Stackoverflow.com/questions/22527173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2228694/" ]
``` /^[a-zA-Z\s\-\'\"]*$/ ``` use this. This will contain any alphabet([upper/lower]case) ,space, hiphen, ", ' **update** If you are using it inside NSPredicate then make sure that you put the `-` in the end, as it throws error. Move it to the end of the sequence to be the last character before the closing square ...
//Use this for allowing space as we all as other special character. @"[a-zA-Z\\s\\-\\'\\"]" //Following link will be help for further. <http://www.raywenderlich.com/30288/nsregularexpression-tutorial-and-cheat-sheet>
22,527,173
I have a script that sends an email, but instead of the sender name being "admin@foo.bar", I want it to say "Foobar Admin". How can I do this? Thanks!
2014/03/20
[ "https://Stackoverflow.com/questions/22527173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2228694/" ]
``` /^[a-zA-Z\s\-\'\"]*$/ ``` use this. This will contain any alphabet([upper/lower]case) ,space, hiphen, ", ' **update** If you are using it inside NSPredicate then make sure that you put the `-` in the end, as it throws error. Move it to the end of the sequence to be the last character before the closing square ...
Thanks for your response.. I finally resolved it with this NSString *characterRegex = @"^(\s*[a-zA-Z]+(([\'\-\+\s]\s\*[a-zA-Z])?[a-zA-Z]*)\s*)+$"; NSPredicate \*characterTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",characterRegex]; return [characterTest evaluateWithObject:inputString];
191,580
This is a follow-up question to the one posted here: [Random walking and the expected value](https://math.stackexchange.com/questions/191518/random-walking-and-the-expected-value) I want to generalize the probability.... lets say walking to the neighbour in the clockwise direction is p ,and the counter clockwise is 1...
2012/09/05
[ "https://math.stackexchange.com/questions/191580", "https://math.stackexchange.com", "https://math.stackexchange.com/users/39563/" ]
The answer is still 4, because (by the symmetry) the invariant distribution of the Markov chain is still uniform, and the mean time to return to the node is the reciprocal of the corresponding component of the invariant distribution vector, $\mathbb{E}(T\_1) = \frac{1}{\pi\_1} = 4$. Alternatively, let $m\_k$ denote th...
Let $e$ be the desired expectation. Let $a\_2$, $a\_3$, $a\_4$ be the expected time until one returns to vertex $1$, given that we are at $2$, $3$, $4$ respectively. We have the following equations: $e=1+ pa\_2+(1-p)a\_4$; This is because we take $1$ step, and enter State $2$ with probability $p$, and State $4$ with...
39,306,131
I am sending a link like below ``` users/reset?token=0272dcff7439023e082204ac9fe9b96b ``` Where `token = user_email` In controller after get token, I am trying to match this string with database email field. I have tried by below code , but here query not working ``` public function search(){ if($this->requ...
2016/09/03
[ "https://Stackoverflow.com/questions/39306131", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3081630/" ]
If you **have** to use `switch` you should bring the `if else` statements outside of your `switch` in order to switch over a proper integer value. Something like this: ``` int state = 0; if ( grade < 101 &&‌ grade >= 95 ) state = 1; else if ( grade < 101 && grade >= 85 ) state = 2; switch state { case 1: ...
You can express this with switch statements in the following way (though you probably do not want to): ``` switch(grade) { case 100: case 99: case 98: case 97: case 96: case 95: printf("A+"); break; case 94: case 93: case 92: case 91: case 90: case 89: case 88: case 87:...
52,016,746
I'm trying to change cache driver from **file** to **redis** or **apc**, but everytime when I said `dd(\Cache::getDefaultDriver());` it gives me that "file" as default cache driver. I cleared config and stored cache, but it still continue.. ``` php artisan config:cache php artisan cache:clear ``` in my config/cache...
2018/08/25
[ "https://Stackoverflow.com/questions/52016746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9714376/" ]
please change > > CACHE\_DRIVER = redis > > > in `.env` to redis and again run `php artisan serve`
1) `composer require predis/predis` 2) in `config/database.php` paste these codes below.. ``` 'redis' => [ 'client' => 'predis', 'default' => [ 'host' => env('REDIS_HOST', 'localhost'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), 'database' =>...
22,582,312
Confirming that every time you call Akka.system.actorOf or Akka.system.scheduler it'll create a new ActorSystem in the application? Looking at some code where it calls Akka.system.actorOf every time it has to create a new actor, which I think should have been context.actorOf to use the existing ActorSystem (which shoul...
2014/03/22
[ "https://Stackoverflow.com/questions/22582312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2066049/" ]
According to the docs: > > Using the ActorSystem will create top-level actors, supervised by the > actor system’s provided guardian actor, while using an actor’s context > will create a child actor. > > > So basically, it depends on what you want to achieve. More details [here](http://doc.akka.io/docs/akka/sna...
You can only have one ActorSystem in a Cluster. thats why you cant use new. Something very similar to main.. trying to learn by answering to it.
22,582,312
Confirming that every time you call Akka.system.actorOf or Akka.system.scheduler it'll create a new ActorSystem in the application? Looking at some code where it calls Akka.system.actorOf every time it has to create a new actor, which I think should have been context.actorOf to use the existing ActorSystem (which shoul...
2014/03/22
[ "https://Stackoverflow.com/questions/22582312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2066049/" ]
You create new `ActorSystem` *only* when you call `ActorSystem.apply` method: ``` val system = ActorSystem("YourApplication") ``` Of course, when you call methods on the system you *do not* create new systems, that is, the following: ``` val actor = system.actorOf(Props[SomeActor], "someActor") ``` won't create n...
You can only have one ActorSystem in a Cluster. thats why you cant use new. Something very similar to main.. trying to learn by answering to it.
37,320,817
I have an ASP.NET web application which is connected to SQL Server. I have used three connections for each SQL operation. It works very well, however I think this is not an efficient way to do things - can this be written better than it is? ``` public partial class Home : System.Web.UI.Page { SqlConnection co = n...
2016/05/19
[ "https://Stackoverflow.com/questions/37320817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6278437/" ]
``` SqlConnection co = new SqlConnection(ConfigurationManager.ConnectionStrings["TextConnectionString"].ConnectionString); protected void Button1_Click(object sender, EventArgs e) { using (co) { co.Open(); SqlCommand cm = co.CreateCommand(); ...
You're using the same connection string for each connection? Why do you need three connections? Why not just open and close the same one? As long as the connection string is the same, you only need one connection.
37,320,817
I have an ASP.NET web application which is connected to SQL Server. I have used three connections for each SQL operation. It works very well, however I think this is not an efficient way to do things - can this be written better than it is? ``` public partial class Home : System.Web.UI.Page { SqlConnection co = n...
2016/05/19
[ "https://Stackoverflow.com/questions/37320817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6278437/" ]
You're using the same connection string for each connection? Why do you need three connections? Why not just open and close the same one? As long as the connection string is the same, you only need one connection.
You can also try this. ``` SqlConnection co = new SqlConnection(ConfigurationManager.ConnectionStrings["TextConnectionString"].ConnectionString); protected void Button1_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); sb.AppendLine(" Select sta...
37,320,817
I have an ASP.NET web application which is connected to SQL Server. I have used three connections for each SQL operation. It works very well, however I think this is not an efficient way to do things - can this be written better than it is? ``` public partial class Home : System.Web.UI.Page { SqlConnection co = n...
2016/05/19
[ "https://Stackoverflow.com/questions/37320817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6278437/" ]
``` SqlConnection co = new SqlConnection(ConfigurationManager.ConnectionStrings["TextConnectionString"].ConnectionString); protected void Button1_Click(object sender, EventArgs e) { using (co) { co.Open(); SqlCommand cm = co.CreateCommand(); ...
*In general* you should prefer to create and open a connection object as close to where you make use of it as possible, and dispose of it as soon as possible afterwards (preferably by making use of a `using` statement). Connection pooling will take care of ensuring you only actually create a limited number of *real* co...
37,320,817
I have an ASP.NET web application which is connected to SQL Server. I have used three connections for each SQL operation. It works very well, however I think this is not an efficient way to do things - can this be written better than it is? ``` public partial class Home : System.Web.UI.Page { SqlConnection co = n...
2016/05/19
[ "https://Stackoverflow.com/questions/37320817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6278437/" ]
``` SqlConnection co = new SqlConnection(ConfigurationManager.ConnectionStrings["TextConnectionString"].ConnectionString); protected void Button1_Click(object sender, EventArgs e) { using (co) { co.Open(); SqlCommand cm = co.CreateCommand(); ...
1. No use declaring/creating multiple connections when you would be using only one at a time. You can do with just one. 2. Declare variable as close as possible to its first use, and with minimum scope manageable. 3. Make things modular and reusable as far as possible. 4. No need to explicitly close the connection, sin...
37,320,817
I have an ASP.NET web application which is connected to SQL Server. I have used three connections for each SQL operation. It works very well, however I think this is not an efficient way to do things - can this be written better than it is? ``` public partial class Home : System.Web.UI.Page { SqlConnection co = n...
2016/05/19
[ "https://Stackoverflow.com/questions/37320817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6278437/" ]
``` SqlConnection co = new SqlConnection(ConfigurationManager.ConnectionStrings["TextConnectionString"].ConnectionString); protected void Button1_Click(object sender, EventArgs e) { using (co) { co.Open(); SqlCommand cm = co.CreateCommand(); ...
You can also try this. ``` SqlConnection co = new SqlConnection(ConfigurationManager.ConnectionStrings["TextConnectionString"].ConnectionString); protected void Button1_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); sb.AppendLine(" Select sta...
37,320,817
I have an ASP.NET web application which is connected to SQL Server. I have used three connections for each SQL operation. It works very well, however I think this is not an efficient way to do things - can this be written better than it is? ``` public partial class Home : System.Web.UI.Page { SqlConnection co = n...
2016/05/19
[ "https://Stackoverflow.com/questions/37320817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6278437/" ]
*In general* you should prefer to create and open a connection object as close to where you make use of it as possible, and dispose of it as soon as possible afterwards (preferably by making use of a `using` statement). Connection pooling will take care of ensuring you only actually create a limited number of *real* co...
You can also try this. ``` SqlConnection co = new SqlConnection(ConfigurationManager.ConnectionStrings["TextConnectionString"].ConnectionString); protected void Button1_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); sb.AppendLine(" Select sta...
37,320,817
I have an ASP.NET web application which is connected to SQL Server. I have used three connections for each SQL operation. It works very well, however I think this is not an efficient way to do things - can this be written better than it is? ``` public partial class Home : System.Web.UI.Page { SqlConnection co = n...
2016/05/19
[ "https://Stackoverflow.com/questions/37320817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6278437/" ]
1. No use declaring/creating multiple connections when you would be using only one at a time. You can do with just one. 2. Declare variable as close as possible to its first use, and with minimum scope manageable. 3. Make things modular and reusable as far as possible. 4. No need to explicitly close the connection, sin...
You can also try this. ``` SqlConnection co = new SqlConnection(ConfigurationManager.ConnectionStrings["TextConnectionString"].ConnectionString); protected void Button1_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); sb.AppendLine(" Select sta...