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 |
|---|---|---|---|---|---|
477,504 | I got a local repository in `/var/www/html/centos/7` directory. In here, all rpm packages from centos are downloaded.
I will create a crontab for updating my local repository every 1 week or sth.
I want to learn that does `repocreate --update` do this? Or should I download all the packages from centos repo again?
If ... | 2018/10/24 | [
"https://unix.stackexchange.com/questions/477504",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/317026/"
] | If you have problems with rsync, then you can use [reposync](https://linux.die.net/man/1/reposync). It is able to download all packages (or --newest-only| -n) from repo, configured in the system.
So final commands in script looks like:
```
/usr/bin/reposync --repoid=updates --download_path=/var/www/html/centos7/repo/u... | repoquery queries every package in repository that you configured for your system and after that give the list to xargs to download all packages (new ones not existing ones)with repotrack to your server.
```
repoquery -a | xargs repotrack -a x86_64 -p .
```
The rsync solution also works if you haven't got any firewa... |
1,016,204 | I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.
I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of the... | 2009/06/19 | [
"https://Stackoverflow.com/questions/1016204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | 1. Check your target settings
Make sure you're actually linking to all of those frameworks in the Target (check under "link binary with libraries")
2. Make sure you've chosen the 3.0 sdk as your base SDK
3. Create a blank project and add your frameworks as before; if you still have issues, probably a borked SDK instal... | I had the same problem using Xcode 3.2.1 but it was solved in an easier manner. I realized I had recently disabled my target's environment variables, specifically ones to do with memory debugging (NSDebugEnabled, NSZombieEnabled, NSAutoreleaseFreedObjectCheckEnabled, MallocStackLogging, MallocStackLoggingNoCompact). Th... |
1,016,204 | I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.
I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of the... | 2009/06/19 | [
"https://Stackoverflow.com/questions/1016204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I just deleted the UIKit.framework from the 'Frameworks' folder, right-clicked and added it back again.
Clean build, and no problem.. | I had the same problem using Xcode 3.2.1 but it was solved in an easier manner. I realized I had recently disabled my target's environment variables, specifically ones to do with memory debugging (NSDebugEnabled, NSZombieEnabled, NSAutoreleaseFreedObjectCheckEnabled, MallocStackLogging, MallocStackLoggingNoCompact). Th... |
1,016,204 | I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.
I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of the... | 2009/06/19 | [
"https://Stackoverflow.com/questions/1016204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | OK, SO I HAVE THE ANSWER!!!
Quite simply, Xcode is not changing all of the variables correctly in the actual .xcodeproj file. So, here are the steps I took.
Get out of Xcode, you've got to do this job at the terminal. Bring up a terminal and go to where your project is. Find your .xcodeproj and go into it as if it we... | I have had some similar problems with Xcode that seem to have no apparent cause. The fact of the matter is that Xcode does still have bugs here and there and sometimes you WILL run into a wall.
**My Experience:** Similar to your situation somewhat, on one particular occasion, an Xcode project I was working just stopp... |
1,016,204 | I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.
I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of the... | 2009/06/19 | [
"https://Stackoverflow.com/questions/1016204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I was getting the same error
dyld: Library not loaded: /System/Library/Frameworks/UIKit.framework/UIKit
The solution on my case was simply quit Xcode and try again. | I have had some similar problems with Xcode that seem to have no apparent cause. The fact of the matter is that Xcode does still have bugs here and there and sometimes you WILL run into a wall.
**My Experience:** Similar to your situation somewhat, on one particular occasion, an Xcode project I was working just stopp... |
1,016,204 | I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.
I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of the... | 2009/06/19 | [
"https://Stackoverflow.com/questions/1016204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | 1. Check your target settings
Make sure you're actually linking to all of those frameworks in the Target (check under "link binary with libraries")
2. Make sure you've chosen the 3.0 sdk as your base SDK
3. Create a blank project and add your frameworks as before; if you still have issues, probably a borked SDK instal... | Same problem when launching my application without debugging.
In my experience the produced binary does not seem to be the culprit.
I created an app from the xcode wizard which does launch OK in the simulator (let's call it testApp, my application being called myApp), I tried to figure out where is the difference with... |
1,016,204 | I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.
I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of the... | 2009/06/19 | [
"https://Stackoverflow.com/questions/1016204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I was getting the same error
dyld: Library not loaded: /System/Library/Frameworks/UIKit.framework/UIKit
The solution on my case was simply quit Xcode and try again. | Same problem when launching my application without debugging.
In my experience the produced binary does not seem to be the culprit.
I created an app from the xcode wizard which does launch OK in the simulator (let's call it testApp, my application being called myApp), I tried to figure out where is the difference with... |
1,016,204 | I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.
I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of the... | 2009/06/19 | [
"https://Stackoverflow.com/questions/1016204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | 1. Check your target settings
Make sure you're actually linking to all of those frameworks in the Target (check under "link binary with libraries")
2. Make sure you've chosen the 3.0 sdk as your base SDK
3. Create a blank project and add your frameworks as before; if you still have issues, probably a borked SDK instal... | I have had some similar problems with Xcode that seem to have no apparent cause. The fact of the matter is that Xcode does still have bugs here and there and sometimes you WILL run into a wall.
**My Experience:** Similar to your situation somewhat, on one particular occasion, an Xcode project I was working just stopp... |
1,016,204 | I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.
I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of the... | 2009/06/19 | [
"https://Stackoverflow.com/questions/1016204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | OK, SO I HAVE THE ANSWER!!!
Quite simply, Xcode is not changing all of the variables correctly in the actual .xcodeproj file. So, here are the steps I took.
Get out of Xcode, you've got to do this job at the terminal. Bring up a terminal and go to where your project is. Find your .xcodeproj and go into it as if it we... | I just deleted the UIKit.framework from the 'Frameworks' folder, right-clicked and added it back again.
Clean build, and no problem.. |
1,016,204 | I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.
I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of the... | 2009/06/19 | [
"https://Stackoverflow.com/questions/1016204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | OK, SO I HAVE THE ANSWER!!!
Quite simply, Xcode is not changing all of the variables correctly in the actual .xcodeproj file. So, here are the steps I took.
Get out of Xcode, you've got to do this job at the terminal. Bring up a terminal and go to where your project is. Find your .xcodeproj and go into it as if it we... | I had the same problem using Xcode 3.2.1 but it was solved in an easier manner. I realized I had recently disabled my target's environment variables, specifically ones to do with memory debugging (NSDebugEnabled, NSZombieEnabled, NSAutoreleaseFreedObjectCheckEnabled, MallocStackLogging, MallocStackLoggingNoCompact). Th... |
1,016,204 | I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.
I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of the... | 2009/06/19 | [
"https://Stackoverflow.com/questions/1016204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I was getting the same error
dyld: Library not loaded: /System/Library/Frameworks/UIKit.framework/UIKit
The solution on my case was simply quit Xcode and try again. | I had the same problem using Xcode 3.2.1 but it was solved in an easier manner. I realized I had recently disabled my target's environment variables, specifically ones to do with memory debugging (NSDebugEnabled, NSZombieEnabled, NSAutoreleaseFreedObjectCheckEnabled, MallocStackLogging, MallocStackLoggingNoCompact). Th... |
64,040,215 | I made this code that creates a scatter chart and allows me to change the color of a node on the plot when I click/select it.
```
package com.jpc.javafx.charttest;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.ScatterChart;
import jav... | 2020/09/24 | [
"https://Stackoverflow.com/questions/64040215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14127900/"
] | To summarize your requirement:
* a visual property of a chart-symbol should be marked on user interaction
* there should be only one such marked symbol
Sounds like a kind of selection mechanism - which is not supported for chart symbols out of the box, application code must take care of it. The task is
* keep track ... | One thing you can do is loop through the data and change the color for the one clicked and set all the other to `null`
```
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.ScatterChart;
import javafx.scene.chart.XYChart;
import javafx.sce... |
14,241,389 | I am getting a "Specified cast is not valid" valid when doing only a release build from MSBuild 4.0. I tested this out in using a release build from Visual Studio 2012 and didn't get this issue. I also tested this out using a debug build from MSBuild 4.0 and didn't get this issue.
Exception: ![enter image description... | 2013/01/09 | [
"https://Stackoverflow.com/questions/14241389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/463469/"
] | It is likely that the call stack is different than what you are expecting it to be. Your method may be getting inlined, then `GetFrame(1)` is retrieving the caller's caller. When the value is retrieved from the dictionary, it is of a different type because it is for a different method.
You could try adding the attribu... | I had the same problem when running `nuget pack` which invoked
>
> MSBuild auto-detection: using msbuild version '15.0'...
>
>
>
but the problem was solved by running `dotnet pack` which invoked
>
> Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
>
>
> |
56,666,430 | hi m trying to download db data in excel format,,, but when I click on download then it says: Call to undefined method Maatwebsite\Excel\Excel::create()
code of controller:
```
function excel()
{
$pdf_data = DB::table('importpdfs')->get()->toArray();
$pdf_array[] = array('Battery', 'No_of_questions_attempted',... | 2019/06/19 | [
"https://Stackoverflow.com/questions/56666430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10896655/"
] | The create method was removed with `laravel-excel` version `3.0`.
From the [upgrade guide](https://docs.laravel-excel.com/3.1/getting-started/upgrade.html#upgrading-to-3-from-2-1):
>
> Excel::create() is removed and replaced by
> Excel::download/Excel::store($yourExport)
>
>
>
I would use the [quickstart guide]... | You are probably not using the Facade and using the file directly, make sure you are using
```
use Maatwebsite\Excel\Facades\Excel;
```
and not
```
use Maatwebsite\Excel\Excel;
``` |
56,666,430 | hi m trying to download db data in excel format,,, but when I click on download then it says: Call to undefined method Maatwebsite\Excel\Excel::create()
code of controller:
```
function excel()
{
$pdf_data = DB::table('importpdfs')->get()->toArray();
$pdf_array[] = array('Battery', 'No_of_questions_attempted',... | 2019/06/19 | [
"https://Stackoverflow.com/questions/56666430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10896655/"
] | If you previously updated your `"maatwebsite/excel"` package to 3.\*. version, the method `Excel::create($yourExport)` is removed. Instead you should use `Excel::download/Excel::store($yourExport)`.
Example how it should be used with new version:
```
use App\Exports\UsersExport;
use Maatwebsite\Excel\Facades\Excel;
u... | You are probably not using the Facade and using the file directly, make sure you are using
```
use Maatwebsite\Excel\Facades\Excel;
```
and not
```
use Maatwebsite\Excel\Excel;
``` |
238,223 | I would like to create a view that uses aggregation on an entity to display the count and the sum by date. But it should be grouped by date only without time even the original date value has time values. I.e.
Entity:
processedTime | amount | value | ...
01/01/2017 08:00:00 | 10 | 1 | ...
01/01/2017 08:18:10 | 10 | 1 |... | 2017/06/11 | [
"https://drupal.stackexchange.com/questions/238223",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/76493/"
] | @kiamlaluno described the technical details. This is the background why the `DependencySerializationTrait` was introduced:
This was the situation before:
>
> * Any class that receives injected dependencies (whether by
> constructor injection or setter injection) typically keeps a reference
> to its dependencies in... | [`DependencySerializationTrait`](https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21DependencyInjection%21DependencySerializationTrait.php/trait/DependencySerializationTrait/8.9.x) is used from classes that are serialized and that have services in their properties. For those classes, the trait replaces the ... |
3,178,361 | Finding $$\int^{6}\_{0}x(x-1)(x-2)(x-3)(x-4)(x-6)dx$$
My progress so far
$$x(x-4)(x-6)(x-1)(x-2)(x-3)=\bigg(x^3-10x^2+24x\bigg)\bigg(x^3-6x^2+11x-6\bigg)$$
How can I find solution Help me | 2019/04/07 | [
"https://math.stackexchange.com/questions/3178361",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/661425/"
] | Well, you can certainly proceed as you are now, and continue expanding until you get the polynomial into standard form, then integrate. We could go about it in a bit of a different way, though.
Let $f(x)=x(x-1)(x-2)(x-3)(x-4)(x-6).$ Then we have $$\int\_0^6f(x)dx=\int\_0^3f(x)dx+\int\_3^6f(x)dx,$$ and making the subst... | Hint: Expanding the Integrand we get $$x^6-16 x^5+95 x^4-260 x^3+324 x^2-144 x$$ |
3,178,361 | Finding $$\int^{6}\_{0}x(x-1)(x-2)(x-3)(x-4)(x-6)dx$$
My progress so far
$$x(x-4)(x-6)(x-1)(x-2)(x-3)=\bigg(x^3-10x^2+24x\bigg)\bigg(x^3-6x^2+11x-6\bigg)$$
How can I find solution Help me | 2019/04/07 | [
"https://math.stackexchange.com/questions/3178361",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/661425/"
] | Well, you can certainly proceed as you are now, and continue expanding until you get the polynomial into standard form, then integrate. We could go about it in a bit of a different way, though.
Let $f(x)=x(x-1)(x-2)(x-3)(x-4)(x-6).$ Then we have $$\int\_0^6f(x)dx=\int\_0^3f(x)dx+\int\_3^6f(x)dx,$$ and making the subst... | If you just perform all the multiplication you get an integral of a sum of powers. The integral of a sum is the sum of the itegrals of each term, which will be of the formg $c\int \! \mathrm{d}x \; x^{\alpha} = c\;\frac{x^{\alpha+1}}{\alpha+1}$ |
1,748,908 | I am using sugarCRM at my localhost.
For no apparent reason firefox is viewing the page in Quirks mode (the login page). This is completely messing up the page, here is a sample of the data shown:
>
> ��������Z�n7�-}v�fd4��q�Z�·8�ڱa�-�
> f(�
> 5�rf��<�b���y�=��ftwRw�@"����m�<�2��^?}�
> -��Ӌ�s���w|�#��Wo����U��'��... | 2009/11/17 | [
"https://Stackoverflow.com/questions/1748908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8715/"
] | To get Firefox to render a page in standards-compliant mode, add a DOCTYPE to your HTML. For example, if you're using HTML (as opposed to XHTML), use:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/DTD/strict.dtd">
```
You might find this Wikipedia link helpful - [triggering differ... | Are you using PHP 5.3? It may be the reason.
What is your Sugar version? |
1,748,908 | I am using sugarCRM at my localhost.
For no apparent reason firefox is viewing the page in Quirks mode (the login page). This is completely messing up the page, here is a sample of the data shown:
>
> ��������Z�n7�-}v�fd4��q�Z�·8�ڱa�-�
> f(�
> 5�rf��<�b���y�=��ftwRw�@"����m�<�2��^?}�
> -��Ӌ�s���w|�#��Wo����U��'��... | 2009/11/17 | [
"https://Stackoverflow.com/questions/1748908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8715/"
] | Couldn't it be an encoding issue? E.g., your Apache sends
```
Content-Type: text/html; charset=Big5
```
but your HTML page is simply ASCII. Then you get gibberish as that. If you know your HTML encoding, try "View" -> "Character Encoding" in FF and switch back and forth a bit.
Alternatively, look at Apache's httpd.... | Are you using PHP 5.3? It may be the reason.
What is your Sugar version? |
1,748,908 | I am using sugarCRM at my localhost.
For no apparent reason firefox is viewing the page in Quirks mode (the login page). This is completely messing up the page, here is a sample of the data shown:
>
> ��������Z�n7�-}v�fd4��q�Z�·8�ڱa�-�
> f(�
> 5�rf��<�b���y�=��ftwRw�@"����m�<�2��^?}�
> -��Ӌ�s���w|�#��Wo����U��'��... | 2009/11/17 | [
"https://Stackoverflow.com/questions/1748908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8715/"
] | The screwed up data you posted suggests that the character encoding your document uses and the character encoding that Firefox thinks it uses does not match.
1. Pick a character encoding
2. Make sure you use it in your document
3. Make sure your Content-Type header specifies that encoding
<http://www.w3.org/Internati... | Are you using PHP 5.3? It may be the reason.
What is your Sugar version? |
2,030,910 | I am sending a status code via the header function, such as `header('HTTP/1.1 403');`, and would like to in another area of my code detect what status code is to be sent (in particular if I have sent an error code of some nature). As has been mentioned [elsewhere](https://stackoverflow.com/questions/1798353/determine-t... | 2010/01/08 | [
"https://Stackoverflow.com/questions/2030910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/118153/"
] | Consider setting a constant:
```
define('HTTP_STATUS', 403);
```
and using the `defined` function later on:
```
if(defined('HTTP_STATUS') && HTTP_STATUS == 403) // ...or whatever you're looking to do
```
Actually peeking back at the headers themselves is kind of a hack in itself as it's simply too slow: you're de... | It's another call, but as a last resort you could use this rather than curl. If you have php 5.0, What about [get\_headers()](http://us.php.net/manual/en/function.get-headers.php)? |
2,030,910 | I am sending a status code via the header function, such as `header('HTTP/1.1 403');`, and would like to in another area of my code detect what status code is to be sent (in particular if I have sent an error code of some nature). As has been mentioned [elsewhere](https://stackoverflow.com/questions/1798353/determine-t... | 2010/01/08 | [
"https://Stackoverflow.com/questions/2030910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/118153/"
] | [`http_response_code()`](http://php.net/manual/en/function.http-response-code.php) in PHP 5.4 does this now. | It's another call, but as a last resort you could use this rather than curl. If you have php 5.0, What about [get\_headers()](http://us.php.net/manual/en/function.get-headers.php)? |
2,030,910 | I am sending a status code via the header function, such as `header('HTTP/1.1 403');`, and would like to in another area of my code detect what status code is to be sent (in particular if I have sent an error code of some nature). As has been mentioned [elsewhere](https://stackoverflow.com/questions/1798353/determine-t... | 2010/01/08 | [
"https://Stackoverflow.com/questions/2030910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/118153/"
] | Consider setting a constant:
```
define('HTTP_STATUS', 403);
```
and using the `defined` function later on:
```
if(defined('HTTP_STATUS') && HTTP_STATUS == 403) // ...or whatever you're looking to do
```
Actually peeking back at the headers themselves is kind of a hack in itself as it's simply too slow: you're de... | [`http_response_code()`](http://php.net/manual/en/function.http-response-code.php) in PHP 5.4 does this now. |
696,208 | learning QM and just have a few questions regarding normalizing wavefunctions.
1. Thus far, every initial wavefunction that we've normalized has had an undefined constant explicitly put out front (i.e., something like $\Psi (x,0) = A(a - x^{2})$, as an example) I was recently asked to normalize a wavefunction that did... | 2022/02/23 | [
"https://physics.stackexchange.com/questions/696208",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/152819/"
] | 1. Yes. Normalizing the wavefunction means multiplying it by whatever constant you need to in order to make its norm equal to $1$.
2. Yes, because time evolution in quantum mechanics is *unitary* - in other words, you can write $\psi(t) = \hat U(t) \psi(0)$ for a unitary operator $\hat U(t)$ called the *propagator*, an... | 1. yes
2. yes
3. the constant is determined up to an arbitrary phase. Remember that this is also the case for the wave function. |
696,208 | learning QM and just have a few questions regarding normalizing wavefunctions.
1. Thus far, every initial wavefunction that we've normalized has had an undefined constant explicitly put out front (i.e., something like $\Psi (x,0) = A(a - x^{2})$, as an example) I was recently asked to normalize a wavefunction that did... | 2022/02/23 | [
"https://physics.stackexchange.com/questions/696208",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/152819/"
] | 1. yes
2. yes
3. the constant is determined up to an arbitrary phase. Remember that this is also the case for the wave function. | Since people had already answered correctly questions 1 and 2, I'd like to answer/point some details as for 3 and 4:
3. It is a postulate in quantum mechanics that the states of a (quantum) dynamical system are in one-to-one correspondence with some complex projective Hilbert space, then yes, the sign of your normaliz... |
696,208 | learning QM and just have a few questions regarding normalizing wavefunctions.
1. Thus far, every initial wavefunction that we've normalized has had an undefined constant explicitly put out front (i.e., something like $\Psi (x,0) = A(a - x^{2})$, as an example) I was recently asked to normalize a wavefunction that did... | 2022/02/23 | [
"https://physics.stackexchange.com/questions/696208",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/152819/"
] | 1. Yes. Normalizing the wavefunction means multiplying it by whatever constant you need to in order to make its norm equal to $1$.
2. Yes, because time evolution in quantum mechanics is *unitary* - in other words, you can write $\psi(t) = \hat U(t) \psi(0)$ for a unitary operator $\hat U(t)$ called the *propagator*, an... | Since people had already answered correctly questions 1 and 2, I'd like to answer/point some details as for 3 and 4:
3. It is a postulate in quantum mechanics that the states of a (quantum) dynamical system are in one-to-one correspondence with some complex projective Hilbert space, then yes, the sign of your normaliz... |
16,049,330 | I am attempting to store css files inside database and call them in the most effective wa using PHP. I know I can include a style.php file and just do a query to get the data; however, not sure if that is the best way or not. I'd prefer to not have
```
<style>
#blah { }
#blah 2 { }
etc.
</style>
```
show up on ever... | 2013/04/17 | [
"https://Stackoverflow.com/questions/16049330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2200549/"
] | I'd probably write a tiny wrapper class for each:
```
template <class T>
class read_only {
T volatile *addr;
public:
read_only(int address) : addr((T *)address) {}
operator T() volatile const { return *addr; }
};
template <class T>
class write_only {
T volatile *addr;
public:
write_only(int addre... | I would use a combination of structs to rappresent the register and a pair of functions to handle them.
In a `fpga_register.h` you would have something like
```
#define FPGA_READ = 1;
#define FPGA_WRITE = 2;
typedef struct register_t {
char permissions;
} FPGARegister;
FPGARegister* fpga_init(void* address, cha... |
16,049,330 | I am attempting to store css files inside database and call them in the most effective wa using PHP. I know I can include a style.php file and just do a query to get the data; however, not sure if that is the best way or not. I'd prefer to not have
```
<style>
#blah { }
#blah 2 { }
etc.
</style>
```
show up on ever... | 2013/04/17 | [
"https://Stackoverflow.com/questions/16049330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2200549/"
] | I'd probably write a tiny wrapper class for each:
```
template <class T>
class read_only {
T volatile *addr;
public:
read_only(int address) : addr((T *)address) {}
operator T() volatile const { return *addr; }
};
template <class T>
class write_only {
T volatile *addr;
public:
write_only(int addre... | I've worked with a lot of hardware, and some of which has "read only" or "write only" registers (or different functions depending on whether you read or write to the register, which makes for fun when someone decides to do "reg |= 4;" instead of remembering the value it should have, set bit 2 and write the new value, l... |
16,049,330 | I am attempting to store css files inside database and call them in the most effective wa using PHP. I know I can include a style.php file and just do a query to get the data; however, not sure if that is the best way or not. I'd prefer to not have
```
<style>
#blah { }
#blah 2 { }
etc.
</style>
```
show up on ever... | 2013/04/17 | [
"https://Stackoverflow.com/questions/16049330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2200549/"
] | I'd probably write a tiny wrapper class for each:
```
template <class T>
class read_only {
T volatile *addr;
public:
read_only(int address) : addr((T *)address) {}
operator T() volatile const { return *addr; }
};
template <class T>
class write_only {
T volatile *addr;
public:
write_only(int addre... | I see no elegant way of doing it in C. I do however see a way of doing it:
```
#define DEREF_PTR(type, ptr) type ptr; \
typedef char ptr ## _DEREF_PTR;
#define NO_DEREF_PTR(type, ptr) type ptr; \
#define DEREFERENCE(ptr) \
*ptr; \
{ptr ## _DEREF_PTR \
attempt_to_dereference_pointer_ ## ptr;}
int main(int argc, char... |
16,049,330 | I am attempting to store css files inside database and call them in the most effective wa using PHP. I know I can include a style.php file and just do a query to get the data; however, not sure if that is the best way or not. I'd prefer to not have
```
<style>
#blah { }
#blah 2 { }
etc.
</style>
```
show up on ever... | 2013/04/17 | [
"https://Stackoverflow.com/questions/16049330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2200549/"
] | I'd probably write a tiny wrapper class for each:
```
template <class T>
class read_only {
T volatile *addr;
public:
read_only(int address) : addr((T *)address) {}
operator T() volatile const { return *addr; }
};
template <class T>
class write_only {
T volatile *addr;
public:
write_only(int addre... | In C, you can use pointers to incomplete types to prevent all dereferencing:
---
```
/* writeonly.h */
typedef struct writeonly *wo_ptr_t;
```
---
```
/* writeonly.c */
#include "writeonly.h"
struct writeonly {
int value
};
/*...*/
FOO_REGISTER->value = 42;
```
---
```
/* someother.c */
#include "writ... |
16,049,330 | I am attempting to store css files inside database and call them in the most effective wa using PHP. I know I can include a style.php file and just do a query to get the data; however, not sure if that is the best way or not. I'd prefer to not have
```
<style>
#blah { }
#blah 2 { }
etc.
</style>
```
show up on ever... | 2013/04/17 | [
"https://Stackoverflow.com/questions/16049330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2200549/"
] | I'd probably write a tiny wrapper class for each:
```
template <class T>
class read_only {
T volatile *addr;
public:
read_only(int address) : addr((T *)address) {}
operator T() volatile const { return *addr; }
};
template <class T>
class write_only {
T volatile *addr;
public:
write_only(int addre... | Dan Saks has a Youtube presentation, that I couldn't, find where he introduces write-only registers for embedded devices.
Fortunately he wrote an article, that was easier to search, here: <https://www.embedded.com/how-to-enforce-write-only-access/>
This is the code from the article, updated for C++11
```
class write... |
16,049,330 | I am attempting to store css files inside database and call them in the most effective wa using PHP. I know I can include a style.php file and just do a query to get the data; however, not sure if that is the best way or not. I'd prefer to not have
```
<style>
#blah { }
#blah 2 { }
etc.
</style>
```
show up on ever... | 2013/04/17 | [
"https://Stackoverflow.com/questions/16049330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2200549/"
] | I would use a combination of structs to rappresent the register and a pair of functions to handle them.
In a `fpga_register.h` you would have something like
```
#define FPGA_READ = 1;
#define FPGA_WRITE = 2;
typedef struct register_t {
char permissions;
} FPGARegister;
FPGARegister* fpga_init(void* address, cha... | Dan Saks has a Youtube presentation, that I couldn't, find where he introduces write-only registers for embedded devices.
Fortunately he wrote an article, that was easier to search, here: <https://www.embedded.com/how-to-enforce-write-only-access/>
This is the code from the article, updated for C++11
```
class write... |
16,049,330 | I am attempting to store css files inside database and call them in the most effective wa using PHP. I know I can include a style.php file and just do a query to get the data; however, not sure if that is the best way or not. I'd prefer to not have
```
<style>
#blah { }
#blah 2 { }
etc.
</style>
```
show up on ever... | 2013/04/17 | [
"https://Stackoverflow.com/questions/16049330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2200549/"
] | I've worked with a lot of hardware, and some of which has "read only" or "write only" registers (or different functions depending on whether you read or write to the register, which makes for fun when someone decides to do "reg |= 4;" instead of remembering the value it should have, set bit 2 and write the new value, l... | Dan Saks has a Youtube presentation, that I couldn't, find where he introduces write-only registers for embedded devices.
Fortunately he wrote an article, that was easier to search, here: <https://www.embedded.com/how-to-enforce-write-only-access/>
This is the code from the article, updated for C++11
```
class write... |
16,049,330 | I am attempting to store css files inside database and call them in the most effective wa using PHP. I know I can include a style.php file and just do a query to get the data; however, not sure if that is the best way or not. I'd prefer to not have
```
<style>
#blah { }
#blah 2 { }
etc.
</style>
```
show up on ever... | 2013/04/17 | [
"https://Stackoverflow.com/questions/16049330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2200549/"
] | I see no elegant way of doing it in C. I do however see a way of doing it:
```
#define DEREF_PTR(type, ptr) type ptr; \
typedef char ptr ## _DEREF_PTR;
#define NO_DEREF_PTR(type, ptr) type ptr; \
#define DEREFERENCE(ptr) \
*ptr; \
{ptr ## _DEREF_PTR \
attempt_to_dereference_pointer_ ## ptr;}
int main(int argc, char... | Dan Saks has a Youtube presentation, that I couldn't, find where he introduces write-only registers for embedded devices.
Fortunately he wrote an article, that was easier to search, here: <https://www.embedded.com/how-to-enforce-write-only-access/>
This is the code from the article, updated for C++11
```
class write... |
16,049,330 | I am attempting to store css files inside database and call them in the most effective wa using PHP. I know I can include a style.php file and just do a query to get the data; however, not sure if that is the best way or not. I'd prefer to not have
```
<style>
#blah { }
#blah 2 { }
etc.
</style>
```
show up on ever... | 2013/04/17 | [
"https://Stackoverflow.com/questions/16049330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2200549/"
] | In C, you can use pointers to incomplete types to prevent all dereferencing:
---
```
/* writeonly.h */
typedef struct writeonly *wo_ptr_t;
```
---
```
/* writeonly.c */
#include "writeonly.h"
struct writeonly {
int value
};
/*...*/
FOO_REGISTER->value = 42;
```
---
```
/* someother.c */
#include "writ... | Dan Saks has a Youtube presentation, that I couldn't, find where he introduces write-only registers for embedded devices.
Fortunately he wrote an article, that was easier to search, here: <https://www.embedded.com/how-to-enforce-write-only-access/>
This is the code from the article, updated for C++11
```
class write... |
17,316,183 | I want to start and stop service when device in action call, so i use TelephonyManager and my class extends flagment. i Tried this code
```
TelephonyManager tm = (TelephonyManager)getActivity().getSystemService(Context.TELEPHONY_SERVICE);
tm.listen(mPhoneListener, PhoneStateListener.LISTEN_CALL_STATE);
p... | 2013/06/26 | [
"https://Stackoverflow.com/questions/17316183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2503313/"
] | Try this code:
```
telephonyManager = ( TelephonyManager )getActivity.getSystemService( Context.TELEPHONY_SERVICE );
imeistring = telephonyManager.getDeviceId();
``` | use Telephony manager inside your oncreate view |
693,174 | I know its possible to integrate jQuery within Firefox addons, but are we able to manipulate (animate, move, adjust transparency, etc) XUL elements themselves?
From what I understand, the Firefox addon can use jQuery to manipulate HTML/DOM elements, but not sure about XUL elements. | 2009/03/28 | [
"https://Stackoverflow.com/questions/693174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84047/"
] | I was wondering this myself recently. Obviously the DHTML doesn't make sense, but the basic syntactic sugar and things are rumored to work.
* There is this [jQuery on XUL](http://groups.google.com/group/jquery-dev/browse_thread/thread/4545040bf26c6eea?pli=1) discussion from the jQuery group which indicates that it loa... | The answer right now is "mostly".
Basic stuff works, including selecting, deleting and finding. I use 1.5.2 pretty heavily both inside an extension and on content pages from the extension.
$.ready() also doesn't work because jQuery assumes and waits for a body. This is the [commit](https://github.com/jquery/jquery/co... |
693,174 | I know its possible to integrate jQuery within Firefox addons, but are we able to manipulate (animate, move, adjust transparency, etc) XUL elements themselves?
From what I understand, the Firefox addon can use jQuery to manipulate HTML/DOM elements, but not sure about XUL elements. | 2009/03/28 | [
"https://Stackoverflow.com/questions/693174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84047/"
] | ***Short answer:*** Yes
***Long Answer:***
I experimented with it myself. I could only use it in a limited way. Manipulation of XUL elements is possible. But I am having a hard time observing events, since I am pretty new to jQuery - I don't know how to tweak it to observe events at Firefox/XUL level - I don't even k... | The answer right now is "mostly".
Basic stuff works, including selecting, deleting and finding. I use 1.5.2 pretty heavily both inside an extension and on content pages from the extension.
$.ready() also doesn't work because jQuery assumes and waits for a body. This is the [commit](https://github.com/jquery/jquery/co... |
693,174 | I know its possible to integrate jQuery within Firefox addons, but are we able to manipulate (animate, move, adjust transparency, etc) XUL elements themselves?
From what I understand, the Firefox addon can use jQuery to manipulate HTML/DOM elements, but not sure about XUL elements. | 2009/03/28 | [
"https://Stackoverflow.com/questions/693174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84047/"
] | I was wondering this myself recently. Obviously the DHTML doesn't make sense, but the basic syntactic sugar and things are rumored to work.
* There is this [jQuery on XUL](http://groups.google.com/group/jquery-dev/browse_thread/thread/4545040bf26c6eea?pli=1) discussion from the jQuery group which indicates that it loa... | Unfortunately, jQuery fails to initialize in XUL because of the HTML-specific functions like `document.body` that exist for HTML pages only. However there is a special branch called [jQuery-xul](https://github.com/ilyakharlamov/jquery-xul) that it optimized for use in FireFox extensions. I have checked, it works fine. |
693,174 | I know its possible to integrate jQuery within Firefox addons, but are we able to manipulate (animate, move, adjust transparency, etc) XUL elements themselves?
From what I understand, the Firefox addon can use jQuery to manipulate HTML/DOM elements, but not sure about XUL elements. | 2009/03/28 | [
"https://Stackoverflow.com/questions/693174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84047/"
] | XUL and HTML actually deal with opacity the exact same way, and it is jQuery that incorrectly detects what the browser can do. jQuery thinks it's in a different browser when it's living inside XUL, and so opacity effects are handled differently - by jQuery. Since it IS in Firefox, and it should deal with opacity normal... | The answer right now is "mostly".
Basic stuff works, including selecting, deleting and finding. I use 1.5.2 pretty heavily both inside an extension and on content pages from the extension.
$.ready() also doesn't work because jQuery assumes and waits for a body. This is the [commit](https://github.com/jquery/jquery/co... |
693,174 | I know its possible to integrate jQuery within Firefox addons, but are we able to manipulate (animate, move, adjust transparency, etc) XUL elements themselves?
From what I understand, the Firefox addon can use jQuery to manipulate HTML/DOM elements, but not sure about XUL elements. | 2009/03/28 | [
"https://Stackoverflow.com/questions/693174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84047/"
] | The answer right now is "mostly".
Basic stuff works, including selecting, deleting and finding. I use 1.5.2 pretty heavily both inside an extension and on content pages from the extension.
$.ready() also doesn't work because jQuery assumes and waits for a body. This is the [commit](https://github.com/jquery/jquery/co... | Unfortunately, jQuery fails to initialize in XUL because of the HTML-specific functions like `document.body` that exist for HTML pages only. However there is a special branch called [jQuery-xul](https://github.com/ilyakharlamov/jquery-xul) that it optimized for use in FireFox extensions. I have checked, it works fine. |
693,174 | I know its possible to integrate jQuery within Firefox addons, but are we able to manipulate (animate, move, adjust transparency, etc) XUL elements themselves?
From what I understand, the Firefox addon can use jQuery to manipulate HTML/DOM elements, but not sure about XUL elements. | 2009/03/28 | [
"https://Stackoverflow.com/questions/693174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84047/"
] | My explanation refers to jQuery 1.7.1.
My goal was to perform a fade animation within the XUL context, but errors were being thrown because jQuery wrongly assumes it is dealing with IE if jQuery.support.opacity is falsy.
The logic that populates the **support** Object was prematurely returning an empty Object due to ... | Unfortunately, jQuery fails to initialize in XUL because of the HTML-specific functions like `document.body` that exist for HTML pages only. However there is a special branch called [jQuery-xul](https://github.com/ilyakharlamov/jquery-xul) that it optimized for use in FireFox extensions. I have checked, it works fine. |
693,174 | I know its possible to integrate jQuery within Firefox addons, but are we able to manipulate (animate, move, adjust transparency, etc) XUL elements themselves?
From what I understand, the Firefox addon can use jQuery to manipulate HTML/DOM elements, but not sure about XUL elements. | 2009/03/28 | [
"https://Stackoverflow.com/questions/693174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84047/"
] | I was wondering this myself recently. Obviously the DHTML doesn't make sense, but the basic syntactic sugar and things are rumored to work.
* There is this [jQuery on XUL](http://groups.google.com/group/jquery-dev/browse_thread/thread/4545040bf26c6eea?pli=1) discussion from the jQuery group which indicates that it loa... | My explanation refers to jQuery 1.7.1.
My goal was to perform a fade animation within the XUL context, but errors were being thrown because jQuery wrongly assumes it is dealing with IE if jQuery.support.opacity is falsy.
The logic that populates the **support** Object was prematurely returning an empty Object due to ... |
693,174 | I know its possible to integrate jQuery within Firefox addons, but are we able to manipulate (animate, move, adjust transparency, etc) XUL elements themselves?
From what I understand, the Firefox addon can use jQuery to manipulate HTML/DOM elements, but not sure about XUL elements. | 2009/03/28 | [
"https://Stackoverflow.com/questions/693174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84047/"
] | ***Short answer:*** Yes
***Long Answer:***
I experimented with it myself. I could only use it in a limited way. Manipulation of XUL elements is possible. But I am having a hard time observing events, since I am pretty new to jQuery - I don't know how to tweak it to observe events at Firefox/XUL level - I don't even k... | Unfortunately, jQuery fails to initialize in XUL because of the HTML-specific functions like `document.body` that exist for HTML pages only. However there is a special branch called [jQuery-xul](https://github.com/ilyakharlamov/jquery-xul) that it optimized for use in FireFox extensions. I have checked, it works fine. |
693,174 | I know its possible to integrate jQuery within Firefox addons, but are we able to manipulate (animate, move, adjust transparency, etc) XUL elements themselves?
From what I understand, the Firefox addon can use jQuery to manipulate HTML/DOM elements, but not sure about XUL elements. | 2009/03/28 | [
"https://Stackoverflow.com/questions/693174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84047/"
] | ***Short answer:*** Yes
***Long Answer:***
I experimented with it myself. I could only use it in a limited way. Manipulation of XUL elements is possible. But I am having a hard time observing events, since I am pretty new to jQuery - I don't know how to tweak it to observe events at Firefox/XUL level - I don't even k... | My explanation refers to jQuery 1.7.1.
My goal was to perform a fade animation within the XUL context, but errors were being thrown because jQuery wrongly assumes it is dealing with IE if jQuery.support.opacity is falsy.
The logic that populates the **support** Object was prematurely returning an empty Object due to ... |
693,174 | I know its possible to integrate jQuery within Firefox addons, but are we able to manipulate (animate, move, adjust transparency, etc) XUL elements themselves?
From what I understand, the Firefox addon can use jQuery to manipulate HTML/DOM elements, but not sure about XUL elements. | 2009/03/28 | [
"https://Stackoverflow.com/questions/693174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84047/"
] | XUL and HTML actually deal with opacity the exact same way, and it is jQuery that incorrectly detects what the browser can do. jQuery thinks it's in a different browser when it's living inside XUL, and so opacity effects are handled differently - by jQuery. Since it IS in Firefox, and it should deal with opacity normal... | Unfortunately, jQuery fails to initialize in XUL because of the HTML-specific functions like `document.body` that exist for HTML pages only. However there is a special branch called [jQuery-xul](https://github.com/ilyakharlamov/jquery-xul) that it optimized for use in FireFox extensions. I have checked, it works fine. |
59,534,983 | I have the following code (full example):
```
import React, { useState, useEffect } from 'react';
import { SafeAreaView, View, Button, StyleSheet, Animated } from 'react-native';
import { PanGestureHandler, State } from 'react-native-gesture-handler';
const App = () => {
const [blocks, setBlocks] = useState([]);
... | 2019/12/30 | [
"https://Stackoverflow.com/questions/59534983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12496104/"
] | When you assign `blocks` to `array` the reference gete copied which mutates the state, so it doesn't re-render on `setState`.
```
const CreateBlockHandler = () => {
let array = [...blocks];
array.push({
x: new Animated.Value(0),
y: new Animated.Value(0)
});
setBlocks(array);
RenderBloc... | There are multiple issues with your code.
As kooskoos pointed out, your state remains referentially equal (it's the same array, only the elements change). This will not trigger re-render.
Also, you are manipulating state of the `App` component. `RenderBlocks` component's props and state remain unchanged which implies... |
61,118,659 | Tried extracting the href from:
```
<a lang="en" class="new class" href="/abc/stack.com"
tabindex="-1" data-type="itemTitles"><span><mark>Scott</mark>, CC042<br></span></a>
```
using `elems = driver.find_elements_by_css_selector(".new class [href]")` , but doesn't seem to work.
Also tried [Python Selenium - get hr... | 2020/04/09 | [
"https://Stackoverflow.com/questions/61118659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13016237/"
] | Use `.get_attribute('href')`.
`by_css_selector`:
```
elems = driver.find_elements_by_css_selector('.new.class')
for elem in elems:
print(elem.get_attribute('href'))
```
Or `by_xpath`:
```
elems = driver.find_elements_by_xpath('//a[@class="new class"]')
``` | Just change it to
```
elems = driver.find_elements_by_css_selector(".new.class[href]")
```
OR
```
elems = driver.find_elements_by_css_selector("[class='new class'][href]")
``` |
431,878 | I have files with naming convention of this pattern:
```
bond_7.LEU.CA.1.dat
bond_7.LEU.CA.2.dat
bond_7.LEU.CA.3.dat
bond_12.ALA.CB.1.dat
bond_12.ALA.CB.2.dat
bond_12.ALA.CB.3.dat
...
```
I want to concatenate all files of the same group into a single one. For example:
```
cat bond_7.LEU.CA.*.dat > ../bondvalues/bo... | 2012/06/02 | [
"https://superuser.com/questions/431878",
"https://superuser.com",
"https://superuser.com/users/137717/"
] | Assuming that the example you provide reflects all of your files the following should do the trick:
```
for f in *.1.dat
do
cat ${f%%1.dat}* > ${f%%1.dat}1_3.dat
done
```
This requires that each group contains a file with the .1.dat extension. | ```
printf "%s\n" * | cut -d. -f1-3 | sort -u | while read prefix; do
files=(${prefix}*)
first=$(cut -d. -f4 <<< "${files[0]}")
last=$(cut -d. -f4 <<< "${files[${#files[@]}-1]}")
newfile=$(printf "../bondvalues/%s.%s_%s.dat" "$prefix" "$first" "$last")
cat "${files[@]}" > "$newfile"
done
``` |
7,640,177 | I'm defining a javascript object and setting its properties and methods like this:
```
function MyObject()
{
this.prop1 = 1;
this.prop2 = 2;
this.meth1=meth1;
}
function meth1()
{
// do soemthing
}
```
All is fine. My question is how can i have an object be a property of MyObject? I actually want an 'asso... | 2011/10/03 | [
"https://Stackoverflow.com/questions/7640177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/550116/"
] | Do you mean:
```
function MyObject() {
this.obj = {'x': 'val1', 'y': 'val2'};
this.prop1 = 1;
this.prop2 = 2;
this.meth1=meth1;
}
```
?
Now you can say:
```
new MyObject().obj.x //`val1`
```
Alternative syntax:
```
this.obj = {};
this.obj.x = 'val1';
this.obj.y = 'val2';
``` | It's often easiest to use the object literal notation:
```
function MyObject()
{
// obj as an object literal
this.obj = {
x: "val1",
y: "val2",
z: "val3"
};
this.prop1 = 1;
this.prop2 = 2;
this.meth1=meth1;
}
``` |
41,764,618 | ```
$("selector").data("name", null);
console.log($("selector").data("name"));
```
This prints `undefined`.
Is there anyway to instantiate a `null` item in the jQuery data object of an element, not an undefined one? | 2017/01/20 | [
"https://Stackoverflow.com/questions/41764618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3380611/"
] | Yes and Your code works fine, You should check if your `$("selector")` exists | Your code works well as @Sebastian Krysiak stated, check if the selector exists. See working snippet below:
```js
console.log("before: " + $(".selector").data("name"));
$(".selector").data("name", null);
console.log("after: " + $(".selector").data("name"));
```
```html
<script src="https://ajax.googleapis.com/ajax/... |
41,764,618 | ```
$("selector").data("name", null);
console.log($("selector").data("name"));
```
This prints `undefined`.
Is there anyway to instantiate a `null` item in the jQuery data object of an element, not an undefined one? | 2017/01/20 | [
"https://Stackoverflow.com/questions/41764618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3380611/"
] | Yes and Your code works fine, You should check if your `$("selector")` exists | ```
$("#selector").data("name", null);
console.log($("#selector").data("name"));
```
Works just fine as is, your selector might not exist.
Here's a fiddle <https://jsfiddle.net/eo32jjay/> |
41,764,618 | ```
$("selector").data("name", null);
console.log($("selector").data("name"));
```
This prints `undefined`.
Is there anyway to instantiate a `null` item in the jQuery data object of an element, not an undefined one? | 2017/01/20 | [
"https://Stackoverflow.com/questions/41764618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3380611/"
] | Yes and Your code works fine, You should check if your `$("selector")` exists | What about this?
```js
$(document).ready(function() {
var aVariableValue = null;
$("#myDiv").data("name", aVariableValue);
console.log($("#myDiv").data("name"));
});
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div id="myDiv"></div>
``` |
41,764,618 | ```
$("selector").data("name", null);
console.log($("selector").data("name"));
```
This prints `undefined`.
Is there anyway to instantiate a `null` item in the jQuery data object of an element, not an undefined one? | 2017/01/20 | [
"https://Stackoverflow.com/questions/41764618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3380611/"
] | Yes and Your code works fine, You should check if your `$("selector")` exists | It looks like your method should work, tho the element you are selecting must exists.
Look at [this fiddle](https://jsfiddle.net/hsukrk9b/) to see it in action.
```
// Before
alert($('#elem').data('foo'));
$('#elem').data('foo', null);
// After
alert($('#elem').data('foo'));
``` |
5,019,360 | I have made a webapp for my android phone where I can check the sales at my store when I'm not there.
I would like to have notifications on my phone whenever a sale is made.
What is the best way of doing this? Any existing android apps that I can configure to check a php-script every 2 minutes or something? | 2011/02/16 | [
"https://Stackoverflow.com/questions/5019360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/348776/"
] | Try using XMPP to send a message to yourself, which you can receive via gtalk on the phone. Alternatively, an email, SMS, etc. | Could you rig up an RSS feed and use a feed reader to notify you? |
5,507,754 | I have an html form that sends data to .cgi page. Here is the html:
```
<HTML>
<BODY BGCOLOR="#FFFFFF">
<FORM METHOD="post" ACTION="test.cgi">
<B>Write to me below:</B><P>
<TEXTAREA NAME="feedback" ROWS=10 COLS=50></TEXTAREA><P>
<CENTER>
<INPUT TYPE=submit VALUE="SEND">
... | 2011/03/31 | [
"https://Stackoverflow.com/questions/5507754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/686620/"
] | That [CGI](http://search.cpan.org/perldoc?CGI) style could be improved while fixing your encoding decoding issue. Try this–
```
use strict;
use warnings;
use Encode;
use CGI ":standard";
use HTML::Entities;
print
header("text/html; charset=utf-8"),
start_html("Thank you!"),
h1("Thank You!"),
h3("Your ... | What version of Perl are you using? This works for me with v5.10.1 on i686-cygwin-thread-multi-64int:
```
perl -E 'use utf8; use encoding("utf8"); $_="中文"; say; s/(\w)/$1 /g; say'
```
Output:
>
> 中文
>
> 中 文
>
>
>
I'm sure you've read [perlunicode](http://perldoc.perl.org/perlunicode.html)? |
5,507,754 | I have an html form that sends data to .cgi page. Here is the html:
```
<HTML>
<BODY BGCOLOR="#FFFFFF">
<FORM METHOD="post" ACTION="test.cgi">
<B>Write to me below:</B><P>
<TEXTAREA NAME="feedback" ROWS=10 COLS=50></TEXTAREA><P>
<CENTER>
<INPUT TYPE=submit VALUE="SEND">
... | 2011/03/31 | [
"https://Stackoverflow.com/questions/5507754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/686620/"
] | That [CGI](http://search.cpan.org/perldoc?CGI) style could be improved while fixing your encoding decoding issue. Try this–
```
use strict;
use warnings;
use Encode;
use CGI ":standard";
use HTML::Entities;
print
header("text/html; charset=utf-8"),
start_html("Thank you!"),
h1("Thank You!"),
h3("Your ... | If you look at the source for the thank you page, the content is:
```
中文<br>
&# 2 0 0 1 3;&# 2 5 9 9 1;
```
So it seems like `$FORM{'feedback'}` is arriving as HTML entities rather than as UTF-8. You probably need to convert those entities to real UTF-8 characters before working on the data, I'm not su... |
31,946,407 | I have a C# application using Oracle database and Entity Framework 5. Oracle client is version 12c R1. My application uses database first approach. I'm trying to run the app using Visual Studio Enterprise 2015. When I access the edmx file and I try to update the model from the database, it gives me the following error:... | 2015/08/11 | [
"https://Stackoverflow.com/questions/31946407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4791851/"
] | I believe it is because not yet out ODT version compatible with Visual Studio 2015. Wait or will have no choice for now?
[Oracle Developer Tools](http://www.oracle.com/technetwork/developer-tools/visual-studio/overview/index.html) | I installed the Oracle Developer Tools for 2015 but still could not get this to work. When I would attempt to do an Update Model from Database with Entity Framework, I encountered this error below.
[](https://i.stack.imgur.com/tKQM6.jpg)
So I did as ... |
440,571 | I'm trying to build some unit tests for testing my Rails helpers, but I can never remember how to access them. Annoying. Suggestions? | 2009/01/13 | [
"https://Stackoverflow.com/questions/440571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322/"
] | You can do the same in RSpec as:
```
require File.dirname(__FILE__) + '/../spec_helper'
describe FoosHelper do
it "should do something" do
helper.some_helper_method.should == @something
end
end
``` | Stolen from here: <http://joakimandersson.se/archives/2006/10/05/test-your-rails-helpers/>
```
require File.dirname(__FILE__) + ‘/../test_helper’
require ‘user_helper’
class UserHelperTest < Test::Unit::TestCase
include UserHelper
def test_a_user_helper_method_here
end
end
```
[Stolen from Matt Darby, who also w... |
440,571 | I'm trying to build some unit tests for testing my Rails helpers, but I can never remember how to access them. Annoying. Suggestions? | 2009/01/13 | [
"https://Stackoverflow.com/questions/440571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322/"
] | In rails 3 you can do this (and in fact it's what the generator creates):
```
require 'test_helper'
class YourHelperTest < ActionView::TestCase
test "should work" do
assert_equal "result", your_helper_method
end
end
```
And of course [the rspec variant by Matt Darby](https://stackoverflow.com/a/441298/11525... | Stolen from here: <http://joakimandersson.se/archives/2006/10/05/test-your-rails-helpers/>
```
require File.dirname(__FILE__) + ‘/../test_helper’
require ‘user_helper’
class UserHelperTest < Test::Unit::TestCase
include UserHelper
def test_a_user_helper_method_here
end
end
```
[Stolen from Matt Darby, who also w... |
440,571 | I'm trying to build some unit tests for testing my Rails helpers, but I can never remember how to access them. Annoying. Suggestions? | 2009/01/13 | [
"https://Stackoverflow.com/questions/440571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322/"
] | Stolen from here: <http://joakimandersson.se/archives/2006/10/05/test-your-rails-helpers/>
```
require File.dirname(__FILE__) + ‘/../test_helper’
require ‘user_helper’
class UserHelperTest < Test::Unit::TestCase
include UserHelper
def test_a_user_helper_method_here
end
end
```
[Stolen from Matt Darby, who also w... | This thread is kind of old, but I thought I'd reply with what I use:
```
# encoding: UTF-8
require 'spec_helper'
describe AuthHelper do
include AuthHelper # has methods #login and #logout that modify the session
describe "#login & #logout" do
it "logs in & out a user" do
user = User.new :username => ... |
440,571 | I'm trying to build some unit tests for testing my Rails helpers, but I can never remember how to access them. Annoying. Suggestions? | 2009/01/13 | [
"https://Stackoverflow.com/questions/440571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322/"
] | Stolen from here: <http://joakimandersson.se/archives/2006/10/05/test-your-rails-helpers/>
```
require File.dirname(__FILE__) + ‘/../test_helper’
require ‘user_helper’
class UserHelperTest < Test::Unit::TestCase
include UserHelper
def test_a_user_helper_method_here
end
end
```
[Stolen from Matt Darby, who also w... | I just posted this answer on another thread asking the same question. I did the following in my project.
```
require_relative '../../app/helpers/import_helper'
``` |
440,571 | I'm trying to build some unit tests for testing my Rails helpers, but I can never remember how to access them. Annoying. Suggestions? | 2009/01/13 | [
"https://Stackoverflow.com/questions/440571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322/"
] | In rails 3 you can do this (and in fact it's what the generator creates):
```
require 'test_helper'
class YourHelperTest < ActionView::TestCase
test "should work" do
assert_equal "result", your_helper_method
end
end
```
And of course [the rspec variant by Matt Darby](https://stackoverflow.com/a/441298/11525... | You can do the same in RSpec as:
```
require File.dirname(__FILE__) + '/../spec_helper'
describe FoosHelper do
it "should do something" do
helper.some_helper_method.should == @something
end
end
``` |
440,571 | I'm trying to build some unit tests for testing my Rails helpers, but I can never remember how to access them. Annoying. Suggestions? | 2009/01/13 | [
"https://Stackoverflow.com/questions/440571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322/"
] | You can do the same in RSpec as:
```
require File.dirname(__FILE__) + '/../spec_helper'
describe FoosHelper do
it "should do something" do
helper.some_helper_method.should == @something
end
end
``` | This thread is kind of old, but I thought I'd reply with what I use:
```
# encoding: UTF-8
require 'spec_helper'
describe AuthHelper do
include AuthHelper # has methods #login and #logout that modify the session
describe "#login & #logout" do
it "logs in & out a user" do
user = User.new :username => ... |
440,571 | I'm trying to build some unit tests for testing my Rails helpers, but I can never remember how to access them. Annoying. Suggestions? | 2009/01/13 | [
"https://Stackoverflow.com/questions/440571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322/"
] | You can do the same in RSpec as:
```
require File.dirname(__FILE__) + '/../spec_helper'
describe FoosHelper do
it "should do something" do
helper.some_helper_method.should == @something
end
end
``` | I just posted this answer on another thread asking the same question. I did the following in my project.
```
require_relative '../../app/helpers/import_helper'
``` |
440,571 | I'm trying to build some unit tests for testing my Rails helpers, but I can never remember how to access them. Annoying. Suggestions? | 2009/01/13 | [
"https://Stackoverflow.com/questions/440571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322/"
] | In rails 3 you can do this (and in fact it's what the generator creates):
```
require 'test_helper'
class YourHelperTest < ActionView::TestCase
test "should work" do
assert_equal "result", your_helper_method
end
end
```
And of course [the rspec variant by Matt Darby](https://stackoverflow.com/a/441298/11525... | This thread is kind of old, but I thought I'd reply with what I use:
```
# encoding: UTF-8
require 'spec_helper'
describe AuthHelper do
include AuthHelper # has methods #login and #logout that modify the session
describe "#login & #logout" do
it "logs in & out a user" do
user = User.new :username => ... |
440,571 | I'm trying to build some unit tests for testing my Rails helpers, but I can never remember how to access them. Annoying. Suggestions? | 2009/01/13 | [
"https://Stackoverflow.com/questions/440571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322/"
] | In rails 3 you can do this (and in fact it's what the generator creates):
```
require 'test_helper'
class YourHelperTest < ActionView::TestCase
test "should work" do
assert_equal "result", your_helper_method
end
end
```
And of course [the rspec variant by Matt Darby](https://stackoverflow.com/a/441298/11525... | I just posted this answer on another thread asking the same question. I did the following in my project.
```
require_relative '../../app/helpers/import_helper'
``` |
440,571 | I'm trying to build some unit tests for testing my Rails helpers, but I can never remember how to access them. Annoying. Suggestions? | 2009/01/13 | [
"https://Stackoverflow.com/questions/440571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322/"
] | This thread is kind of old, but I thought I'd reply with what I use:
```
# encoding: UTF-8
require 'spec_helper'
describe AuthHelper do
include AuthHelper # has methods #login and #logout that modify the session
describe "#login & #logout" do
it "logs in & out a user" do
user = User.new :username => ... | I just posted this answer on another thread asking the same question. I did the following in my project.
```
require_relative '../../app/helpers/import_helper'
``` |
221,498 | I’m building a Lightning component to edit html and need a robust WYSIWYG rich text editor (RTE) with “add link” feature and embed features. I really need the “add link” feature. When I search for RTE and Lightning I found and considered the following:
Trailblazer gives UI guidelines if you want to layout your own mar... | 2018/06/14 | [
"https://salesforce.stackexchange.com/questions/221498",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/2437/"
] | I figured it out: if your Salesforce Instance has access to Einstein Bots, there will be an **Einstein Bots Settings** section under the **Chat Buttons** section in **Setup**.
[](https://i.stack.imgur.com/Ijq2Z.png)
If you leave **Einstein Bots Config... | *[@Antonio\_Cucciniello](https://salesforce.stackexchange.com/users/65079/antonio-cucciniello)'s comment solved this for me, sharing as an answer to make this more noticable.*
---
If your bot has any **Apex actions**, make sure you don't have any errors. This will automatically try transferring you to an agent.
Insi... |
16,765,085 | How can I detect which UIButton has been tapped:
```
-(void) topScorer {
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
[button1 addTarget:self
action:@selector(buttonClicked:)
forControlEvents:UIControlEventTouchDown];
[button1 setTitle:@"Button1" forState:UIContro... | 2013/05/27 | [
"https://Stackoverflow.com/questions/16765085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019442/"
] | Cast your sender to a UIButton and compare the tag value.
```
UIButton *button = (UIButton *)sender;
if (button.tag == 1) {
} else {
}
``` | Store the button in a property on your view controller and then check against that property:
```
@property (nonatomic, weak) UIButton *buttonOne;
- (void)buttonTapped:(id)sender {
if (sender == buttonOne) {
// button one was tapped
}
}
```
or simply assign different selectors to each button.
```
[b... |
22,691,075 | This question is a part of my current problem, so let's start with the big picture.
I am trying to sort a dictionary by the values in descending order. My dictionary is 1-to-1 corresponding, such as:
>
> ('ID1':value1, 'ID2':value2, ......)
>
>
>
I followed [this thread](https://stackoverflow.com/questions/61318... | 2014/03/27 | [
"https://Stackoverflow.com/questions/22691075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2633803/"
] | You can do that using [list comprehension](http://www.secnetix.de/olli/Python/list_comprehensions.hawk) as follows:
```
>>> ids = [element[0] for element in sorted_dict]
>>> print ids
['ID1', 'ID2', 'ID3', ...]
```
This gets the first element of each `tuple` in the `sorted_dict` list of tuples | Using list comprehension:
```
[i for (i,_) in sorted_dict]
```
should solve your problem |
22,691,075 | This question is a part of my current problem, so let's start with the big picture.
I am trying to sort a dictionary by the values in descending order. My dictionary is 1-to-1 corresponding, such as:
>
> ('ID1':value1, 'ID2':value2, ......)
>
>
>
I followed [this thread](https://stackoverflow.com/questions/61318... | 2014/03/27 | [
"https://Stackoverflow.com/questions/22691075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2633803/"
] | You can do that using [list comprehension](http://www.secnetix.de/olli/Python/list_comprehensions.hawk) as follows:
```
>>> ids = [element[0] for element in sorted_dict]
>>> print ids
['ID1', 'ID2', 'ID3', ...]
```
This gets the first element of each `tuple` in the `sorted_dict` list of tuples | Use `map` plus `itemgetter` to process a list and get the first element
```
import operator
first_elements = map(operator.itemgetter(0), sorted_list)
``` |
22,691,075 | This question is a part of my current problem, so let's start with the big picture.
I am trying to sort a dictionary by the values in descending order. My dictionary is 1-to-1 corresponding, such as:
>
> ('ID1':value1, 'ID2':value2, ......)
>
>
>
I followed [this thread](https://stackoverflow.com/questions/61318... | 2014/03/27 | [
"https://Stackoverflow.com/questions/22691075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2633803/"
] | Using list comprehension:
```
[i for (i,_) in sorted_dict]
```
should solve your problem | Use `map` plus `itemgetter` to process a list and get the first element
```
import operator
first_elements = map(operator.itemgetter(0), sorted_list)
``` |
4,476,917 | >
> **Possible Duplicate:**
>
> [How many data a list can hold at the maximum](https://stackoverflow.com/questions/3767979/how-many-data-a-list-can-hold-at-the-maximum)
>
>
>
What is the maximum number of elements a list can hold? | 2010/12/18 | [
"https://Stackoverflow.com/questions/4476917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/489718/"
] | didnt get ya completely but to append a new tr to a specific tr you can use
```
$('#trUniqueId').append(
$('<tr/>').attr("id","newtrId")
);
``` | Try this
```
$(‘ tblDoc tr:last’).after(
"<tr><td style=’width:150px;’>value1</td><td style=’width: 150px’>value2</td><td style=’width: 150px’></td></tr>"
);
``` |
4,476,917 | >
> **Possible Duplicate:**
>
> [How many data a list can hold at the maximum](https://stackoverflow.com/questions/3767979/how-many-data-a-list-can-hold-at-the-maximum)
>
>
>
What is the maximum number of elements a list can hold? | 2010/12/18 | [
"https://Stackoverflow.com/questions/4476917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/489718/"
] | didnt get ya completely but to append a new tr to a specific tr you can use
```
$('#trUniqueId').append(
$('<tr/>').attr("id","newtrId")
);
``` | Alfred is correct, your question is very vague.
However, to add a new row (newID) after the existing row (uniqueID), use the following code:
$('#uniqueID').after('<tr id="newID">' + CELL CONTENT + '</tr>');
As for pulling in the information via Ajax, we'll need to see code samples. |
130,462 | I am doing some hands-on training with Kali linux and one of the exercise I came across was to make an exe file containing malicious payload(say to obtain reverse shell), send it to a victim and hope for the victim to download the exe file. If he/she downloads it, it is fairly easy after that.
Now this isn't tricky a... | 2016/07/19 | [
"https://security.stackexchange.com/questions/130462",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/110848/"
] | There are a number of ways that people attempt to mitigate these attacks.
**External**
* Prevent spam filter from allowing MIME types frequently associated with malware (it's highly unlikely there is a business relevant reason to send .exe or .bat files for instance)
* Use Anti-Virus as .exe's can be detected even a... | You'd be surprised how successful something like this can be - especially for a typical user who may not have any security controls in place. Also, I would argue that if you are able to convince a user to execute code you have provided, a malicious exploit is probably not even necessary - (i.e. "Microsoft Tech Support ... |
130,462 | I am doing some hands-on training with Kali linux and one of the exercise I came across was to make an exe file containing malicious payload(say to obtain reverse shell), send it to a victim and hope for the victim to download the exe file. If he/she downloads it, it is fairly easy after that.
Now this isn't tricky a... | 2016/07/19 | [
"https://security.stackexchange.com/questions/130462",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/110848/"
] | There are a number of ways that people attempt to mitigate these attacks.
**External**
* Prevent spam filter from allowing MIME types frequently associated with malware (it's highly unlikely there is a business relevant reason to send .exe or .bat files for instance)
* Use Anti-Virus as .exe's can be detected even a... | First and foremost you can adopt a firewall policy of "allow what's needed, block the rest". That will only go so far because your malicious outgoing link may take advantage of a hole you have poked in the firewall.
Enterprise grade products will "hook" certain functions like connect(). By hooking the function an anal... |
130,462 | I am doing some hands-on training with Kali linux and one of the exercise I came across was to make an exe file containing malicious payload(say to obtain reverse shell), send it to a victim and hope for the victim to download the exe file. If he/she downloads it, it is fairly easy after that.
Now this isn't tricky a... | 2016/07/19 | [
"https://security.stackexchange.com/questions/130462",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/110848/"
] | You'd be surprised how successful something like this can be - especially for a typical user who may not have any security controls in place. Also, I would argue that if you are able to convince a user to execute code you have provided, a malicious exploit is probably not even necessary - (i.e. "Microsoft Tech Support ... | First and foremost you can adopt a firewall policy of "allow what's needed, block the rest". That will only go so far because your malicious outgoing link may take advantage of a hole you have poked in the firewall.
Enterprise grade products will "hook" certain functions like connect(). By hooking the function an anal... |
65,852,340 | I have written a code for a drag and drop using vanilla javascript. When I pick the first div, it does move to last automatically while I was trying to move next.
I don't want to use the jquery library.
What I tried is I created the main div that acts as a container so that inside of that container each div can be mo... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65852340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133198/"
] | Add an event listener for the dragables on mouseover.
check if the dragable is already in your hand.
if not than append the Node of the dragable in your hand after the Node with mouseover
change the position of the dragged element to absolute and define its position x & y through top and left | I would recommend NOT using the drag events and instead use mouse events. I have had MUCH better luck and reliability with this and you get off screen dragging as well:
```
handleDragStart = () => {
// Once mouse down is detected, you THEN start up the window listeners
// You also append something to the body of y... |
65,852,340 | I have written a code for a drag and drop using vanilla javascript. When I pick the first div, it does move to last automatically while I was trying to move next.
I don't want to use the jquery library.
What I tried is I created the main div that acts as a container so that inside of that container each div can be mo... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65852340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133198/"
] | Add an event listener for the dragables on mouseover.
check if the dragable is already in your hand.
if not than append the Node of the dragable in your hand after the Node with mouseover
change the position of the dragged element to absolute and define its position x & y through top and left | If your issue here is to stop dragging and place the object you'r dragging into, I would define "areas" where you could drop your element, this areas depend on how many elements you have, in this case (4) you could have the same areas
1 area will be the same are that the dragging element has
3 areas are in between the... |
65,852,340 | I have written a code for a drag and drop using vanilla javascript. When I pick the first div, it does move to last automatically while I was trying to move next.
I don't want to use the jquery library.
What I tried is I created the main div that acts as a container so that inside of that container each div can be mo... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65852340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133198/"
] | Add an event listener for the dragables on mouseover.
check if the dragable is already in your hand.
if not than append the Node of the dragable in your hand after the Node with mouseover
change the position of the dragged element to absolute and define its position x & y through top and left | **If your list is limited to one row adding calculation for X-axis can fix the problem.**
Simply change e.clientY to **e.clientX**
```
const afterElement = getDragAfterElement(container, e.clientX)
```
Use left coordinates and the width rather than height and top
```
offset = x - box.left - box.width / 2;
``` |
23,860,150 | I have this little simple trigger..
```
BEGIN
DECLARE FILE_NAME VARCHAR(250);
DECLARE FILE_REFR VARCHAR(500);
SET FILE_NAME = 'Foo';
SET FILE_REFR = 'Bar';
--- I'd like to execute the next statement, using variable FILE_REFR between %% in a LIKE clause:
SELECT COUNT(*) INTO @num_rows FROM referers WHERE fil... | 2014/05/25 | [
"https://Stackoverflow.com/questions/23860150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1395287/"
] | Use the variable as:
```
CONCAT('%', FILE_REFR, '%');
```
So the complete select query is:
```
SELECT COUNT(*) INTO @num_rows FROM referers WHERE filename = FILE_NAME AND ref NOT LIKE CONCAT('%', FILE_REFR, '%');
```
Thanks | Is this what you want?
```
SELECT COUNT(*) INTO @num_rows
FROM referers
WHERE filename = FILE_NAME AND
ref NOT LIKE CONCAT('%', FILE_REFR, '%');
```
MySQL does not find variables inside string literals. Instead you have to use `CONCAT()` to piece the pattern together. |
9,500,907 | I just tested the TTS feature and I'm really disappointed. While the text is mostly recognizable the quality of the sound is horrible.
There is too much noise and it sounds as if there is a lot of clipping as well. I know that TTS can never be as good as a pre-recorded sound file, but I think I'd be satisfied if at le... | 2012/02/29 | [
"https://Stackoverflow.com/questions/9500907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1189831/"
] | You can do
```
myOption map { success } getOrElse handleTheError
```
or with `scalaz`,
```
myOption.cata(success, handleTheError)
```
where `success` is something like
```
def success(op: Whatever) = {
doSomethingWith(op)
Path(request.path) match {
case "work" => println("--Let's work--")
case "ho... | If the scrutinees (the expressions on which you match) do not depend on each other, i.e. you can compute them independently, you could perform both `match`es at the same time by wrapping the scrutinees in a tuple.
So your example:
```
x match {
case a => {
y match {
case c => fooC(...)
case d => fooD(...)... |
54,654,667 | I have numeric format of date `20001016083256` and I want to convert it into `datetime` format something like `yymmddhhmiss`.
Expected result is
```
2000-10-16 08:32:56
```
Is that possible in SQL Server?
Thanks a lot | 2019/02/12 | [
"https://Stackoverflow.com/questions/54654667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9501823/"
] | Because `iterations[-1]` will evaluate to `undefined` (which is slow as it has to go up the whole prototype chain and can't take a fast path) also doing math with `NaN` will always be slow as it is the non common case.
Also initializing `iterations` with numbers will make the whole test more useful.
Pro Tip: If you t... | To elaborate on Jonas Wilms' answer, Javascript does not work with negative indice (unlike languages like Python).
`iterations[-1]` is equal to `iteration["-1"]`, which look for the property named -1 in the array object. That's why `iterations[-1]` will evaluate to `undefined`. |
29,248,748 | I have two two-dimensional arrays,
```
a = [[17360, "Z51.89"],
[17361, "S93.601A"],
[17362, "H66.91"],
[17363, "H25.12"],
[17364, "Z01.01"],
[17365, "Z00.121"],
[17366, "Z00.129"],
[17367, "K57.90"],
[17368, "I63.9"]]
```
and
```
b = [[17360, "I87.2"],
[17361, "s93.601"],
[17362, "h66.91"],
[17363, "h25.... | 2015/03/25 | [
"https://Stackoverflow.com/questions/29248748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896986/"
] | It will convert second element of inner array to upcase for both array then you can perform subtraction, then It will return exact result that you want
```
a.map{|first,second| [first,second.upcase]} - b.map{|first,second| [first,second.upcase]}
``` | Using [Proc](http://ruby-doc.org/core-2.2.0/Proc.html) and '[&](http://ruby-doc.org/core-2.2.0/Array.html#method-i-26)':
```
procedure = Proc.new { |i, j| [i, j.upcase] }
(a.map(&procedure) & b.map(&procedure)).count
#=> 5
```
For better understanding, let's simplify it:
```
new_a = a.map {|i, j| [i, j.upcase]}
new... |
29,248,748 | I have two two-dimensional arrays,
```
a = [[17360, "Z51.89"],
[17361, "S93.601A"],
[17362, "H66.91"],
[17363, "H25.12"],
[17364, "Z01.01"],
[17365, "Z00.121"],
[17366, "Z00.129"],
[17367, "K57.90"],
[17368, "I63.9"]]
```
and
```
b = [[17360, "I87.2"],
[17361, "s93.601"],
[17362, "h66.91"],
[17363, "h25.... | 2015/03/25 | [
"https://Stackoverflow.com/questions/29248748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896986/"
] | You can convert Arrays to Hash, and use [Enumerable#count](http://ruby-doc.org/core-2.2.1/Enumerable.html#method-i-count) with a block.
```
b_hash = b.to_h
a.to_h.count {|k, v| b_hash[k] && b_hash[k].downcase == v.downcase }
# => 5
``` | I have assumed that the ith element of `a` is to be compared with the ith element of `b`. (Edit: a subsequent comment by the OP confirmed this interpretation.)
I would be inclined to use indices to avoid the construction of relatively large temporary arrays. Here are two ways that might be done.
**#1 Use indices**
`... |
29,248,748 | I have two two-dimensional arrays,
```
a = [[17360, "Z51.89"],
[17361, "S93.601A"],
[17362, "H66.91"],
[17363, "H25.12"],
[17364, "Z01.01"],
[17365, "Z00.121"],
[17366, "Z00.129"],
[17367, "K57.90"],
[17368, "I63.9"]]
```
and
```
b = [[17360, "I87.2"],
[17361, "s93.601"],
[17362, "h66.91"],
[17363, "h25.... | 2015/03/25 | [
"https://Stackoverflow.com/questions/29248748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896986/"
] | Instead of `a - b` you should do this:
```
a.map{|k,v| [k,v.downcase]} - b.map{|k,v| [k,v.downcase]} # case-insensitive
``` | It will convert second element of inner array to upcase for both array then you can perform subtraction, then It will return exact result that you want
```
a.map{|first,second| [first,second.upcase]} - b.map{|first,second| [first,second.upcase]}
``` |
29,248,748 | I have two two-dimensional arrays,
```
a = [[17360, "Z51.89"],
[17361, "S93.601A"],
[17362, "H66.91"],
[17363, "H25.12"],
[17364, "Z01.01"],
[17365, "Z00.121"],
[17366, "Z00.129"],
[17367, "K57.90"],
[17368, "I63.9"]]
```
and
```
b = [[17360, "I87.2"],
[17361, "s93.601"],
[17362, "h66.91"],
[17363, "h25.... | 2015/03/25 | [
"https://Stackoverflow.com/questions/29248748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896986/"
] | It will convert second element of inner array to upcase for both array then you can perform subtraction, then It will return exact result that you want
```
a.map{|first,second| [first,second.upcase]} - b.map{|first,second| [first,second.upcase]}
``` | ```
a.count - (a.map{|e| [e[0],e[1].downcase] } - b.map{|e| [e[0],e[1].downcase] }).count
```
The above maps `a` and `b` to new arrays where the second sub-array element is downcase. |
29,248,748 | I have two two-dimensional arrays,
```
a = [[17360, "Z51.89"],
[17361, "S93.601A"],
[17362, "H66.91"],
[17363, "H25.12"],
[17364, "Z01.01"],
[17365, "Z00.121"],
[17366, "Z00.129"],
[17367, "K57.90"],
[17368, "I63.9"]]
```
and
```
b = [[17360, "I87.2"],
[17361, "s93.601"],
[17362, "h66.91"],
[17363, "h25.... | 2015/03/25 | [
"https://Stackoverflow.com/questions/29248748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896986/"
] | Instead of `a - b` you should do this:
```
a.map{|k,v| [k,v.downcase]} - b.map{|k,v| [k,v.downcase]} # case-insensitive
``` | Using [Proc](http://ruby-doc.org/core-2.2.0/Proc.html) and '[&](http://ruby-doc.org/core-2.2.0/Array.html#method-i-26)':
```
procedure = Proc.new { |i, j| [i, j.upcase] }
(a.map(&procedure) & b.map(&procedure)).count
#=> 5
```
For better understanding, let's simplify it:
```
new_a = a.map {|i, j| [i, j.upcase]}
new... |
29,248,748 | I have two two-dimensional arrays,
```
a = [[17360, "Z51.89"],
[17361, "S93.601A"],
[17362, "H66.91"],
[17363, "H25.12"],
[17364, "Z01.01"],
[17365, "Z00.121"],
[17366, "Z00.129"],
[17367, "K57.90"],
[17368, "I63.9"]]
```
and
```
b = [[17360, "I87.2"],
[17361, "s93.601"],
[17362, "h66.91"],
[17363, "h25.... | 2015/03/25 | [
"https://Stackoverflow.com/questions/29248748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896986/"
] | You can zip them and then use the block form of count:
```
a.zip(b).count{|e| e[0][1].downcase == e[1][1].downcase}
``` | You want to count similar, so &(AND) operation is more suitable.
```
(a.map { |k, v| [k, v.upcase] } & b.map { |k, v| [k, v.upcase] }).count
``` |
29,248,748 | I have two two-dimensional arrays,
```
a = [[17360, "Z51.89"],
[17361, "S93.601A"],
[17362, "H66.91"],
[17363, "H25.12"],
[17364, "Z01.01"],
[17365, "Z00.121"],
[17366, "Z00.129"],
[17367, "K57.90"],
[17368, "I63.9"]]
```
and
```
b = [[17360, "I87.2"],
[17361, "s93.601"],
[17362, "h66.91"],
[17363, "h25.... | 2015/03/25 | [
"https://Stackoverflow.com/questions/29248748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896986/"
] | You can zip them and then use the block form of count:
```
a.zip(b).count{|e| e[0][1].downcase == e[1][1].downcase}
``` | Using [Proc](http://ruby-doc.org/core-2.2.0/Proc.html) and '[&](http://ruby-doc.org/core-2.2.0/Array.html#method-i-26)':
```
procedure = Proc.new { |i, j| [i, j.upcase] }
(a.map(&procedure) & b.map(&procedure)).count
#=> 5
```
For better understanding, let's simplify it:
```
new_a = a.map {|i, j| [i, j.upcase]}
new... |
29,248,748 | I have two two-dimensional arrays,
```
a = [[17360, "Z51.89"],
[17361, "S93.601A"],
[17362, "H66.91"],
[17363, "H25.12"],
[17364, "Z01.01"],
[17365, "Z00.121"],
[17366, "Z00.129"],
[17367, "K57.90"],
[17368, "I63.9"]]
```
and
```
b = [[17360, "I87.2"],
[17361, "s93.601"],
[17362, "h66.91"],
[17363, "h25.... | 2015/03/25 | [
"https://Stackoverflow.com/questions/29248748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896986/"
] | Instead of `a - b` you should do this:
```
a.map{|k,v| [k,v.downcase]} - b.map{|k,v| [k,v.downcase]} # case-insensitive
``` | ```
a.count - (a.map{|e| [e[0],e[1].downcase] } - b.map{|e| [e[0],e[1].downcase] }).count
```
The above maps `a` and `b` to new arrays where the second sub-array element is downcase. |
29,248,748 | I have two two-dimensional arrays,
```
a = [[17360, "Z51.89"],
[17361, "S93.601A"],
[17362, "H66.91"],
[17363, "H25.12"],
[17364, "Z01.01"],
[17365, "Z00.121"],
[17366, "Z00.129"],
[17367, "K57.90"],
[17368, "I63.9"]]
```
and
```
b = [[17360, "I87.2"],
[17361, "s93.601"],
[17362, "h66.91"],
[17363, "h25.... | 2015/03/25 | [
"https://Stackoverflow.com/questions/29248748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896986/"
] | Instead of `a - b` you should do this:
```
a.map{|k,v| [k,v.downcase]} - b.map{|k,v| [k,v.downcase]} # case-insensitive
``` | I have assumed that the ith element of `a` is to be compared with the ith element of `b`. (Edit: a subsequent comment by the OP confirmed this interpretation.)
I would be inclined to use indices to avoid the construction of relatively large temporary arrays. Here are two ways that might be done.
**#1 Use indices**
`... |
29,248,748 | I have two two-dimensional arrays,
```
a = [[17360, "Z51.89"],
[17361, "S93.601A"],
[17362, "H66.91"],
[17363, "H25.12"],
[17364, "Z01.01"],
[17365, "Z00.121"],
[17366, "Z00.129"],
[17367, "K57.90"],
[17368, "I63.9"]]
```
and
```
b = [[17360, "I87.2"],
[17361, "s93.601"],
[17362, "h66.91"],
[17363, "h25.... | 2015/03/25 | [
"https://Stackoverflow.com/questions/29248748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896986/"
] | You can convert Arrays to Hash, and use [Enumerable#count](http://ruby-doc.org/core-2.2.1/Enumerable.html#method-i-count) with a block.
```
b_hash = b.to_h
a.to_h.count {|k, v| b_hash[k] && b_hash[k].downcase == v.downcase }
# => 5
``` | You can zip them and then use the block form of count:
```
a.zip(b).count{|e| e[0][1].downcase == e[1][1].downcase}
``` |
70,579,713 | We are using default DOF grids to present the data in the database. We are using this function out of the box and we are doing only the required xml configuration.
In some cases, the tables contain several hundred thousand records and the DOF grid does not show any data, it shows only empty page, although it has to lo... | 2022/01/04 | [
"https://Stackoverflow.com/questions/70579713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17830578/"
] | The error is because Rust did not infer the type you expected.
In your code, the type of `value` is inferred to be `&i32` because `input` is a reference of a element in `inputs`, and you `push` a `value` later, therefore the type of `stack` is inferred to be `Vec<&i32>`.
A best fix is to explicitly specify the type o... | You have the same behavior with this simple exemple
```
fn main() {
let mut stack = Vec::new();
let a = String::from("test");
stack.push(&a.clone());
//-------- ^
println!("{:?}", stack);
}
```
and the good way is to not borrow when clone.
```
fn main() {
let mut stack = Vec::new();
l... |
2,119,399 | In an exam there is given the general equation for quadratic: $ax^2+bx+c=0$.
It is asking: what does $\dfrac{1}{{x\_1}^3}+\dfrac{1}{{x\_2}^3}$ equal? | 2017/01/29 | [
"https://math.stackexchange.com/questions/2119399",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/411175/"
] | BIG HINT:
$$\frac{1}{x\_1^3}+\frac{1}{x\_2^3}=\frac{x\_1^3+x\_2^3}{x\_1^3x\_2^3}=\frac{(x\_1+x\_2)(x\_1^2-x\_1x\_2+x\_2^2)}{x\_1^3x\_2^3}=\frac{(x\_1+x\_2)((x\_1+x\_2)^2-3x\_1x\_2)}{(x\_1x\_2)^3}$$ | If $x\_{1}$ and $x\_{2}$ are the roots then
$x\_{1} + x\_{2} = -\frac{b}{a}$ and $x\_{1} \cdot x\_{2}=\frac{c}{a}$, now $\frac{1}{x\_{1}}+\frac{1}{x\_{2}} = -\frac{b}{c}$ and $$\frac{1}{x\_{1}^{3}}+\frac{1}{x\_{2}^{3}} = \left(\frac{1}{x\_{1}}+\frac{1}{x\_{2}}\right)^3- 3\cdot\frac{1}{x\_{1}.x\_{2}}\left(\frac{1}{x\_{... |
2,119,399 | In an exam there is given the general equation for quadratic: $ax^2+bx+c=0$.
It is asking: what does $\dfrac{1}{{x\_1}^3}+\dfrac{1}{{x\_2}^3}$ equal? | 2017/01/29 | [
"https://math.stackexchange.com/questions/2119399",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/411175/"
] | BIG HINT:
$$\frac{1}{x\_1^3}+\frac{1}{x\_2^3}=\frac{x\_1^3+x\_2^3}{x\_1^3x\_2^3}=\frac{(x\_1+x\_2)(x\_1^2-x\_1x\_2+x\_2^2)}{x\_1^3x\_2^3}=\frac{(x\_1+x\_2)((x\_1+x\_2)^2-3x\_1x\_2)}{(x\_1x\_2)^3}$$ | Let $\dfrac1{x^3}=y\iff x^3=?$
$$(-c)^3=(ax^2+bx)^3\iff -c^3=a^3(x^3)^2+b^3(x^3)+3ab(x^3)(-c)$$
$$\iff-c^3=\dfrac{a^3}{y^2}+\dfrac{b^3}y-\dfrac{3abc}y$$
$$\iff c^3y^2+(b^3-3abc)y+a^3=0$$ whose roots are $\dfrac1{x\_1^3},\dfrac1{x\_2^3}$
Can you apply Vieta's formula now? |
2,119,399 | In an exam there is given the general equation for quadratic: $ax^2+bx+c=0$.
It is asking: what does $\dfrac{1}{{x\_1}^3}+\dfrac{1}{{x\_2}^3}$ equal? | 2017/01/29 | [
"https://math.stackexchange.com/questions/2119399",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/411175/"
] | Let $\dfrac1{x^3}=y\iff x^3=?$
$$(-c)^3=(ax^2+bx)^3\iff -c^3=a^3(x^3)^2+b^3(x^3)+3ab(x^3)(-c)$$
$$\iff-c^3=\dfrac{a^3}{y^2}+\dfrac{b^3}y-\dfrac{3abc}y$$
$$\iff c^3y^2+(b^3-3abc)y+a^3=0$$ whose roots are $\dfrac1{x\_1^3},\dfrac1{x\_2^3}$
Can you apply Vieta's formula now? | If $x\_{1}$ and $x\_{2}$ are the roots then
$x\_{1} + x\_{2} = -\frac{b}{a}$ and $x\_{1} \cdot x\_{2}=\frac{c}{a}$, now $\frac{1}{x\_{1}}+\frac{1}{x\_{2}} = -\frac{b}{c}$ and $$\frac{1}{x\_{1}^{3}}+\frac{1}{x\_{2}^{3}} = \left(\frac{1}{x\_{1}}+\frac{1}{x\_{2}}\right)^3- 3\cdot\frac{1}{x\_{1}.x\_{2}}\left(\frac{1}{x\_{... |
12,176 | What are the best ways to translate `For all you know`?
For example:
>
> For all you know, she could be lying to you.
>
>
> In response to a friend getting upset that her friend isn't picking up her phone, I respond, "For all you know, something could have happened."
>
>
> A neighbor sends us some vegetables and... | 2015/01/22 | [
"https://chinese.stackexchange.com/questions/12176",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/3011/"
] | Agree with StumpyJoePete.
As we all know = Everybody knows.
For all you know = You don't really know for sure.
I think Damian Siniakowicz's suggestion will work.
We better wash the vegetables first, for all we know, they could be covered in pesticide
我们还是先把蔬菜洗一下,说不定有農藥呢。
A couple more suggestions:
我们还是先把蔬菜洗一下... | Just found this interesting [discussion](http://forum.wordreference.com/showthread.php?t=477816). It offered a definition:
>
> This expression [for all you know] can be used in any context where the speaker wishes to convey that the listener is failing (deliberately or otherwise) to consider all the possibilities.
> ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.