qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
2,713,869
``` public static void main(String[] args) { int [][]shatner = new int[1][1]; int []rat = new int[4]; shatner[0] = rat; System.out.println(shatner[0][3]); } ``` surprised, The output is 0, why Java doesn't check this kind of indexOutOfBound error?
2010/04/26
[ "https://Stackoverflow.com/questions/2713869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/304910/" ]
Don't be surprised. shatner[0] is an array (rat) and happens to be of length 4. So shartner[0][3] is rat[3] which happens to be 0..
It's not that Java doesn't check the IndexOutOfBoundsException. It's that the answer SHOULD be zero. The key line is ``` shatner[0] = rat; ``` Since that means that the 0th index of `shatner` is pointing to an array of length 4, `shatner[0][4]` is totally valid.
2,713,869
``` public static void main(String[] args) { int [][]shatner = new int[1][1]; int []rat = new int[4]; shatner[0] = rat; System.out.println(shatner[0][3]); } ``` surprised, The output is 0, why Java doesn't check this kind of indexOutOfBound error?
2010/04/26
[ "https://Stackoverflow.com/questions/2713869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/304910/" ]
Where do you see an "indexOutOfBound error"? The code does the following: * Initalize an array (size 1) of `int` arrays (size 1), i.e. a 2D array, contents are intialized with 0 * Initalize a array of `int`, size 4, content is intialized with 0 * set the single element of the 2D array to the size 4 1D array * access t...
It's not that Java doesn't check the IndexOutOfBoundsException. It's that the answer SHOULD be zero. The key line is ``` shatner[0] = rat; ``` Since that means that the 0th index of `shatner` is pointing to an array of length 4, `shatner[0][4]` is totally valid.
2,713,869
``` public static void main(String[] args) { int [][]shatner = new int[1][1]; int []rat = new int[4]; shatner[0] = rat; System.out.println(shatner[0][3]); } ``` surprised, The output is 0, why Java doesn't check this kind of indexOutOfBound error?
2010/04/26
[ "https://Stackoverflow.com/questions/2713869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/304910/" ]
Where do you see an "indexOutOfBound error"? The code does the following: * Initalize an array (size 1) of `int` arrays (size 1), i.e. a 2D array, contents are intialized with 0 * Initalize a array of `int`, size 4, content is intialized with 0 * set the single element of the 2D array to the size 4 1D array * access t...
Arrays need not be rectangular in Java. This is a jagged array and is perfectly fine.
1,785,579
I am having a problem with a race condition when saving to the database asynchronously using NHibernate. First an insert to the database is done asynchronously where the unique id is auto-generated. Before this insert returns back to the main thread with now persisted object that has the unique database generated id, t...
2009/11/23
[ "https://Stackoverflow.com/questions/1785579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/217308/" ]
Looks like you could be creating multiple threads in a single NHibernate Session. Sessions in NHibernate are *not thread safe*. You should never access the same Session in two concurrent threads. Try creating a separate session in your new thread and see if it resolves your problem. Check out the [NHibernate document...
You need to put some kind of "Wait for the insert to finish" type logic before you call update. This is standard multi-threaded async programming. It's very possible to call Insert and Update at the same time on the same object in a multi-threaded environment. You just need to make sure the underlying code is smart en...
481,243
I was wondering different packages are usually handled. Specifically, the SMD packages. Are there any benefits to having all components in a single package? For example, I have all of my resistors and capacitors in 0402 package but one of the capacitors is nearly 10x in cost for this package size vs say 0805. Does...
2020/02/14
[ "https://electronics.stackexchange.com/questions/481243", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/203618/" ]
From a perspective of pure mechanics of an assembly house there is no difference whatsoever to using different package IF it is same SMD type. SMDs are assembled by pick-and-place machines which don’t really care about package size as long as it is size the machine can handle (going some super small packages may sign...
You'd have to check with your manufacturer to be sure. Very small packages, (0402 is pretty standard now though), "blind" packages (BGA etc), and having lots of different parts (there will be a limit on the number of reels on the pick and place machine) will raise the cost. Tiny and/or blind packages will also reduce y...
10,617,327
I've a very small doubt. I've a html tag to browse the file. and as soon as I browse the file from the local server, I want to set that path to the source of image tag. Is it possible to implement? I've code something like this. ``` <form name="image" id="image" enctype="multipart/form-data" action="" method="post"> ...
2012/05/16
[ "https://Stackoverflow.com/questions/10617327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/977720/" ]
There is [m.facebook.com](http://bugs.developers.facebook.net/show_bug.cgi?id=17217) bug that says next is being ignored. You could always use `https://www.facebook.com/logout` instead. Also your logout URL has to be in the domain of the app you registered on Facebook, localhost will not work. ``` string url = strin...
I have resolved the above issue long ago by using the following javascript on click of "Save Button". ``` <script type="text/javascript"> function logoutFacebook() { } window.onload = function () { var ID = document.getElementById('hfID').value FB.init({ apiKey: ID });...
1,472,341
I'd like to implement a filter/search feature in my application using Lucene. Querying Lucene index gives me a `Hits` instance, which is nothing more than a list of `Document`s matching my criteria. Since I generate the indexed `Document`s from my objects, which is the best way to find the original object related t...
2009/09/24
[ "https://Stackoverflow.com/questions/1472341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177207/" ]
I think the `DateTime.DaysInMonth` method can help a lot, after a `TryParse` ... you can implement the logic you are talking about
Rule #1: As reasonably as possible, don't allow a user to input invalid data in the first place. If you're doing Windows Forms, use the DateTimePicker as much as possible (although it has its limitations when it comes to locale); or, if your app is in ASP.NET, use a Calendar, or one of the AJAX Control Toolkit control...
1,472,341
I'd like to implement a filter/search feature in my application using Lucene. Querying Lucene index gives me a `Hits` instance, which is nothing more than a list of `Document`s matching my criteria. Since I generate the indexed `Document`s from my objects, which is the best way to find the original object related t...
2009/09/24
[ "https://Stackoverflow.com/questions/1472341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177207/" ]
You *should* (morally) not try to handle inputs like this. Is February 29, 1900 to be interpreted as March 1, 1900 (because February 29, 1900 could be interpreted as the day after February 28, 1900 but since it doesn't exist move the actual day after February 28, 1900) or as February 28, 1900 (because February 29, 1900...
The compiler will just throw a cannot parse exception, so you'll have to write your own parser for this kind of problems.
1,472,341
I'd like to implement a filter/search feature in my application using Lucene. Querying Lucene index gives me a `Hits` instance, which is nothing more than a list of `Document`s matching my criteria. Since I generate the indexed `Document`s from my objects, which is the best way to find the original object related t...
2009/09/24
[ "https://Stackoverflow.com/questions/1472341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177207/" ]
One way to avoid incorrect dates in User input, is not to let them happen in the first instance, i.e. use a date picker control. What about using [`DateTime.TryParse`](http://msdn.microsoft.com/en-us/library/system.datetime.tryparse.aspx) ? > > Converts the specified string > representation of a date and time to > ...
Rule #1: As reasonably as possible, don't allow a user to input invalid data in the first place. If you're doing Windows Forms, use the DateTimePicker as much as possible (although it has its limitations when it comes to locale); or, if your app is in ASP.NET, use a Calendar, or one of the AJAX Control Toolkit control...
1,472,341
I'd like to implement a filter/search feature in my application using Lucene. Querying Lucene index gives me a `Hits` instance, which is nothing more than a list of `Document`s matching my criteria. Since I generate the indexed `Document`s from my objects, which is the best way to find the original object related t...
2009/09/24
[ "https://Stackoverflow.com/questions/1472341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177207/" ]
I don't believe this is handled directly for you. What you could do is parse the date yourself, as three separate integers: * Parse the 2009, and construct a DateTime of 1st January 2009 * Parse the 09 and subtract one, then call `dt = dt.AddMonths(8)` to get September 1st * Parse the 31 and subtract one, then call `d...
I think the `DateTime.DaysInMonth` method can help a lot, after a `TryParse` ... you can implement the logic you are talking about
1,472,341
I'd like to implement a filter/search feature in my application using Lucene. Querying Lucene index gives me a `Hits` instance, which is nothing more than a list of `Document`s matching my criteria. Since I generate the indexed `Document`s from my objects, which is the best way to find the original object related t...
2009/09/24
[ "https://Stackoverflow.com/questions/1472341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177207/" ]
One way to avoid incorrect dates in User input, is not to let them happen in the first instance, i.e. use a date picker control. What about using [`DateTime.TryParse`](http://msdn.microsoft.com/en-us/library/system.datetime.tryparse.aspx) ? > > Converts the specified string > representation of a date and time to > ...
The compiler will just throw a cannot parse exception, so you'll have to write your own parser for this kind of problems.
1,472,341
I'd like to implement a filter/search feature in my application using Lucene. Querying Lucene index gives me a `Hits` instance, which is nothing more than a list of `Document`s matching my criteria. Since I generate the indexed `Document`s from my objects, which is the best way to find the original object related t...
2009/09/24
[ "https://Stackoverflow.com/questions/1472341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177207/" ]
One way to avoid incorrect dates in User input, is not to let them happen in the first instance, i.e. use a date picker control. What about using [`DateTime.TryParse`](http://msdn.microsoft.com/en-us/library/system.datetime.tryparse.aspx) ? > > Converts the specified string > representation of a date and time to > ...
You *should* (morally) not try to handle inputs like this. Is February 29, 1900 to be interpreted as March 1, 1900 (because February 29, 1900 could be interpreted as the day after February 28, 1900 but since it doesn't exist move the actual day after February 28, 1900) or as February 28, 1900 (because February 29, 1900...
1,472,341
I'd like to implement a filter/search feature in my application using Lucene. Querying Lucene index gives me a `Hits` instance, which is nothing more than a list of `Document`s matching my criteria. Since I generate the indexed `Document`s from my objects, which is the best way to find the original object related t...
2009/09/24
[ "https://Stackoverflow.com/questions/1472341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177207/" ]
I think the `DateTime.DaysInMonth` method can help a lot, after a `TryParse` ... you can implement the logic you are talking about
The compiler will just throw a cannot parse exception, so you'll have to write your own parser for this kind of problems.
1,472,341
I'd like to implement a filter/search feature in my application using Lucene. Querying Lucene index gives me a `Hits` instance, which is nothing more than a list of `Document`s matching my criteria. Since I generate the indexed `Document`s from my objects, which is the best way to find the original object related t...
2009/09/24
[ "https://Stackoverflow.com/questions/1472341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177207/" ]
I don't believe this is handled directly for you. What you could do is parse the date yourself, as three separate integers: * Parse the 2009, and construct a DateTime of 1st January 2009 * Parse the 09 and subtract one, then call `dt = dt.AddMonths(8)` to get September 1st * Parse the 31 and subtract one, then call `d...
The compiler will just throw a cannot parse exception, so you'll have to write your own parser for this kind of problems.
1,472,341
I'd like to implement a filter/search feature in my application using Lucene. Querying Lucene index gives me a `Hits` instance, which is nothing more than a list of `Document`s matching my criteria. Since I generate the indexed `Document`s from my objects, which is the best way to find the original object related t...
2009/09/24
[ "https://Stackoverflow.com/questions/1472341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177207/" ]
I don't believe this is handled directly for you. What you could do is parse the date yourself, as three separate integers: * Parse the 2009, and construct a DateTime of 1st January 2009 * Parse the 09 and subtract one, then call `dt = dt.AddMonths(8)` to get September 1st * Parse the 31 and subtract one, then call `d...
One way to avoid incorrect dates in User input, is not to let them happen in the first instance, i.e. use a date picker control. What about using [`DateTime.TryParse`](http://msdn.microsoft.com/en-us/library/system.datetime.tryparse.aspx) ? > > Converts the specified string > representation of a date and time to > ...
1,472,341
I'd like to implement a filter/search feature in my application using Lucene. Querying Lucene index gives me a `Hits` instance, which is nothing more than a list of `Document`s matching my criteria. Since I generate the indexed `Document`s from my objects, which is the best way to find the original object related t...
2009/09/24
[ "https://Stackoverflow.com/questions/1472341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177207/" ]
I don't believe this is handled directly for you. What you could do is parse the date yourself, as three separate integers: * Parse the 2009, and construct a DateTime of 1st January 2009 * Parse the 09 and subtract one, then call `dt = dt.AddMonths(8)` to get September 1st * Parse the 31 and subtract one, then call `d...
You *should* (morally) not try to handle inputs like this. Is February 29, 1900 to be interpreted as March 1, 1900 (because February 29, 1900 could be interpreted as the day after February 28, 1900 but since it doesn't exist move the actual day after February 28, 1900) or as February 28, 1900 (because February 29, 1900...
7,486,388
I want to know whether form errors can be shown in Chinese or other languages? This is how I am getting my errors ``` {{ form.field_name.errors }} ```
2011/09/20
[ "https://Stackoverflow.com/questions/7486388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/851920/" ]
If you set the language in a view, the error messages will be printed in the selected language: ``` from django.utils.translation import activate activate('de') ```
if you use \_ in your form messages the message will be displayed in the right lang! but if you want to check which lang is running in the template you can use: ``` {% if LANGUAGE_CODE != "ch" %} {% endif %} ``` for more info about using \_ in your form, check this out: <https://docs.djangoproject.com/en/1.3/ref/fo...
7,486,388
I want to know whether form errors can be shown in Chinese or other languages? This is how I am getting my errors ``` {{ form.field_name.errors }} ```
2011/09/20
[ "https://Stackoverflow.com/questions/7486388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/851920/" ]
**Some quick explanation first:** Your form field errors come from ``` raise forms.ValidationError(_("My Error Message")) ``` In Django (possibly in other places also), it is common to see this: ``` from django.utils.translation import ugettext_lazy as _ ``` This turns the `_` into a `ugettext_lazy`, i.e. the co...
if you use \_ in your form messages the message will be displayed in the right lang! but if you want to check which lang is running in the template you can use: ``` {% if LANGUAGE_CODE != "ch" %} {% endif %} ``` for more info about using \_ in your form, check this out: <https://docs.djangoproject.com/en/1.3/ref/fo...
146,413
I have a button on screen, and I want the user to be able to dismiss it by either clicking on it, or hitting space. The button is constructed as follows: ``` button = new TextButton("RESUME", skin); button.setVisible(false); button.addListener(new InputListener(){ @Override public boolean touchDown(InputEvent eve...
2017/07/28
[ "https://gamedev.stackexchange.com/questions/146413", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/106087/" ]
You should use the `Button#toggle()` method together with `Button#setProgrammaticChangeEvents(true)`. From the docs: > > Toggles the checked state. This method changes the checked state, which fires a `ChangeEvent` (if programmatic change events are enabled), so can be used to simulate a button click. > > > Your...
So after another round of adding features, here's what I came up with. Basically, when the "pause" button is shown on screen, I want the user to be able to do the following: * Click on it to dismiss the button and resume game * hit SPACE to dismiss the button and resume game * hit ESC to dismiss the button and go back...
41,913,818
let me first start with showing the code: build.gradle (module): ``` android { compileSdkVersion 24 buildToolsVersion "24.0.2" dataBinding { enabled = true } defaultConfig { applicationId "com.example.oryaa.basecalculator" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" }...
2017/01/28
[ "https://Stackoverflow.com/questions/41913818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
* Make your model class fields private. * Change `getCalcResult()` should be public. * `BaseView` should be extending `BaseObservable` * If you don't change model value dynamically. Then you need not to make every accessor `@Bindable`. You can remove that. And also remove `notifyPropertyChanged()`. Opposite of this if ...
In my case I was forgetting to `setContentView(binding.root)`. I'm using a ResultReceiver as a subclass of my Activity class. After following the setup [documentation](https://developer.android.com/topic/libraries/data-binding) I ended up with this: ``` class MyActivity : AppCompatActivity(), AdapterView.OnItemSelecte...
41,913,818
let me first start with showing the code: build.gradle (module): ``` android { compileSdkVersion 24 buildToolsVersion "24.0.2" dataBinding { enabled = true } defaultConfig { applicationId "com.example.oryaa.basecalculator" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" }...
2017/01/28
[ "https://Stackoverflow.com/questions/41913818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You need to call `executePendingBindings()` for immediately update binding value in view: > > When a variable or observable changes, the binding will be scheduled to change before the next frame. There are times, however, when binding must be executed immediately. To force execution, use the executePendingBindings() ...
* Make your model class fields private. * Change `getCalcResult()` should be public. * `BaseView` should be extending `BaseObservable` * If you don't change model value dynamically. Then you need not to make every accessor `@Bindable`. You can remove that. And also remove `notifyPropertyChanged()`. Opposite of this if ...
41,913,818
let me first start with showing the code: build.gradle (module): ``` android { compileSdkVersion 24 buildToolsVersion "24.0.2" dataBinding { enabled = true } defaultConfig { applicationId "com.example.oryaa.basecalculator" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" }...
2017/01/28
[ "https://Stackoverflow.com/questions/41913818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I had a similar issue when I needed to refresh the views after an event, with my variable objects not observable, so I added this: ``` binding?.invalidateAll() ``` I hope it helps.
* Make your model class fields private. * Change `getCalcResult()` should be public. * `BaseView` should be extending `BaseObservable` * If you don't change model value dynamically. Then you need not to make every accessor `@Bindable`. You can remove that. And also remove `notifyPropertyChanged()`. Opposite of this if ...
41,913,818
let me first start with showing the code: build.gradle (module): ``` android { compileSdkVersion 24 buildToolsVersion "24.0.2" dataBinding { enabled = true } defaultConfig { applicationId "com.example.oryaa.basecalculator" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" }...
2017/01/28
[ "https://Stackoverflow.com/questions/41913818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I had a similar issue when I needed to refresh the views after an event, with my variable objects not observable, so I added this: ``` binding?.invalidateAll() ``` I hope it helps.
I had the exact same problem. Apparently it was a single line that had been causing the issue. All you have to do is set the `licycleowner` to the `binding`. ``` binding.lifecycleOwner = this ```
41,913,818
let me first start with showing the code: build.gradle (module): ``` android { compileSdkVersion 24 buildToolsVersion "24.0.2" dataBinding { enabled = true } defaultConfig { applicationId "com.example.oryaa.basecalculator" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" }...
2017/01/28
[ "https://Stackoverflow.com/questions/41913818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
In case you might be experiencing this issue with `LiveData`, you might've forgotten to set lifecycle owner of your binding; `binding.setLifecycleOwner(lifecycleOwner)`
* Make your model class fields private. * Change `getCalcResult()` should be public. * `BaseView` should be extending `BaseObservable` * If you don't change model value dynamically. Then you need not to make every accessor `@Bindable`. You can remove that. And also remove `notifyPropertyChanged()`. Opposite of this if ...
41,913,818
let me first start with showing the code: build.gradle (module): ``` android { compileSdkVersion 24 buildToolsVersion "24.0.2" dataBinding { enabled = true } defaultConfig { applicationId "com.example.oryaa.basecalculator" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" }...
2017/01/28
[ "https://Stackoverflow.com/questions/41913818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I had a similar issue when I needed to refresh the views after an event, with my variable objects not observable, so I added this: ``` binding?.invalidateAll() ``` I hope it helps.
You need to call `executePendingBindings()` for immediately update binding value in view: > > When a variable or observable changes, the binding will be scheduled to change before the next frame. There are times, however, when binding must be executed immediately. To force execution, use the executePendingBindings() ...
41,913,818
let me first start with showing the code: build.gradle (module): ``` android { compileSdkVersion 24 buildToolsVersion "24.0.2" dataBinding { enabled = true } defaultConfig { applicationId "com.example.oryaa.basecalculator" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" }...
2017/01/28
[ "https://Stackoverflow.com/questions/41913818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I had the exact same problem. Apparently it was a single line that had been causing the issue. All you have to do is set the `licycleowner` to the `binding`. ``` binding.lifecycleOwner = this ```
Please make sure you are updating `the same object field` when data binding does not work on you. `The object's instance` must be the same in order to update UI. Maybe my answer helps to someone, enjoy coding!
41,913,818
let me first start with showing the code: build.gradle (module): ``` android { compileSdkVersion 24 buildToolsVersion "24.0.2" dataBinding { enabled = true } defaultConfig { applicationId "com.example.oryaa.basecalculator" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" }...
2017/01/28
[ "https://Stackoverflow.com/questions/41913818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You need to call `executePendingBindings()` for immediately update binding value in view: > > When a variable or observable changes, the binding will be scheduled to change before the next frame. There are times, however, when binding must be executed immediately. To force execution, use the executePendingBindings() ...
I had the exact same problem. Apparently it was a single line that had been causing the issue. All you have to do is set the `licycleowner` to the `binding`. ``` binding.lifecycleOwner = this ```
41,913,818
let me first start with showing the code: build.gradle (module): ``` android { compileSdkVersion 24 buildToolsVersion "24.0.2" dataBinding { enabled = true } defaultConfig { applicationId "com.example.oryaa.basecalculator" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" }...
2017/01/28
[ "https://Stackoverflow.com/questions/41913818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
In case you might be experiencing this issue with `LiveData`, you might've forgotten to set lifecycle owner of your binding; `binding.setLifecycleOwner(lifecycleOwner)`
You need to call `executePendingBindings()` for immediately update binding value in view: > > When a variable or observable changes, the binding will be scheduled to change before the next frame. There are times, however, when binding must be executed immediately. To force execution, use the executePendingBindings() ...
41,913,818
let me first start with showing the code: build.gradle (module): ``` android { compileSdkVersion 24 buildToolsVersion "24.0.2" dataBinding { enabled = true } defaultConfig { applicationId "com.example.oryaa.basecalculator" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" }...
2017/01/28
[ "https://Stackoverflow.com/questions/41913818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
In case you might be experiencing this issue with `LiveData`, you might've forgotten to set lifecycle owner of your binding; `binding.setLifecycleOwner(lifecycleOwner)`
I had a similar issue when I needed to refresh the views after an event, with my variable objects not observable, so I added this: ``` binding?.invalidateAll() ``` I hope it helps.
37,982,505
`font-size:30;` I know there's: `em`, `px`, `pt`, and `percent` What does it mean when there's only a number and nothing next to it? Is there a name for that measurement? Also, what would `font-size:30;` be equivalent to in `px`?
2016/06/23
[ "https://Stackoverflow.com/questions/37982505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
In word2vec what you want is a vector representation of words. In order to do that you can use, among other things, a neural network. So you have inputs neurons, outputs and hidden layers. What you do to learn the vector representation is to have a hidden layer which number of neurons is the same as the dimension you w...
Weights and biases are updated here: `_, loss_val = session.run([optimizer, loss], feed_dict=feed_dict)` The optimizer does the following - computes the gradient and then does the update step. The similarity is a separate computation is called in a different location and is used to validate the results. Which happe...
37,982,505
`font-size:30;` I know there's: `em`, `px`, `pt`, and `percent` What does it mean when there's only a number and nothing next to it? Is there a name for that measurement? Also, what would `font-size:30;` be equivalent to in `px`?
2016/06/23
[ "https://Stackoverflow.com/questions/37982505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
In word2vec what you want is a vector representation of words. In order to do that you can use, among other things, a neural network. So you have inputs neurons, outputs and hidden layers. What you do to learn the vector representation is to have a hidden layer which number of neurons is the same as the dimension you w...
The idea of skip-gramm is comparing words by their contexts. So we consider words equal if they appear in equal contexts. The first layer of NN represents words vector encodings (basically what is called embeddings). The second layer represents context. Every time we take just one row (Ri) of first layer (because input...
37,982,505
`font-size:30;` I know there's: `em`, `px`, `pt`, and `percent` What does it mean when there's only a number and nothing next to it? Is there a name for that measurement? Also, what would `font-size:30;` be equivalent to in `px`?
2016/06/23
[ "https://Stackoverflow.com/questions/37982505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The idea of skip-gramm is comparing words by their contexts. So we consider words equal if they appear in equal contexts. The first layer of NN represents words vector encodings (basically what is called embeddings). The second layer represents context. Every time we take just one row (Ri) of first layer (because input...
Weights and biases are updated here: `_, loss_val = session.run([optimizer, loss], feed_dict=feed_dict)` The optimizer does the following - computes the gradient and then does the update step. The similarity is a separate computation is called in a different location and is used to validate the results. Which happe...
39,963,148
when I'm trying to insert a new event to my calendar I recive error: > > Not Found [404] > Errors [Message[Not Found] Location[ - ] Reason[notFound] Domain[global]] > > > I figured out that I have no access to a diffrent callendar than primary. Here is my code: ``` Event newEvent = new Event() { Summary = ...
2016/10/10
[ "https://Stackoverflow.com/questions/39963148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6822799/" ]
Try to use the `id` instead of the name and check if this will work in your case. First, get the Id of the calendar in where you want to insert your event by using the [`CalendarList: list`](https://developers.google.com/google-apps/calendar/v3/reference/calendarList/list#try-it) GET <https://www.googleapis.com/calen...
@adjuremods Thank You very much for your answer. I follwed it and chose from the list field `id` instead of `summary`. It works perfect!
78,585
An increase in lift causes an increase in drag. Is it always true? I am confused with two points. 1. Lift increases with an increase in airspeed but induced drag reduces with an increase in airspeed. 2. Higher aspect ratio wings generate greater lift but create less induced drag.
2020/06/01
[ "https://aviation.stackexchange.com/questions/78585", "https://aviation.stackexchange.com", "https://aviation.stackexchange.com/users/49310/" ]
When looking at statements like these, it's important to consider which parameters are varied and which parameters remain fixed. Let's get this out of the way first by correcting your statements: 1. Lift increases with increase in airspeed *with constant angle of attack* but induced drag reduces with increase in airs...
> > Lift increases with increase in airspeed but induced drag reduces with increase in airspeed. > > > If you keep weight ($W$) constant, the total lift ($L$) does not change with change in airspeed ($V$). $L=W$ for quasi-steady flight, right? What is changed is the lift coefficient, $C\_L$. As speed increases, $...
10,122,520
I wish to write software which could essentially profile the CPU cache (L2,L3, possibly L1) and the memory, to analyze performance. Am I right in thinking this is un-doable because there is no access for the software to the cache content? Another way of wording my Q: is there any way to know, from the OS/Application...
2012/04/12
[ "https://Stackoverflow.com/questions/10122520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1107474/" ]
You might want to look at Intel's PMU i.e. Performance Monitoring Unit. Some processors have one. It is a bunch of special purpose registers (Intel calls them Model Specific Registers, or MSRs) which you can program to count events, like cache misses, using the `RDMSR` and `WRMSR` instructions. Here is a document abou...
Cache performance is generally measured in terms of hit rate and miss rate. There are many tools to do this for you. Check how [Valgrind does cache profiling](http://tldp.org/HOWTO/Valgrind-HOWTO/deeper.html). Also ***cache performance is generally measured on a per program basis***. Well written programs will resul...
10,122,520
I wish to write software which could essentially profile the CPU cache (L2,L3, possibly L1) and the memory, to analyze performance. Am I right in thinking this is un-doable because there is no access for the software to the cache content? Another way of wording my Q: is there any way to know, from the OS/Application...
2012/04/12
[ "https://Stackoverflow.com/questions/10122520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1107474/" ]
Cache performance is generally measured in terms of hit rate and miss rate. There are many tools to do this for you. Check how [Valgrind does cache profiling](http://tldp.org/HOWTO/Valgrind-HOWTO/deeper.html). Also ***cache performance is generally measured on a per program basis***. Well written programs will resul...
[This](https://stackoverflow.com/questions/10082517/simplest-tool-to-measure-c-program-cache-hit-miss-and-cpu-time-in-linux) has some examples. TAU, an open-source profiler which works using PAPI can also be used. If however, you want to write a code to measure the cache statistics you can write a program using PAPI....
10,122,520
I wish to write software which could essentially profile the CPU cache (L2,L3, possibly L1) and the memory, to analyze performance. Am I right in thinking this is un-doable because there is no access for the software to the cache content? Another way of wording my Q: is there any way to know, from the OS/Application...
2012/04/12
[ "https://Stackoverflow.com/questions/10122520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1107474/" ]
You might want to look at Intel's PMU i.e. Performance Monitoring Unit. Some processors have one. It is a bunch of special purpose registers (Intel calls them Model Specific Registers, or MSRs) which you can program to count events, like cache misses, using the `RDMSR` and `WRMSR` instructions. Here is a document abou...
[This](https://stackoverflow.com/questions/10082517/simplest-tool-to-measure-c-program-cache-hit-miss-and-cpu-time-in-linux) has some examples. TAU, an open-source profiler which works using PAPI can also be used. If however, you want to write a code to measure the cache statistics you can write a program using PAPI....
29,934,829
I am trying to validate my mobile number which I am picking up from **Contac List** but **the problem is that** it is picking contact like **+91 95 xx xxxxxx** and there is space between numbers so the validation is not happening. For now I am using this validation ``` String Mobile = "^[+]?[01]?[- .]?(\\([2-]\\d{2}\\...
2015/04/29
[ "https://Stackoverflow.com/questions/29934829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4665938/" ]
In android sdk One class is there PhoneNumberUtils by using that class you can validate your phone number: check the documentation link [here](http://developer.android.com/reference/android/telephony/PhoneNumberUtils.html)
You should try the following to remove the white spaces and then you can do the validation. ``` var str = "PB 10 CV 2662"; str = str.replace(/ +/g, ""); ```
29,934,829
I am trying to validate my mobile number which I am picking up from **Contac List** but **the problem is that** it is picking contact like **+91 95 xx xxxxxx** and there is space between numbers so the validation is not happening. For now I am using this validation ``` String Mobile = "^[+]?[01]?[- .]?(\\([2-]\\d{2}\\...
2015/04/29
[ "https://Stackoverflow.com/questions/29934829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4665938/" ]
Just try this. ``` String number = " " //Your mobile number number.replaceAll("[^+\\d]|(?<=.)\\+", "")); ``` This will remove all the spaces, `(`, `)` symbols
You should try the following to remove the white spaces and then you can do the validation. ``` var str = "PB 10 CV 2662"; str = str.replace(/ +/g, ""); ```
29,934,829
I am trying to validate my mobile number which I am picking up from **Contac List** but **the problem is that** it is picking contact like **+91 95 xx xxxxxx** and there is space between numbers so the validation is not happening. For now I am using this validation ``` String Mobile = "^[+]?[01]?[- .]?(\\([2-]\\d{2}\\...
2015/04/29
[ "https://Stackoverflow.com/questions/29934829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4665938/" ]
Replace the spaces then validate.. ``` String phone=phone.replace(" ",""); ``` Now the String phone has the text without spaces and you can compare.
You should try the following to remove the white spaces and then you can do the validation. ``` var str = "PB 10 CV 2662"; str = str.replace(/ +/g, ""); ```
29,934,829
I am trying to validate my mobile number which I am picking up from **Contac List** but **the problem is that** it is picking contact like **+91 95 xx xxxxxx** and there is space between numbers so the validation is not happening. For now I am using this validation ``` String Mobile = "^[+]?[01]?[- .]?(\\([2-]\\d{2}\\...
2015/04/29
[ "https://Stackoverflow.com/questions/29934829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4665938/" ]
In android sdk One class is there PhoneNumberUtils by using that class you can validate your phone number: check the documentation link [here](http://developer.android.com/reference/android/telephony/PhoneNumberUtils.html)
you can use below code : ``` phoneNumber = phoneCursor.getString(phoneCursor.getColumnIndex(NUMBER)); try { if (phoneNumber != null) phoneNumber = extractDigits(phoneNumber); } catch (Exception e) { e.printStackTrace(); } ``` where **extractDigits()** method is as : ``` public static String ex...
29,934,829
I am trying to validate my mobile number which I am picking up from **Contac List** but **the problem is that** it is picking contact like **+91 95 xx xxxxxx** and there is space between numbers so the validation is not happening. For now I am using this validation ``` String Mobile = "^[+]?[01]?[- .]?(\\([2-]\\d{2}\\...
2015/04/29
[ "https://Stackoverflow.com/questions/29934829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4665938/" ]
In android sdk One class is there PhoneNumberUtils by using that class you can validate your phone number: check the documentation link [here](http://developer.android.com/reference/android/telephony/PhoneNumberUtils.html)
Just try this. ``` String number = " " //Your mobile number number.replaceAll("[^+\\d]|(?<=.)\\+", "")); ``` This will remove all the spaces, `(`, `)` symbols
29,934,829
I am trying to validate my mobile number which I am picking up from **Contac List** but **the problem is that** it is picking contact like **+91 95 xx xxxxxx** and there is space between numbers so the validation is not happening. For now I am using this validation ``` String Mobile = "^[+]?[01]?[- .]?(\\([2-]\\d{2}\\...
2015/04/29
[ "https://Stackoverflow.com/questions/29934829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4665938/" ]
Just try this. ``` String number = " " //Your mobile number number.replaceAll("[^+\\d]|(?<=.)\\+", "")); ``` This will remove all the spaces, `(`, `)` symbols
you can use below code : ``` phoneNumber = phoneCursor.getString(phoneCursor.getColumnIndex(NUMBER)); try { if (phoneNumber != null) phoneNumber = extractDigits(phoneNumber); } catch (Exception e) { e.printStackTrace(); } ``` where **extractDigits()** method is as : ``` public static String ex...
29,934,829
I am trying to validate my mobile number which I am picking up from **Contac List** but **the problem is that** it is picking contact like **+91 95 xx xxxxxx** and there is space between numbers so the validation is not happening. For now I am using this validation ``` String Mobile = "^[+]?[01]?[- .]?(\\([2-]\\d{2}\\...
2015/04/29
[ "https://Stackoverflow.com/questions/29934829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4665938/" ]
Replace the spaces then validate.. ``` String phone=phone.replace(" ",""); ``` Now the String phone has the text without spaces and you can compare.
you can use below code : ``` phoneNumber = phoneCursor.getString(phoneCursor.getColumnIndex(NUMBER)); try { if (phoneNumber != null) phoneNumber = extractDigits(phoneNumber); } catch (Exception e) { e.printStackTrace(); } ``` where **extractDigits()** method is as : ``` public static String ex...
29,934,829
I am trying to validate my mobile number which I am picking up from **Contac List** but **the problem is that** it is picking contact like **+91 95 xx xxxxxx** and there is space between numbers so the validation is not happening. For now I am using this validation ``` String Mobile = "^[+]?[01]?[- .]?(\\([2-]\\d{2}\\...
2015/04/29
[ "https://Stackoverflow.com/questions/29934829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4665938/" ]
Replace the spaces then validate.. ``` String phone=phone.replace(" ",""); ``` Now the String phone has the text without spaces and you can compare.
Just try this. ``` String number = " " //Your mobile number number.replaceAll("[^+\\d]|(?<=.)\\+", "")); ``` This will remove all the spaces, `(`, `)` symbols
12,998,991
I have the following code: ``` if(text && spot && box) { document.getElementById('text-shadow-box').onmousemove = onMouseMove; document.getElementById('text-shadow-box').ontouchmove = function(e) { e.preventDefault(); e.stopPropagation(); onMouseMove({ clientX: e.touches[...
2012/10/21
[ "https://Stackoverflow.com/questions/12998991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1763202/" ]
I will comment the code inline: ``` //all variables ext,spot,box are defined, not "false" and not 0 and not null if (ext && spot && box) { /* We assign onmousemove event handler to the function, in javascript functions are vars * function declared like `function function_name(param) {}` go to global scope, * and almo...
onmousemove = onMouseMove is for HTML DOM event registration. in this case, it means method 'onMouseMove' should be invoked when there is a mouse move event on HTML element 'text-shadow-box'. ontouchmove is another event that listens to any touch move, this happens on mobile clients (e.g. Android client). inside the ...
1,677,472
How should I find the number of subsets of $[n]$ like $A$ where $\max A - \min A$ is an odd number? I tried to solve the problem for a simpler example but it didn't help.
2016/02/29
[ "https://math.stackexchange.com/questions/1677472", "https://math.stackexchange.com", "https://math.stackexchange.com/users/108744/" ]
There are $\max A-\min A-1$ numbers in between that may or may not be present, so $2^{\delta-1}$ different subsets for a given value of $\delta=\max A-\min A$. For given $n$, there are $n-\delta$ pairs in $[n]$ with difference $\delta$, so the desired number is $$ \sum\_{k=0}^{l-1}(n-(2k+1))2^{(2k+1)-1}=\sum\_{k=0}^{l...
How do we create such an $A$? Choose the largest element of $A$ call it $M$. Then we choose the smallest element, $m$, of $A$ such that $M - m$ is odd. Now to round out $A$, we choose among the remaining $M-m-1$ elements between $M$ and $m$. There are $2^{M-m-1}$ ways to do this. Thus the total number of subsets, $A$, ...
1,685,690
I've got a directory that changes regularly, but whose files are related. I want to `rsync` that to a remote location, insuring that I always have one complete set of files at the remote. That is, if I have one complete backup, I want that preserved until I have a second complete one, in order to insure that any networ...
2021/11/05
[ "https://superuser.com/questions/1685690", "https://superuser.com", "https://superuser.com/users/295324/" ]
I have been able to get what I wanted thanks to help from this [answer](https://stackoverflow.com/a/29570783/5929919), but I did make some modifications. Basically, I created an `update_wsl_ip_to_domain.ps1` file and saved to this PATH `C:\Scripts\update_wsl_ip_to_domain.ps1`, then I added the following scripts ``` #...
I also had the same problem and came with my own solution. Here it is. It lacks adding static IPs with `netsh`, however, has some other features :) --- I have several WSL distros. For each of them, I create a file named `MYWSLDISTRONAME-hostnames.txt` in a `scripts` directory. This file contains only domain names:...
5,306,822
I'm sick of this. ALWAYS when I make a HTTP GET query from a C/C++ program using just plain sockets I get 301 Moved Permanently's. Normally I'd use libcURL, but in this case I don't want to add another library, I just need to download one flat identification file from one fixed server. This is my current query: ``` G...
2011/03/15
[ "https://Stackoverflow.com/questions/5306822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/565635/" ]
Alright, besides the issue with the Accept-Encoding, the query was fine. The problem was that I resolved in my socket code to "minecraft.net" instead of "www.minecraft.net". RAAAAH. Fixed.
I can't see anything obviously wrong since the redirected URI appears to be the same as the original GET request URI, so I would suggest downloading the command-line curl and running that in verbose mode against the same target. Perhaps it will show something in its output that can point you in the right direction. The...
5,306,822
I'm sick of this. ALWAYS when I make a HTTP GET query from a C/C++ program using just plain sockets I get 301 Moved Permanently's. Normally I'd use libcURL, but in this case I don't want to add another library, I just need to download one flat identification file from one fixed server. This is my current query: ``` G...
2011/03/15
[ "https://Stackoverflow.com/questions/5306822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/565635/" ]
Alright, besides the issue with the Accept-Encoding, the query was fine. The problem was that I resolved in my socket code to "minecraft.net" instead of "www.minecraft.net". RAAAAH. Fixed.
I don't know if this is the problem you have on the Minecraft server (I don't have an account) but ``` Accept-Encoding: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n ``` what the heck is that? Header fields that might go in requests include * `Accept:` MIME types (e.g. what you have there) * `Accept-Char...
5,306,822
I'm sick of this. ALWAYS when I make a HTTP GET query from a C/C++ program using just plain sockets I get 301 Moved Permanently's. Normally I'd use libcURL, but in this case I don't want to add another library, I just need to download one flat identification file from one fixed server. This is my current query: ``` G...
2011/03/15
[ "https://Stackoverflow.com/questions/5306822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/565635/" ]
Alright, besides the issue with the Accept-Encoding, the query was fine. The problem was that I resolved in my socket code to "minecraft.net" instead of "www.minecraft.net". RAAAAH. Fixed.
Well, the server is redirecting the client to another location. You just have to issue another request to the URL coming back in the "Location" header of the 3xx respone OOPs realized that the redirect location is the same as the original URI. DOes this URL work from the browser? If so you might try adding a User-Age...
5,306,822
I'm sick of this. ALWAYS when I make a HTTP GET query from a C/C++ program using just plain sockets I get 301 Moved Permanently's. Normally I'd use libcURL, but in this case I don't want to add another library, I just need to download one flat identification file from one fixed server. This is my current query: ``` G...
2011/03/15
[ "https://Stackoverflow.com/questions/5306822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/565635/" ]
Alright, besides the issue with the Accept-Encoding, the query was fine. The problem was that I resolved in my socket code to "minecraft.net" instead of "www.minecraft.net". RAAAAH. Fixed.
You can either specify the correct URL ([www.minecraft.net](http://www.minecraft.net)) or tell libcurl to follow redirects automatically: ```cpp curl_easy_setopt(curl_handle,CURLOPT_FOLLOWLOCATION,1); ```
8,499,433
I have something really weird going on in my project (Flash CS5.5 and AIR 3...) I need to check (for my own good reasons) whether the cursor is located within the bounds of a particular object. I'm using a simple code to do this... ``` if(mouseX > hsSlot1.x && mouseX < (hsSlot1.x + hsSlot1.width) && mouseY > hsSlot1....
2011/12/14
[ "https://Stackoverflow.com/questions/8499433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/472647/" ]
First couple of things that come to mind: 1. The registration point for the graphics for `hsSlot1` is not exactly top-left. 2. I can't tell what scope you're calling this code from, but if you're calling it from a container that doesn't contain `hsSlot1` as a direct child then it may be within another container that i...
The simple answer is that you're doing this the hard way, because an object's `x` and `y` and `width` and `height` properties don't necessarily correspond to its bounds. As Marty notes this is partly because an object's registration point (the origin of the object's local coordinate space) does not necessarily have to ...
27,378,633
Hello stackoverflow users, Today I am using the overflow:scroll; property so I can hide all content but allow users to see it with a scroll bar. See below picture: ![enter image description here](https://i.stack.imgur.com/emp4W.png) You can see that the scroll bars appear even when not needed. Is there a way I can h...
2014/12/09
[ "https://Stackoverflow.com/questions/27378633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3987340/" ]
You're calling `IconWigdet::paintEvent` directly. This is not allowed. Instead of calling it directly, call [`QWidget::update`](http://qt-project.org/doc/qt-5/qwidget.html#update) or [`QWidget::repaint`](http://qt-project.org/doc/qt-5/qwidget.html#repaint). ``` GroupWidget::GroupWidget() { groupLayout->addWidget(...
Try this instead of your constructor ``` GroupWidget::GroupWidget() { groupLayout->addWidget(icon, 0, 1, 1, 1, 0); this->setLayout(groupLayout); setMinimumSize(100,100); setMaximumSize(200,200); icon->show(); } ``` This will work,
6,730,969
What is the best way to store 17 decimals (ex. 1.12345678901234567) in a column table in SQL server? Also which type should I use in C++ to be able to push these 17 decimals into the SQL Query? Thanks
2011/07/18
[ "https://Stackoverflow.com/questions/6730969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/334265/" ]
Both `j` loops are nested inside `i` equally, `k` is the inner most loop
I'd say that `k` is the inner-most loop, because if you count the number of loops required to reach it from the outside, it's three loops, and that's the most out of all four of the loops in your code.
6,730,969
What is the best way to store 17 decimals (ex. 1.12345678901234567) in a column table in SQL server? Also which type should I use in C++ to be able to push these 17 decimals into the SQL Query? Thanks
2011/07/18
[ "https://Stackoverflow.com/questions/6730969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/334265/" ]
Both `j` loops are nested inside `i` equally, `k` is the inner most loop
Lol I don't know how to explain this so i'll give it my best shot I recommend using a `debugger`! it may help you so much you won't even know ``` for (i = 0; i < n; ++i) { //Goes in here first.. i = 0.. for (j = 0; j <= i - 1; ++j) { //Goes here second.. //Goes inside here and gets stuck until j ...
6,730,969
What is the best way to store 17 decimals (ex. 1.12345678901234567) in a column table in SQL server? Also which type should I use in C++ to be able to push these 17 decimals into the SQL Query? Thanks
2011/07/18
[ "https://Stackoverflow.com/questions/6730969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/334265/" ]
Lol I don't know how to explain this so i'll give it my best shot I recommend using a `debugger`! it may help you so much you won't even know ``` for (i = 0; i < n; ++i) { //Goes in here first.. i = 0.. for (j = 0; j <= i - 1; ++j) { //Goes here second.. //Goes inside here and gets stuck until j ...
I'd say that `k` is the inner-most loop, because if you count the number of loops required to reach it from the outside, it's three loops, and that's the most out of all four of the loops in your code.
264,721
[![enter image description here](https://i.stack.imgur.com/kR0Y7.png)](https://i.stack.imgur.com/kR0Y7.png) This is just a solved problem from a book on circuit analysis (Hayt), but I got a little confused on the voltage drop across the 2K resistor. This confusion might be about dependent sources. Why did he write the...
2016/10/21
[ "https://electronics.stackexchange.com/questions/264721", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/95890/" ]
Let me start with a direct answer. The existing current source, dependent or otherwise, can only drive through the existing \$2\:\textrm{k}\Omega\$ resistor and the voltage source. That's the only loop available to it. Let me redraw the schematic using this editor here: ![schematic](https://i.stack.imgur.com/v1IYu.png...
An ideal current source will "overpower" and ideal voltage source. In this case, because the output Vx is open there is no way current can flow that way. The only place the current has to go is through the 2k resistor and into the voltage source. An ideal voltage source can both sink and source current. In this cas...
73,506
My goal is to configure a trigger on the CampaignMember object in SF that, when fired, will send a marketing cloud email. We are using a Web2Lead form that will pass the campaign value into SF, which should be used to trigger the email to the person that submitted the form. In configuring the object for triggers in SF...
2015/04/27
[ "https://salesforce.stackexchange.com/questions/73506", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/18403/" ]
When writing a test class, one way to think about it is to build code that does the same thing a User will do in Salesforce themselves. In the case of a Campaign Member, the typical User process is something like this: 1. Create an Account 2. Create a Contact on that Account 3. Create a Campaign 4. Create a CampaignM...
To answer your question, the syntax is fieldname without quotes, literal value in quotes: ``` CampaignMember cmp = new CampaignMember(Campaign = 'test1'); ``` Also as an aside, I would advise against using seealldata=true in your test class. You're starting on the correct approach by creating test data within your t...
121,447
I've got a function that checks if a list item (setting) is true and then changes the setting which it does correctly but doesn't execute the second ExecuteQueryAsync functions. In debugging it jumps out of the code after that function/line and never reaches the OnQuerySuccess/Failure Here's what I have: ``` <html> <h...
2014/11/17
[ "https://sharepoint.stackexchange.com/questions/121447", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/35245/" ]
Try with creating `onQuerySuccess` and `onQueryFailure` functions outside of `onQuerySucceeded` function. ``` function onQuerySucceeded(sender, args) { var listItemEnumerator = collListItem.getEnumerator(); while (listItemEnumerator.moveNext()) { var oListItem = listItemEnumerator.get_current(); ...
Probably because `(oListItem.get_item('Setting_x0020_Value') == 'Yes')` isn't true when you run the code. If you straighten out all of the indentation levels using an IDE of some sort you'll get a clearer picture on where it falls out: ``` function onQuerySucceeded(sender, args) { var listItemEnumerator = collLi...
1,287,857
Modern browsers like Chrome and Firefox can handle FTP downloads: ``` ftp://my-ftp.com/my-file.csv ``` I want to share a link to another person and I don't want them to enter a username and password through a prompt. I am aware of the security impact, yet in this case ease of use has precedence. I wonder if there i...
2018/01/22
[ "https://superuser.com/questions/1287857", "https://superuser.com", "https://superuser.com/users/60795/" ]
You can provide the credentials to the URL like so: ``` username:password@host ``` Your example would become: ``` ftp://username:password@my-ftp.com/my-file.csv ``` --- You will run into problems if the user name contains invalid symbols such as `@`: ``` ftp://usern@me:password@my-ftp.com/my-file.csv ``` For...
Notable exception (for HTTP and HTTPS protocols) is IE: > > Internet Explorer versions 3.0 to 6.0 support the following syntax for HTTP or HTTPS URLs: > `http(s)://username:password@server/resource.ext` > You can use this URL syntax to automatically send user information to a Web site that supports the basic authen...
19,914,328
![enter image description here](https://i.stack.imgur.com/fGElK.png) As xml: ``` <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="20dp"> <Button android:id="@+id/locationButton" ...
2013/11/11
[ "https://Stackoverflow.com/questions/19914328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/401025/" ]
Solved it. I had to define another relative layout wrapping only the autocomplete textview and the button. This layout is the anchor of the popup, taking the width of the relative layout as its own width.The key: ``` android:dropDownWidth="wrap_content" android:dropDownAnchor="@+id/anchor" ``` Short version: ``` <R...
``` //try this <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="10dp"> <AutoCompleteTextView android:id="@+id/autocomplete_city" android:layout_width="0dp" android:l...
24,024,357
What I am trying to figure out is how to automatically calculate the total of funded dates for the last 4 months up to the current month for every month. For example since it is June I want Feb, March, April and May's funded accounts. This is the codec I have now and can't seem to figure it out. ``` DECLARE @Year int ...
2014/06/03
[ "https://Stackoverflow.com/questions/24024357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3723186/" ]
For example: ``` mat[,c(TRUE,FALSE)]+mat[,c(FALSE,TRUE)] x1 x3 1 14 10 2 5 11 ```
``` id <- 1:ncol(mat) mat[ , id[id%%2!=0] ] + mat[ , id[id%%2==0] ] x1 x3 [1,] 14 10 [2,] 5 11 ```
24,024,357
What I am trying to figure out is how to automatically calculate the total of funded dates for the last 4 months up to the current month for every month. For example since it is June I want Feb, March, April and May's funded accounts. This is the codec I have now and can't seem to figure it out. ``` DECLARE @Year int ...
2014/06/03
[ "https://Stackoverflow.com/questions/24024357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3723186/" ]
A generalization of this problem (for a `data.frame`) might be something like: ``` sapply(split.default(mydf, 0:(length(mydf)-1) %/% 2), rowSums) # 0 1 # [1,] 14 10 # [2,] 5 11 ``` Replace the "2" in `%/% 2` with the number of sets of columns you would like to "aggregate".
``` id <- 1:ncol(mat) mat[ , id[id%%2!=0] ] + mat[ , id[id%%2==0] ] x1 x3 [1,] 14 10 [2,] 5 11 ```
51,722
We have a customer server containing SQL Server 2008R2 with about 50 databases. The issue is that the CPU usage reaches 100% (or close to it) and it lasts for a couple hours. This typically happens in the morning (usually somewhere around 6am - 9am). Average CPU usage is 30% We looked at the scheduled reports and coul...
2013/10/17
[ "https://dba.stackexchange.com/questions/51722", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/970/" ]
> > Do the SQL Server track all the queries run so that the DMVs can access the information? > > > I would suggest taking a look at a free e-book Red Gate published here: [Performance Tuning with SQL Server Dynamic Management Views](http://www.red-gate.com/community/books/dynamic-management-views). It is free and ...
I would use select \* from sys.dm\_exec\_requests to see what requests that is executed against the databases. You will see wait types, wait resources, etc. It will give you more info then sp\_who2. High CPU usage can be caused by a lot of reasons like: * Bad execution plans caused by bad statistics * Locks and blocks...
6,088,427
I have two lists: ``` <ul id="list1"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> <ul id="list2"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> ``` I want when I hover "link1" from "list1" to add ...
2011/05/22
[ "https://Stackoverflow.com/questions/6088427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If your li elements does not have another class than link1, link2 etc. it pretty easy: ``` var list1 = $("#list1"); // Store references to list1 and list2 var list2 = $("#list2"); list1.find("li").hover(function() { var className = $(this).attr("class"); // Fetch current class name list2.find("li").removeClas...
Something like: ``` $("#list1 .link1").hover(function () { $("#list2 .link1").addClass("active"); }); ``` or, use $("#list2").find(".link1")...
6,088,427
I have two lists: ``` <ul id="list1"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> <ul id="list2"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> ``` I want when I hover "link1" from "list1" to add ...
2011/05/22
[ "https://Stackoverflow.com/questions/6088427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Try this: ``` $("#list1 li,#list2 li").hover(function() { var index = $(this).index(); $("#list1, #list2").each(function() { $("li",this).eq(index).toggleClass("active"); }); }); ``` [jsFiddle](http://jsfiddle.net/639Jj/1/)
Something like: ``` $("#list1 .link1").hover(function () { $("#list2 .link1").addClass("active"); }); ``` or, use $("#list2").find(".link1")...
6,088,427
I have two lists: ``` <ul id="list1"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> <ul id="list2"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> ``` I want when I hover "link1" from "list1" to add ...
2011/05/22
[ "https://Stackoverflow.com/questions/6088427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If your li elements does not have another class than link1, link2 etc. it pretty easy: ``` var list1 = $("#list1"); // Store references to list1 and list2 var list2 = $("#list2"); list1.find("li").hover(function() { var className = $(this).attr("class"); // Fetch current class name list2.find("li").removeClas...
Try something like this: ``` $("li").hover(function () { var targetClass = $(this).attr('class'); $("."+targetClass).not($(this)).addClass("active"); }, function() { $("li").removeClass("active"); }); ```
6,088,427
I have two lists: ``` <ul id="list1"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> <ul id="list2"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> ``` I want when I hover "link1" from "list1" to add ...
2011/05/22
[ "https://Stackoverflow.com/questions/6088427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Try this: ``` $("#list1 li,#list2 li").hover(function() { var index = $(this).index(); $("#list1, #list2").each(function() { $("li",this).eq(index).toggleClass("active"); }); }); ``` [jsFiddle](http://jsfiddle.net/639Jj/1/)
If your li elements does not have another class than link1, link2 etc. it pretty easy: ``` var list1 = $("#list1"); // Store references to list1 and list2 var list2 = $("#list2"); list1.find("li").hover(function() { var className = $(this).attr("class"); // Fetch current class name list2.find("li").removeClas...
6,088,427
I have two lists: ``` <ul id="list1"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> <ul id="list2"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> ``` I want when I hover "link1" from "list1" to add ...
2011/05/22
[ "https://Stackoverflow.com/questions/6088427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If your li elements does not have another class than link1, link2 etc. it pretty easy: ``` var list1 = $("#list1"); // Store references to list1 and list2 var list2 = $("#list2"); list1.find("li").hover(function() { var className = $(this).attr("class"); // Fetch current class name list2.find("li").removeClas...
You can do this even if they don't have the same class using `$(this).index()` will return the index of current hovered element. So, you just have to add the class to element of same index on the other list Here's a basic working example: <http://jsfiddle.net/Wckyq/>
6,088,427
I have two lists: ``` <ul id="list1"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> <ul id="list2"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> ``` I want when I hover "link1" from "list1" to add ...
2011/05/22
[ "https://Stackoverflow.com/questions/6088427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Try this: ``` $("#list1 li,#list2 li").hover(function() { var index = $(this).index(); $("#list1, #list2").each(function() { $("li",this).eq(index).toggleClass("active"); }); }); ``` [jsFiddle](http://jsfiddle.net/639Jj/1/)
Try something like this: ``` $("li").hover(function () { var targetClass = $(this).attr('class'); $("."+targetClass).not($(this)).addClass("active"); }, function() { $("li").removeClass("active"); }); ```
6,088,427
I have two lists: ``` <ul id="list1"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> <ul id="list2"> <li class="link1">Link 1</li> <li class="link2">Link 2</li> <li class="link3">Link 3</li> </ul> ``` I want when I hover "link1" from "list1" to add ...
2011/05/22
[ "https://Stackoverflow.com/questions/6088427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Try this: ``` $("#list1 li,#list2 li").hover(function() { var index = $(this).index(); $("#list1, #list2").each(function() { $("li",this).eq(index).toggleClass("active"); }); }); ``` [jsFiddle](http://jsfiddle.net/639Jj/1/)
You can do this even if they don't have the same class using `$(this).index()` will return the index of current hovered element. So, you just have to add the class to element of same index on the other list Here's a basic working example: <http://jsfiddle.net/Wckyq/>
1,967,722
For most database-backed projects I've worked on, there is a need to get "startup" or test data into the database before deploying the project. Examples of startup data: a table that lists all the countries in the world or a table that lists a bunch of colors that will be used to populate a color palette. I've been us...
2009/12/28
[ "https://Stackoverflow.com/questions/1967722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129164/" ]
1) I prefer to use scripts for several reasons. • Scripts are easy to modify, and plus when I get ready to deploy my application to a production environment, I already have the scripts written so I'm all set. • If I need to deploy my database to a different platform (like Oracle or MySQL) then it's easy to make minor...
Since I use an object-relational mapper (Hibernate, there is also a .NET version), I prefer to generate such data in my programming language. The ORM then takes care of writing things into the database. I don't have to worry about changing column names in the data because I need to fix the mapping anyway. If refactorin...
1,967,722
For most database-backed projects I've worked on, there is a need to get "startup" or test data into the database before deploying the project. Examples of startup data: a table that lists all the countries in the world or a table that lists a bunch of colors that will be used to populate a color palette. I've been us...
2009/12/28
[ "https://Stackoverflow.com/questions/1967722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129164/" ]
1) I prefer to use scripts for several reasons. • Scripts are easy to modify, and plus when I get ready to deploy my application to a production environment, I already have the scripts written so I'm all set. • If I need to deploy my database to a different platform (like Oracle or MySQL) then it's easy to make minor...
Excel is an unnecessary component of this process. Script the current version the database components that you want to reuse, and add the script to your source control system. When you need to make changes in the future, either modify the entities in the database and regenerate the script, or modify the script and re...
1,967,722
For most database-backed projects I've worked on, there is a need to get "startup" or test data into the database before deploying the project. Examples of startup data: a table that lists all the countries in the world or a table that lists a bunch of colors that will be used to populate a color palette. I've been us...
2009/12/28
[ "https://Stackoverflow.com/questions/1967722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129164/" ]
I think your current process is fine for seeding the database with initial data. It's simple, easy to maintain, and works for you. If you've got a good database design with adequate constraints then it doesn't really matter how you seed the initial data. You could use an intermediate tool to generate scripts but why bo...
1) I prefer to use scripts for several reasons. • Scripts are easy to modify, and plus when I get ready to deploy my application to a production environment, I already have the scripts written so I'm all set. • If I need to deploy my database to a different platform (like Oracle or MySQL) then it's easy to make minor...
1,967,722
For most database-backed projects I've worked on, there is a need to get "startup" or test data into the database before deploying the project. Examples of startup data: a table that lists all the countries in the world or a table that lists a bunch of colors that will be used to populate a color palette. I've been us...
2009/12/28
[ "https://Stackoverflow.com/questions/1967722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129164/" ]
Frankly, I find the concept of using Excel here a bit scary. It obviously *works*, but it's creating a dependency on an ad-hoc data source that won't be resolved until much later. Last thing you want is to be in a mad rush to deploy a database and find out that the Excel file is mangled, or worse, missing entirely. I s...
Since I use an object-relational mapper (Hibernate, there is also a .NET version), I prefer to generate such data in my programming language. The ORM then takes care of writing things into the database. I don't have to worry about changing column names in the data because I need to fix the mapping anyway. If refactorin...
1,967,722
For most database-backed projects I've worked on, there is a need to get "startup" or test data into the database before deploying the project. Examples of startup data: a table that lists all the countries in the world or a table that lists a bunch of colors that will be used to populate a color palette. I've been us...
2009/12/28
[ "https://Stackoverflow.com/questions/1967722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129164/" ]
I think your current process is fine for seeding the database with initial data. It's simple, easy to maintain, and works for you. If you've got a good database design with adequate constraints then it doesn't really matter how you seed the initial data. You could use an intermediate tool to generate scripts but why bo...
Since I use an object-relational mapper (Hibernate, there is also a .NET version), I prefer to generate such data in my programming language. The ORM then takes care of writing things into the database. I don't have to worry about changing column names in the data because I need to fix the mapping anyway. If refactorin...
1,967,722
For most database-backed projects I've worked on, there is a need to get "startup" or test data into the database before deploying the project. Examples of startup data: a table that lists all the countries in the world or a table that lists a bunch of colors that will be used to populate a color palette. I've been us...
2009/12/28
[ "https://Stackoverflow.com/questions/1967722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129164/" ]
Frankly, I find the concept of using Excel here a bit scary. It obviously *works*, but it's creating a dependency on an ad-hoc data source that won't be resolved until much later. Last thing you want is to be in a mad rush to deploy a database and find out that the Excel file is mangled, or worse, missing entirely. I s...
Excel is an unnecessary component of this process. Script the current version the database components that you want to reuse, and add the script to your source control system. When you need to make changes in the future, either modify the entities in the database and regenerate the script, or modify the script and re...
1,967,722
For most database-backed projects I've worked on, there is a need to get "startup" or test data into the database before deploying the project. Examples of startup data: a table that lists all the countries in the world or a table that lists a bunch of colors that will be used to populate a color palette. I've been us...
2009/12/28
[ "https://Stackoverflow.com/questions/1967722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129164/" ]
I think your current process is fine for seeding the database with initial data. It's simple, easy to maintain, and works for you. If you've got a good database design with adequate constraints then it doesn't really matter how you seed the initial data. You could use an intermediate tool to generate scripts but why bo...
Excel is an unnecessary component of this process. Script the current version the database components that you want to reuse, and add the script to your source control system. When you need to make changes in the future, either modify the entities in the database and regenerate the script, or modify the script and re...
1,967,722
For most database-backed projects I've worked on, there is a need to get "startup" or test data into the database before deploying the project. Examples of startup data: a table that lists all the countries in the world or a table that lists a bunch of colors that will be used to populate a color palette. I've been us...
2009/12/28
[ "https://Stackoverflow.com/questions/1967722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129164/" ]
I think your current process is fine for seeding the database with initial data. It's simple, easy to maintain, and works for you. If you've got a good database design with adequate constraints then it doesn't really matter how you seed the initial data. You could use an intermediate tool to generate scripts but why bo...
Frankly, I find the concept of using Excel here a bit scary. It obviously *works*, but it's creating a dependency on an ad-hoc data source that won't be resolved until much later. Last thing you want is to be in a mad rush to deploy a database and find out that the Excel file is mangled, or worse, missing entirely. I s...
5,011,046
I am writing some code to write out an email to a file, let you edit it in your own editor, and when you're done you can tell my code to carry on. I'd like to have it catch the common error where you still have the file open, and therefore might not have saved it. My first attempt was to try to obtain an exclusive lo...
2011/02/16
[ "https://Stackoverflow.com/questions/5011046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3189/" ]
After some Firebug stepping, I found this works quite well. ``` var store = this.getStore(); store.remoteFilter = false; store.clearFilter(); store.remoteFilter = true; store.filter(...); ``` `remoteFilter` does not seem to be a documented property, but it will suspend xhr calls while it's set to `false`. When you ...
The clearFilters() method available with GridFilter class should be able to clear the filters. Did you give it a try? Also, when does the grid#2 get loaded? according to your first para, when the user select a manager the employees are listed. But in the second para where you stated your requirement, you said the grid#...
5,011,046
I am writing some code to write out an email to a file, let you edit it in your own editor, and when you're done you can tell my code to carry on. I'd like to have it catch the common error where you still have the file open, and therefore might not have saved it. My first attempt was to try to obtain an exclusive lo...
2011/02/16
[ "https://Stackoverflow.com/questions/5011046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3189/" ]
After some Firebug stepping, I found this works quite well. ``` var store = this.getStore(); store.remoteFilter = false; store.clearFilter(); store.remoteFilter = true; store.filter(...); ``` `remoteFilter` does not seem to be a documented property, but it will suspend xhr calls while it's set to `false`. When you ...
have you tried temporarily suspending the events on the grid? grid.suspendEvents(); grid.doYourMagic(); grid.resumeEvents(); reloading of the store is most likely triggered by an event anyway.
5,011,046
I am writing some code to write out an email to a file, let you edit it in your own editor, and when you're done you can tell my code to carry on. I'd like to have it catch the common error where you still have the file open, and therefore might not have saved it. My first attempt was to try to obtain an exclusive lo...
2011/02/16
[ "https://Stackoverflow.com/questions/5011046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3189/" ]
After some Firebug stepping, I found this works quite well. ``` var store = this.getStore(); store.remoteFilter = false; store.clearFilter(); store.remoteFilter = true; store.filter(...); ``` `remoteFilter` does not seem to be a documented property, but it will suspend xhr calls while it's set to `false`. When you ...
I've experienced the same issue but not with a Grid but with a DataView, however, this might apply equally to your case. I initially tried: ``` var store = this.getStore(); store.suspendEvents(); store.clearFilter(); store.resumeEvents(); store.filter(...); ``` this didn't work—still 2 HTTP requests were made, once ...
53,752,122
I have a script that creates additional files upon submission of a Google Form. It also sets up a trigger for said new document, so that people are emailed when any edits are made to the document after its creation, e.g. ``` ScriptApp.newTrigger("sendEmailOnModification") .forSpreadsheet(SpreadsheetApp.openBy...
2018/12/12
[ "https://Stackoverflow.com/questions/53752122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7144195/" ]
You will want to use calulated properties. ``` $Emails | Select-Object -Property @{Name='ID';Expression={$_.ID};},@{Name='AttachmentId';Expression={$_.Attachments.ID};} ``` You can shorten `Name` and `Expression` to `n` and `e`. [See this article for more](https://mcpmag.com/articles/2017/01/19/using-powershell-cal...
you need to use a calculated property if you use `Select-Object`. something like this ... ``` $Emails = @{ ID = "E123"; Subject = "Check this out"; Attachments = @{ ID = "A123"; Name = "FunnyPic.jpg" ...
19,953,977
I am very familiar with PHP, but this is my first time using the mysqli library. I am trying to insert a row into the database and it just does not insert. My code look like this (database login details changed for security): ``` ... // $_REQUEST variables processed $oConn = new mysqli("localhost","user","password","m...
2013/11/13
[ "https://Stackoverflow.com/questions/19953977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2822895/" ]
typo-u forgot to add single quotes and also a bracket. ``` $oConn->query("insert into bookings (provider_id, provider_rates_id, secret, preferred_date, alternate_date, adults, children, transfer_required, firstname, lastname, email, phone, comments) values ('$iProviderID', '$iRatesID', '$sSecret', '$sDate', '$sAl...
there's a typo on your code, you're missing to close the ")" of the values part of your query. The correct, query: ``` $oConn->query("insert into bookings (provider_id, provider_rates_id, secret, preferred_date, alternate_date, adults, children, transfer_required, firstname, lastname, email, phone, comments) values (...
19,953,977
I am very familiar with PHP, but this is my first time using the mysqli library. I am trying to insert a row into the database and it just does not insert. My code look like this (database login details changed for security): ``` ... // $_REQUEST variables processed $oConn = new mysqli("localhost","user","password","m...
2013/11/13
[ "https://Stackoverflow.com/questions/19953977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2822895/" ]
``` ... // $_REQUEST variables processed $oConn = new mysqli("localhost","user","password","mydatabase") or die("Error " . $oConn->error); $oConn->query("insert into bookings (provider_id, provider_rates_id, secret, preferred_date, alternate_date, adults, children, transfer_required, firstname, lastname, e...
there's a typo on your code, you're missing to close the ")" of the values part of your query. The correct, query: ``` $oConn->query("insert into bookings (provider_id, provider_rates_id, secret, preferred_date, alternate_date, adults, children, transfer_required, firstname, lastname, email, phone, comments) values (...
19,953,977
I am very familiar with PHP, but this is my first time using the mysqli library. I am trying to insert a row into the database and it just does not insert. My code look like this (database login details changed for security): ``` ... // $_REQUEST variables processed $oConn = new mysqli("localhost","user","password","m...
2013/11/13
[ "https://Stackoverflow.com/questions/19953977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2822895/" ]
typo-u forgot to add single quotes and also a bracket. ``` $oConn->query("insert into bookings (provider_id, provider_rates_id, secret, preferred_date, alternate_date, adults, children, transfer_required, firstname, lastname, email, phone, comments) values ('$iProviderID', '$iRatesID', '$sSecret', '$sDate', '$sAl...
If this is not a php error, you can try using `echo $oConn->error` to get mysql query error!
19,953,977
I am very familiar with PHP, but this is my first time using the mysqli library. I am trying to insert a row into the database and it just does not insert. My code look like this (database login details changed for security): ``` ... // $_REQUEST variables processed $oConn = new mysqli("localhost","user","password","m...
2013/11/13
[ "https://Stackoverflow.com/questions/19953977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2822895/" ]
typo-u forgot to add single quotes and also a bracket. ``` $oConn->query("insert into bookings (provider_id, provider_rates_id, secret, preferred_date, alternate_date, adults, children, transfer_required, firstname, lastname, email, phone, comments) values ('$iProviderID', '$iRatesID', '$sSecret', '$sDate', '$sAl...
``` ... // $_REQUEST variables processed $oConn = new mysqli("localhost","user","password","mydatabase") or die("Error " . $oConn->error); $oConn->query("insert into bookings (provider_id, provider_rates_id, secret, preferred_date, alternate_date, adults, children, transfer_required, firstname, lastname, e...
19,953,977
I am very familiar with PHP, but this is my first time using the mysqli library. I am trying to insert a row into the database and it just does not insert. My code look like this (database login details changed for security): ``` ... // $_REQUEST variables processed $oConn = new mysqli("localhost","user","password","m...
2013/11/13
[ "https://Stackoverflow.com/questions/19953977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2822895/" ]
``` ... // $_REQUEST variables processed $oConn = new mysqli("localhost","user","password","mydatabase") or die("Error " . $oConn->error); $oConn->query("insert into bookings (provider_id, provider_rates_id, secret, preferred_date, alternate_date, adults, children, transfer_required, firstname, lastname, e...
If this is not a php error, you can try using `echo $oConn->error` to get mysql query error!
172,993
Is there a self-adjoint extension of an operator that corresponds to a particle in a box $[a,b] \times [c,d] \subset \mathbb{R}^2$ with a delta potential, i.e., $-\Delta + \lambda \delta\_y $ on $L^2([a,b] \times [c,d])$ ? All the references I've been able to find mention a particle on the line or on $\mathbb{R}^2$.
2014/06/30
[ "https://mathoverflow.net/questions/172993", "https://mathoverflow.net", "https://mathoverflow.net/users/54524/" ]
Maybe the following references will be helpful: <http://arxiv.org/abs/quant-ph/0103153> (Self-adjoint extensions of operators and the teaching of quantum mechanics, by G. Bonneau, J. Faraut and G. Valent). <https://www.amherst.edu/media/view/10264/original/gopalakrishnan06.pdf> (Self-Adjointness and the Renormalizati...
The paper Ph. Blanchard, R. Figari, A. Mantile "Point Interaction Hamiltonians in Bounded Domains" <http://arxiv.org/abs/0704.3249> may contain some answers. In any case, if you have an operator $H$ in $L^2(\Omega)$ and want to study its perturbations by zero-range potentials, you need to know the integral kernel of th...
51,202,460
*I'm using google apps script for Telegram Bot API & I'm having problem with* **InlineQueryResultArticle** in **answerInlineQuery** method. ``` function answerInlineQuery(iqid, result){ var data = { method: "post", payload: { method: "answerInlineQuery", inline_query_id: iqid, ...
2018/07/06
[ "https://Stackoverflow.com/questions/51202460", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9908072/" ]
The `id` field for a [InlineQueryResultArticle](https://core.telegram.org/bots/api#inlinequeryresultarticle) must be unique for each result. However you are setting the `id` as `iqid` for both results. You should replace them with custom ids. ``` var result= { InlineQueryResultArticle:[ {type:'article',id...
After many attempts I found solution: Here there are an inline answer with three results \*\*\*\*Be careful :change value of `document_file_id` with a sample file\_id from your bot else you will see an error ``` //your bot token placed here const token = ""; tgmsg('answerInlineQuery', { "inline_query_id": updat...
22,344,669
I am using the standard web service client in Netbeans. The SOAP server includes a Cookie as a HTTP header. How do I access this header/cookie from the client code? I assume one method involves using a MessageHandler. I have added a Web Service **Message Handler**, and I have tried modifying the `public boolean handle...
2014/03/12
[ "https://Stackoverflow.com/questions/22344669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132733/" ]
The solution that I used was by using `getResponseContext()` to get a custom HTTP header: ``` Map<String, Object> responseHeaders; responseHeaders = sourceDispatch.getResponseContext(); Object cookie = responseHeaders.get("javax.xml.ws.http.response.headers"); ``` This is nice and familiar because I had used `get...
Try to use: ``` SOAPConnection connection = IpspSOAPConnectionFactory.newInstance().createConnection(); SOAPMessage responseSoap = connection.call(requestSoap, webServiceUrl); String[] someHeader = responseSoap.getMimeHeaders().getHeader(someHeaderName); ```
64,369,600
I just wanted to get offset(+02:00) from TimeZone but seems like it is not working for IST, JST, EST, and BET. ``` TimeZone exchangeTimeZone = banker.getTimeZone(); String timeZone = ZonedDateTime.now(ZoneId.of(exchangeTimeZone.getID())).getOffset().getId(); ``` It is returning error "Unknown time-zone ID: EST". ...
2020/10/15
[ "https://Stackoverflow.com/questions/64369600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6127373/" ]
Use [ZoneId.SHORT\_IDS](https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html#SHORT_IDS) ``` ZonedDateTime.now(ZoneId.of(exchangeTimeZone.getID(), ZoneId.SHORT_IDS)) .getOffset().getId(); ```
You could try to find a mapping for an abbreviation you got: ```java public static ZoneId getFromAbbreviation(String abbreviation) { return ZoneId.of(ZoneId.SHORT_IDS.get(abbreviation)); } ``` You could get the offsets like in this `main`: ```java public static void main(String[] args) { ZoneId istEquivalen...
64,369,600
I just wanted to get offset(+02:00) from TimeZone but seems like it is not working for IST, JST, EST, and BET. ``` TimeZone exchangeTimeZone = banker.getTimeZone(); String timeZone = ZonedDateTime.now(ZoneId.of(exchangeTimeZone.getID())).getOffset().getId(); ``` It is returning error "Unknown time-zone ID: EST". ...
2020/10/15
[ "https://Stackoverflow.com/questions/64369600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6127373/" ]
TimeZone.toZoneId() ------------------- ``` // Never do this in your code: Get a TimeZone with ID EST for demonstration only. TimeZone tz = TimeZone.getTimeZone("EST"); String currentOffsetString = ZonedDateTime.now(tz.toZoneId()) .getOffset() .getId(); System.out.println(curre...
You could try to find a mapping for an abbreviation you got: ```java public static ZoneId getFromAbbreviation(String abbreviation) { return ZoneId.of(ZoneId.SHORT_IDS.get(abbreviation)); } ``` You could get the offsets like in this `main`: ```java public static void main(String[] args) { ZoneId istEquivalen...
16,208,457
Essentially I need write a string method that receives two string arguments and replaces every character that exists in the second String with "" in the first. For example the first `String toBeFixed = "I have a wonderful AMD CPU. I also like cheese."` and the second `String toReplaceWith ="oils"`. `The string returned...
2013/04/25
[ "https://Stackoverflow.com/questions/16208457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2318481/" ]
`String.replaceAll` takes a Regex statement as its first argument. Matching `"oils"` will this match specifically the phrase "oils". Instead, you had the right idea in your post. Matching `"["+remove+"]"` will do the trick, so long as your removal string contains no reserved regex symbols such as brackets, periods, et...
This should work. `replace` works just like `replaceAll` - only with values rather than a regex ``` public class removeChars { public static String removeChars(String str, String remove) { String fixed = str; for(int index = 0; index < remove.length; index++) { fixed = fixed.replace(r...
16,208,457
Essentially I need write a string method that receives two string arguments and replaces every character that exists in the second String with "" in the first. For example the first `String toBeFixed = "I have a wonderful AMD CPU. I also like cheese."` and the second `String toReplaceWith ="oils"`. `The string returned...
2013/04/25
[ "https://Stackoverflow.com/questions/16208457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2318481/" ]
`String.replaceAll` takes a Regex statement as its first argument. Matching `"oils"` will this match specifically the phrase "oils". Instead, you had the right idea in your post. Matching `"["+remove+"]"` will do the trick, so long as your removal string contains no reserved regex symbols such as brackets, periods, et...
Maybe not the most efficient solution but it's simple: ``` public class removeChars { public static String removeChars(String str, String remove) { String fixed = str; for(int i = 0; i < remove.length(); i++) fixed = fixed.replaceAll(remove.charAt(i)+"",""); return fixed; ...
16,208,457
Essentially I need write a string method that receives two string arguments and replaces every character that exists in the second String with "" in the first. For example the first `String toBeFixed = "I have a wonderful AMD CPU. I also like cheese."` and the second `String toReplaceWith ="oils"`. `The string returned...
2013/04/25
[ "https://Stackoverflow.com/questions/16208457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2318481/" ]
Maybe not the most efficient solution but it's simple: ``` public class removeChars { public static String removeChars(String str, String remove) { String fixed = str; for(int i = 0; i < remove.length(); i++) fixed = fixed.replaceAll(remove.charAt(i)+"",""); return fixed; ...
This should work. `replace` works just like `replaceAll` - only with values rather than a regex ``` public class removeChars { public static String removeChars(String str, String remove) { String fixed = str; for(int index = 0; index < remove.length; index++) { fixed = fixed.replace(r...
58,352,326
[error\_giving\_notebook](https://colab.research.google.com/drive/1lipWy-B6BrtZlARM_amdnc7zgKiFaSRR) [non\_problematic\_notebook](https://colab.research.google.com/drive/1ksJgAXniJZIm8S4EmPDIE3hA7DuwWs0a) As it can be seen that I have used tf.function decorator in the 'error\_giving\_notebook' and it throws a ValueEr...
2019/10/12
[ "https://Stackoverflow.com/questions/58352326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9435613/" ]
As you are trying to use function decorator in TF 2.0, please enable run function eagerly by using below line after importing TensorFlow: ``` tf.config.experimental_run_functions_eagerly(True) ``` Since the above is deprecated(no longer experimental?), please use the following instead: ``` tf.config.run_functions_e...
The problem here is in the return values of the call method of class conv2d: ``` if self.bias: if self.pad == 'REFLECT': self.p = (self.filter_size - 1) // 2 self.x = tf.pad(inputs, [[0, 0], [self.p, self.p], [self.p, self.p], [0, 0]], 'REFLECT') return Conv2D(filters=self.filter_num, kernel_size=(self.f...
35,028,958
have a very simple one line console app (using monodevelop) but getting below error. `System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: git2-e0902fb` my app has reference two nuget package * LibGit2Sharp 0.21.0.176 * ...
2016/01/27
[ "https://Stackoverflow.com/questions/35028958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/96898/" ]
`s = matches.to_a` is an array `["12+2"]`, the `eval(s.to_s)` will return the array `["12+2"]`, and when you print it, you will get the output `12+2`, a string representation of the array `["12+2"]`. You should be `eval`ing the element of the array, in this case, `s[0]` or `s.first`. Fix it like this: ``` perms=["12...
Instead of iterating through inputs, one might directly map them to outputs: ``` perms.map do |p| # map inputs to outputs eval(p) if p =~ /\A\d+[+-\/*]\d+\z/ # return eval’ed or nil end.compact # get rid of nils #⇒ [14] ```
43,148,553
I want to this list ``` A B C 111 11 123 1 42 5 ``` To be sorted ``` 1 5 11 42 111 123 A B C ``` By default, it sorts numbers like strings (So, it goes 1,11,111,123,42,5), But I want to sort numbers like numbers, and than strings that are not numbers. Is there clean solution to sort it like above? It is a list...
2017/03/31
[ "https://Stackoverflow.com/questions/43148553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6836183/" ]
I wrote this `IComparer` implementation a few months back to handle something like this. I think it will do what you want by default, though it is built to handle more complex cases where number/letter groups are separated by delimiters that also need to be sorted atomically. You should be able to adjust it to your nee...
I haven't tested this code for performance, but you can solve this with a Comparer ``` public class ArrayItemComparer : IComparer<string> { public int Compare(string x, string y) { int xInt = 0, yInt = 0; bool parseX = int.TryParse(x, out xInt); bool parseY = int.TryParse(y, out yInt);...