qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
49,066,046 | I made a simple form in Flask using Flask-WTForms where a parent can register itself and his children. The parent can register as many children as he wants, by clicking on the button 'Add child'. WTForms makes this pretty easy to implement by using the FieldList feature.
However, after clicking on the button 'Add chil... | 2018/03/02 | [
"https://Stackoverflow.com/questions/49066046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8584432/"
] | I think this should work. Barring any typos.
views.py
```
########
# SET UP YOUR FLASK APP HERE
########
from flask_wtf import FlaskForm
from wtforms_alchemy import model_form_factory
class Family(db.Model):
id = db.Column('id', db.Integer, primary_key=True)
name = db.Column(db.String(500), info={'label': '... | For people who want to use the form in the more rudimentary non-RESTful way there is still the challenge of how to persist the form data correctly server side. If you don't do it right updating existing children in the form will append new children in the db rather than update existing ones. Below I provide two flask v... |
49,066,046 | I made a simple form in Flask using Flask-WTForms where a parent can register itself and his children. The parent can register as many children as he wants, by clicking on the button 'Add child'. WTForms makes this pretty easy to implement by using the FieldList feature.
However, after clicking on the button 'Add chil... | 2018/03/02 | [
"https://Stackoverflow.com/questions/49066046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8584432/"
] | In the below setup a user has a input which specifies how many text areas he will submit on the form (they dynamically appear and disappear) and then can submit it with AJAX.
### Python backend
```
from flask import jsonify
from webargs import flaskparser, fields, validate
USER_ARGS_POST = {
'list_of_items': fie... | For people who want to use the form in the more rudimentary non-RESTful way there is still the challenge of how to persist the form data correctly server side. If you don't do it right updating existing children in the form will append new children in the db rather than update existing ones. Below I provide two flask v... |
4,679,967 | I have an Windows Forms application VS 2008 - C#, that uses app.config.
In execution time, in Menu option of my application, I want editing values of app.config, save it and restart application.
any sample source code, any good patterns and practices ??
edit:
in MSDN Forums, Jean Paul VA:
1. Create an test windows... | 2011/01/13 | [
"https://Stackoverflow.com/questions/4679967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206730/"
] | I don't think you can actually write to the configuration file at runtime - it may well be read-only, however, there may be a way around this by re-writing the file (with proper alterations as required) and essentially replacing the existing one, then, further, restarting the application to load the new values (I highl... | Is there any reason you can't use the usual auto-gen'd Properties.Settings to store the changing data in a settings file instead? One great thing is that you know what you're changing so you don't even have to restart the application!
[Using Settings in C#](http://msdn.microsoft.com/en-us/library/aa730869%28v=vs.80%29... |
4,679,967 | I have an Windows Forms application VS 2008 - C#, that uses app.config.
In execution time, in Menu option of my application, I want editing values of app.config, save it and restart application.
any sample source code, any good patterns and practices ??
edit:
in MSDN Forums, Jean Paul VA:
1. Create an test windows... | 2011/01/13 | [
"https://Stackoverflow.com/questions/4679967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206730/"
] | I don't think you can actually write to the configuration file at runtime - it may well be read-only, however, there may be a way around this by re-writing the file (with proper alterations as required) and essentially replacing the existing one, then, further, restarting the application to load the new values (I highl... | Use the Project->Properties->Settings for these kinds of things. |
4,679,967 | I have an Windows Forms application VS 2008 - C#, that uses app.config.
In execution time, in Menu option of my application, I want editing values of app.config, save it and restart application.
any sample source code, any good patterns and practices ??
edit:
in MSDN Forums, Jean Paul VA:
1. Create an test windows... | 2011/01/13 | [
"https://Stackoverflow.com/questions/4679967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206730/"
] | I don't think you can actually write to the configuration file at runtime - it may well be read-only, however, there may be a way around this by re-writing the file (with proper alterations as required) and essentially replacing the existing one, then, further, restarting the application to load the new values (I highl... | well actually the Properties in the App.config are ReadOnly so u cant do it.
But there's a trick............................
In the Settings.cs file create a Function or method that is public so that it can be available with `Properties.settings`
and write the following code..
```
public void ChangeProperty(st... |
4,679,967 | I have an Windows Forms application VS 2008 - C#, that uses app.config.
In execution time, in Menu option of my application, I want editing values of app.config, save it and restart application.
any sample source code, any good patterns and practices ??
edit:
in MSDN Forums, Jean Paul VA:
1. Create an test windows... | 2011/01/13 | [
"https://Stackoverflow.com/questions/4679967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206730/"
] | Is there any reason you can't use the usual auto-gen'd Properties.Settings to store the changing data in a settings file instead? One great thing is that you know what you're changing so you don't even have to restart the application!
[Using Settings in C#](http://msdn.microsoft.com/en-us/library/aa730869%28v=vs.80%29... | Use the Project->Properties->Settings for these kinds of things. |
4,679,967 | I have an Windows Forms application VS 2008 - C#, that uses app.config.
In execution time, in Menu option of my application, I want editing values of app.config, save it and restart application.
any sample source code, any good patterns and practices ??
edit:
in MSDN Forums, Jean Paul VA:
1. Create an test windows... | 2011/01/13 | [
"https://Stackoverflow.com/questions/4679967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206730/"
] | Is there any reason you can't use the usual auto-gen'd Properties.Settings to store the changing data in a settings file instead? One great thing is that you know what you're changing so you don't even have to restart the application!
[Using Settings in C#](http://msdn.microsoft.com/en-us/library/aa730869%28v=vs.80%29... | well actually the Properties in the App.config are ReadOnly so u cant do it.
But there's a trick............................
In the Settings.cs file create a Function or method that is public so that it can be available with `Properties.settings`
and write the following code..
```
public void ChangeProperty(st... |
14,808 | I always wonder how vectors are used in real life.Vectors and decomposition of vectors,dot and cross products are taught in the early stage in every undergraduate physics course and in every university.My question is how and where are vectors used? **Do physicists really use vectors in every day life? If so where?**
I... | 2011/09/18 | [
"https://physics.stackexchange.com/questions/14808",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/5129/"
] | Vectors are probably the most important tool to learn in all of physics and engineering. Some random examples:
1. Classical Mechanics: Block sliding down a ramp: You need to calculate the force of gravity (a vector down), the normal force (a vector perpendicular to the ramp), and a friction force (a vector opposite th... | I am definitely not a physicist, however I can think of 2 engineering problems off the top of my head. If I'm incorrect about any of these, please let me know.
1. Structural engineering. If forces acting on structure are stronger than structure will support, the structure collapses.
2. Any kind of oscillator/wave prop... |
14,808 | I always wonder how vectors are used in real life.Vectors and decomposition of vectors,dot and cross products are taught in the early stage in every undergraduate physics course and in every university.My question is how and where are vectors used? **Do physicists really use vectors in every day life? If so where?**
I... | 2011/09/18 | [
"https://physics.stackexchange.com/questions/14808",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/5129/"
] | I am definitely not a physicist, however I can think of 2 engineering problems off the top of my head. If I'm incorrect about any of these, please let me know.
1. Structural engineering. If forces acting on structure are stronger than structure will support, the structure collapses.
2. Any kind of oscillator/wave prop... | Nobody actually uses undergraduate style vectors in real life, they are an inane useless outdated formalism which should not be taught.
What people do use is the mathematically less sophisticated, but practically more useful, decomposition of vectors into components. The undergraduate calculus of cross products and do... |
14,808 | I always wonder how vectors are used in real life.Vectors and decomposition of vectors,dot and cross products are taught in the early stage in every undergraduate physics course and in every university.My question is how and where are vectors used? **Do physicists really use vectors in every day life? If so where?**
I... | 2011/09/18 | [
"https://physics.stackexchange.com/questions/14808",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/5129/"
] | Vectors are probably the most important tool to learn in all of physics and engineering. Some random examples:
1. Classical Mechanics: Block sliding down a ramp: You need to calculate the force of gravity (a vector down), the normal force (a vector perpendicular to the ramp), and a friction force (a vector opposite th... | Nobody actually uses undergraduate style vectors in real life, they are an inane useless outdated formalism which should not be taught.
What people do use is the mathematically less sophisticated, but practically more useful, decomposition of vectors into components. The undergraduate calculus of cross products and do... |
12,547,529 | My site has a login box in the Layout page on which every page is based. When the Login button is clicked, no matter it is successful or failure, the user will be sent to the same page where the Login button is clicked.
The login form is posted to Account.Login action method. However, how can I return the correct view ... | 2012/09/22 | [
"https://Stackoverflow.com/questions/12547529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1691450/"
] | Yes, this is how it should be done. You are explicitly transferring ownership from `main` to `A`. This is basically the same as your previous code, except it's more explicit and vastly more reliable. | >
> So my simple question: is this the way to do it and in particular, is this "move(b)" the only way to do it? (I was thinking of rvalue references but I don't fully understand it so...)
>
>
> And if you have a link with complete explanations of move semantics, unique\_ptr... that I was not able to find, don't hesi... |
12,547,529 | My site has a login box in the Layout page on which every page is based. When the Login button is clicked, no matter it is successful or failure, the user will be sent to the same page where the Login button is clicked.
The login form is posted to Account.Login action method. However, how can I return the correct view ... | 2012/09/22 | [
"https://Stackoverflow.com/questions/12547529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1691450/"
] | Yes, this is how it should be done. You are explicitly transferring ownership from `main` to `A`. This is basically the same as your previous code, except it's more explicit and vastly more reliable. | Your code in `main` could be simplified a little, since C++14:
```
a.add( make_unique<B>() );
```
where you can put arguments for `B`'s constructor inside the inner parentheses.
---
You could also consider a class member function that takes ownership of a raw pointer:
```
void take(B *ptr) { vb.emplace_back(ptr);... |
12,547,529 | My site has a login box in the Layout page on which every page is based. When the Login button is clicked, no matter it is successful or failure, the user will be sent to the same page where the Login button is clicked.
The login form is posted to Account.Login action method. However, how can I return the correct view ... | 2012/09/22 | [
"https://Stackoverflow.com/questions/12547529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1691450/"
] | I am somewhat surprised that this is not answered very clearly and explicitly here, nor on any place I easily stumbled upon. While I'm pretty new to this stuff, I think the following can be said.
The situation is a calling function that builds a `unique_ptr<T>` value (possibly by casting the result from a call to `new... | >
> So my simple question: is this the way to do it and in particular, is this "move(b)" the only way to do it? (I was thinking of rvalue references but I don't fully understand it so...)
>
>
> And if you have a link with complete explanations of move semantics, unique\_ptr... that I was not able to find, don't hesi... |
12,547,529 | My site has a login box in the Layout page on which every page is based. When the Login button is clicked, no matter it is successful or failure, the user will be sent to the same page where the Login button is clicked.
The login form is posted to Account.Login action method. However, how can I return the correct view ... | 2012/09/22 | [
"https://Stackoverflow.com/questions/12547529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1691450/"
] | I am somewhat surprised that this is not answered very clearly and explicitly here, nor on any place I easily stumbled upon. While I'm pretty new to this stuff, I think the following can be said.
The situation is a calling function that builds a `unique_ptr<T>` value (possibly by casting the result from a call to `new... | Your code in `main` could be simplified a little, since C++14:
```
a.add( make_unique<B>() );
```
where you can put arguments for `B`'s constructor inside the inner parentheses.
---
You could also consider a class member function that takes ownership of a raw pointer:
```
void take(B *ptr) { vb.emplace_back(ptr);... |
4,515,460 | I have always been taught that probability of an event is defined as $$P(E) = \frac{n(E)}{n(S)}$$
where *E* is an event, *S* is the sample space, and *n(x)* indicates the size of *x*.
Now, let's say I have 5 cubes and 10 balls in a box. If I take one object from the box, then the probability that the outcome will be ... | 2022/08/20 | [
"https://math.stackexchange.com/questions/4515460",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/1087710/"
] | >
> I have always been taught that probability of an event is defined as $$P(E) = \frac{n(E)}{n(S)}$$
>
>
>
This formula applies when every outcome has the same probability (classical probability) and the sample space is finite.
>
> Now, let's say I have 5 cubes and 10 balls in a box. If I take one object from t... | The formula $P(E) = n(E)/n(S)$ assumes that all events in $S$ are equally likely; this need not be the case.
Here, a reasonable assignment to the sample space would be $S = \{B,C\}$, for drawing a ball or cube respectively. But as you have seen, these are not equally likely.
One potential reframing of the problem is ... |
375,904 | Hopefully I am posting a question in right forum. As per <https://meta.stackexchange.com/questions/68384/whats-the-difference-between-stack-overflow-and-software-engineering-se-previo> `software engineering' seems to be the right choice for my question.
**So question is,**
We are in `IoT` era, and most of new bee's ... | 2018/07/26 | [
"https://softwareengineering.stackexchange.com/questions/375904",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/311449/"
] | It is not a bad idea, but it does have some consequences you should be aware of. It's a tradeoff.
Its simpler and shorter, and less programmer overhead typing crap. And its probably less likely to include stray includes that are not needed (though now modern IDEs detect/fix that for you so maybe that doesn't matter).
... | Bad idea. You rely on a kind of smartness inappropriate at the compiler level. Import statements serve a documentation purpose: the reader gets an idea about the covered domains of the class. This is partly killed by the wildcard, you are not likely to actually use every namespace that fits the \*.
Using a wildcard ma... |
10,878,798 | I have a model that uses remote validation. The model also acts as a parent class to a child class. How would i disable remote validation in the view for a particular field?
Model code
```
public user
{
[Remote("Validateemail","User",etc)]
public string Email {get; set;}
}
public edituser:user
{
public int user... | 2012/06/04 | [
"https://Stackoverflow.com/questions/10878798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1244706/"
] | I'm not sure exactly what your question is but I'd typically do something like this to create the JSON string that you are looking for (the example below is using the org.json reference implementation from <http://www.json.org/java/index.html>):
```
JSONObject parent = new JSONObject();
JSONArray infoArray = new JSONA... | I don't understand why you're calling `toString()` after putting stuff into `childObj`.
Anyway, this code should work:
```
JSONObject parent = new JSONObject();
JSONArray jArray = new JSONArray();
JSONObject childObj = new JSONObject();
try
{
//create first child
childObj
.put("Name", "foo1")
... |
59,039,247 | I am trying to create a column using data from another column based on part of the information of that column, For example I have a list of devices:
```
devicename make devicevalue
switch1 cisco 0
switch1-web100 netgear 0
switch10 cisco 0
switch23 cis... | 2019/11/25 | [
"https://Stackoverflow.com/questions/59039247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12431545/"
] | Try the following:
```
import pandas as pd
df = pd.DataFrame(columns=['devicename', 'make'])
df.loc[0] = ['switch1', 'cisco']
df.loc[1] = ['switch1-web100', 'netgear']
df.loc[2] = ['switch10', 'cisco']
df.loc[3] = ['switch23', 'cisco']
df.loc[4] = ['switch31-web200', 'netgear']
df.loc[5] = ['switch31', 'cisco']
df.lo... | Looks like you are having trouble working through the data. Here is how I would approach this. Use a for loop to cycle through the different elements in each column, then use logic on each of those as you cycle through. [This question previously](https://stackoverflow.com/questions/3340081/product-code-looks-like-abcd2... |
38,579,909 | I'm stuck as to why I can't load my dll "interfac" using LoadLibrary. It seems to be failing when loading a dependency but I'm not sure why.
Here's the code:
```
AfxMessageBox(L"before load library");
HMODULE interfacDll = LoadLibrary(TEXT("C:\\QA\\Pcdlrn\\Win32\\Release\\INTERFAC.DLL"));
if (!interfacDll)
DWORD d... | 2016/07/26 | [
"https://Stackoverflow.com/questions/38579909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1008943/"
] | One likely explanation for the `ERROR_BAD_EXE_FORMAT` error from `LoadLibrary` is that `INTERFAC.DLL` was linked with a `PCDLRN.LIB` import library that declares `PCDLRN` exports, but the `PCDLRN.EXE` found at runtime does not have an [exports table](https://msdn.microsoft.com/en-us/library/z4zxe9k8.aspx).
* The `gfla... | **Edit**: Though what follows makes sense it is actually incorrect. I'm keeping it here just for reference, but I may delete the answer later.
Note however that (at least on Windows 10, which I used to check) even if relocation information is available in the file, if the module is not a DLL it is not applied, so even... |
171,628 | I have a piece of code where I am able to find the max value. How can i edit this code to find the second largest, and then the third? I found this code here (<https://geonet.esri.com/message/237880#237880>). While there is another method that identifies a way to do this, it appears like it would be much slower (bulid ... | 2015/11/25 | [
"https://gis.stackexchange.com/questions/171628",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/41060/"
] | ```
sortAsc= arcpy.SearchCursor(inlayer, "", "", "", myField + " A") #Sorted in ascending order
first = sortAsc.next().getValue(myField)
second = sortAsc.next().getValue(myField)
third = sortAsc.next().getValue(myField)
```
Try this, each time you call .next(), it should move the cursor so you just keep calling .ne... | I found the solution with a little thinking... Ignore the first while loop, other code for other reasons....
```
cur_vals = 2
neighbour = 0
while neighbour == 0:
cur_val = cur_vals
row = arcpy.SearchCursor("CONFLICT.shp", "", "", "", "RNDM" + " D")
while 1 <= cur_val:
... |
171,628 | I have a piece of code where I am able to find the max value. How can i edit this code to find the second largest, and then the third? I found this code here (<https://geonet.esri.com/message/237880#237880>). While there is another method that identifies a way to do this, it appears like it would be much slower (bulid ... | 2015/11/25 | [
"https://gis.stackexchange.com/questions/171628",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/41060/"
] | Building on @Richard's comments, let's see which is the quickest way.
Short answer:
* **`sorted()`** Not surprising, haha.
---
Too much time on my hands answer:
For starters, here's a table in an FGDB that was filled like so:
```
from random import randint
with arcpy.da.InsertCursor("d", "r") as cursor:
fo... | ```
sortAsc= arcpy.SearchCursor(inlayer, "", "", "", myField + " A") #Sorted in ascending order
first = sortAsc.next().getValue(myField)
second = sortAsc.next().getValue(myField)
third = sortAsc.next().getValue(myField)
```
Try this, each time you call .next(), it should move the cursor so you just keep calling .ne... |
171,628 | I have a piece of code where I am able to find the max value. How can i edit this code to find the second largest, and then the third? I found this code here (<https://geonet.esri.com/message/237880#237880>). While there is another method that identifies a way to do this, it appears like it would be much slower (bulid ... | 2015/11/25 | [
"https://gis.stackexchange.com/questions/171628",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/41060/"
] | Building on @Richard's comments, let's see which is the quickest way.
Short answer:
* **`sorted()`** Not surprising, haha.
---
Too much time on my hands answer:
For starters, here's a table in an FGDB that was filled like so:
```
from random import randint
with arcpy.da.InsertCursor("d", "r") as cursor:
fo... | I found the solution with a little thinking... Ignore the first while loop, other code for other reasons....
```
cur_vals = 2
neighbour = 0
while neighbour == 0:
cur_val = cur_vals
row = arcpy.SearchCursor("CONFLICT.shp", "", "", "", "RNDM" + " D")
while 1 <= cur_val:
... |
34,650,724 | I'm developing a SQL Server 2012 stored procedure.
I need to return a list of nvarchar(20) values, and I don't know how can I do it. I have tried this:
1. Using a Table-Valued Parameters but it must be `READONLY`.
2. Doing a select to return that list. But stored procedures only
returns `INT` values.
Any idea?
**UP... | 2016/01/07 | [
"https://Stackoverflow.com/questions/34650724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68571/"
] | >
> Stored procedure returns only Integer?
>
>
>
No this is not 100% true. If you are using [RETURN](http://msdn.microsoft.com/en-us/library/ms174998%28v=sql.100%29.aspx) to return the values from your stored procedure then your statement is true else it is false.
If you want to return string from your stored pr... | Stored procedures return the type of the field in the `SELECT` statement. You can use `CAST` and `CONVERT` to change the types. For example:
`SELECT CAST(field AS NVARCHAR(20))`
With table value parameters you can set the field type on creation:
```
CREATE TYPE JobSpecifications AS TABLE
(JobName VARCHAR(50), Avail... |
34,650,724 | I'm developing a SQL Server 2012 stored procedure.
I need to return a list of nvarchar(20) values, and I don't know how can I do it. I have tried this:
1. Using a Table-Valued Parameters but it must be `READONLY`.
2. Doing a select to return that list. But stored procedures only
returns `INT` values.
Any idea?
**UP... | 2016/01/07 | [
"https://Stackoverflow.com/questions/34650724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68571/"
] | >
> Stored procedure returns only Integer?
>
>
>
No this is not 100% true. If you are using [RETURN](http://msdn.microsoft.com/en-us/library/ms174998%28v=sql.100%29.aspx) to return the values from your stored procedure then your statement is true else it is false.
If you want to return string from your stored pr... | you can use a temporary table to recuperate your list from the stored procedure, like the example below :
```
create proc Test
AS BEGIN
SELECT CAST('jkj' AS NVARCHAR(20)) value
END
DECLARE @tmp TABLE(value nvarchar(20))
INSERT INTO @tmp EXEC GhaziTest
SELECT * from @tmp
``` |
1,301,298 | I have a mirrored database and I need to make some changes to it. Mainly, adding a view and some stored procedures. Now I know that if you make schema changes you are supposed to remove mirroring and the mirror database, make your changes to the principal, then backup-restore the principal and restore mirroring. Is thi... | 2009/08/19 | [
"https://Stackoverflow.com/questions/1301298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48450/"
] | If you are mirroring, you should be able to apply those changes to the principal and they show up on the mirrored side. If you want there to be schema difference between the two, you can't use mirroring. Are you looking to apply schema changes on just the mirrored database or to both? If both then you don't have to do ... | We have applied schema changes to both a logshipped and mirrored database and not had to take any special action.
Some forms of replication require special mesaures though. |
1,301,298 | I have a mirrored database and I need to make some changes to it. Mainly, adding a view and some stored procedures. Now I know that if you make schema changes you are supposed to remove mirroring and the mirror database, make your changes to the principal, then backup-restore the principal and restore mirroring. Is thi... | 2009/08/19 | [
"https://Stackoverflow.com/questions/1301298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48450/"
] | If you are mirroring, you should be able to apply those changes to the principal and they show up on the mirrored side. If you want there to be schema difference between the two, you can't use mirroring. Are you looking to apply schema changes on just the mirrored database or to both? If both then you don't have to do ... | >
> Now I know that if you make schema
> changes you are supposed to remove
> mirroring and the mirror database,
> make your changes to the principal,
> then backup-restore the principal and
> restore mirroring
>
>
>
This is actually wrong. The principal and mirror database are in fact a single database that ... |
1,301,298 | I have a mirrored database and I need to make some changes to it. Mainly, adding a view and some stored procedures. Now I know that if you make schema changes you are supposed to remove mirroring and the mirror database, make your changes to the principal, then backup-restore the principal and restore mirroring. Is thi... | 2009/08/19 | [
"https://Stackoverflow.com/questions/1301298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48450/"
] | >
> Now I know that if you make schema
> changes you are supposed to remove
> mirroring and the mirror database,
> make your changes to the principal,
> then backup-restore the principal and
> restore mirroring
>
>
>
This is actually wrong. The principal and mirror database are in fact a single database that ... | We have applied schema changes to both a logshipped and mirrored database and not had to take any special action.
Some forms of replication require special mesaures though. |
41,741,171 | I would like to generate a HTML file out of an JSON in a loop. For example that's the result I want:
```
<div class="card">
<p>My name is: Peter</p>
<!-- another code -->
<p>My job is: Programmer</p>
<!-- some more code -->
</div>
<div class="card">
<p>My name is: John</p>
<!-- another code --... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41741171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7440759/"
] | Take a look.
<https://jsfiddle.net/c0w6jbpa/>
```
$.each(arr, function(i){ //Loop the array
var templateString = '<div class="card"><p>My name is: '+arr[i].Name+'</p><p>My job is: '+arr[i].Job+'</p></div>';
//You can get the prop of array with arr[i].Name
$('#test').append(templateString);
})
```
You... | In pure JavaScript, you could use a string template and append the HTML to a container, similar to this.
```js
var jsonData = '[{"Name":"Peter","Job":"Programmer"},{"Name":"John","Job":"Programmer"},{"Name":"Kevin","Job":"Scientist"}]'
var htmlTemplate = '<div class="card"><p>My name is: {0}</p><!-- another code -->... |
41,741,171 | I would like to generate a HTML file out of an JSON in a loop. For example that's the result I want:
```
<div class="card">
<p>My name is: Peter</p>
<!-- another code -->
<p>My job is: Programmer</p>
<!-- some more code -->
</div>
<div class="card">
<p>My name is: John</p>
<!-- another code --... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41741171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7440759/"
] | Try this one:
```
function createCard(cardData) {
var cardTemplate = [
'<div class="card">',
'<p>My name is: ',
cardData.Name || 'No name provided',
'</p>',
'<p>My job is: ',
cardData.Job || 'No job provided',
'</p></div>'
];
// a jQuery node
return $(cardTemplate.join(''));
}
var... | **Take a look**
```js
var jsonData = '[{"Name":"Peter","Job":"Programmer"},{"Name":"John","Job":"Programmer"},{"Name":"Kevin","Job":"Scientist"}]';
UpdateView("#testDiv",jsonData);
function UpdateView(divId,jsonData){
var htmlTemplate = '<div class="card"><p>My name is: {0}</p><!-- another code --><p>My job is: {... |
41,741,171 | I would like to generate a HTML file out of an JSON in a loop. For example that's the result I want:
```
<div class="card">
<p>My name is: Peter</p>
<!-- another code -->
<p>My job is: Programmer</p>
<!-- some more code -->
</div>
<div class="card">
<p>My name is: John</p>
<!-- another code --... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41741171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7440759/"
] | Try this one:
```
function createCard(cardData) {
var cardTemplate = [
'<div class="card">',
'<p>My name is: ',
cardData.Name || 'No name provided',
'</p>',
'<p>My job is: ',
cardData.Job || 'No job provided',
'</p></div>'
];
// a jQuery node
return $(cardTemplate.join(''));
}
var... | This will help you to generate divs :
```js
var data = [
{"Name":"Peter","Job":"Programmer"},
{"Name":"John","Job":"Programmer"},
{"Name":"Kevin","Job":"Scientist"},
];
var divs = "";
for( var i = 0; i < data.length;++i) {
divs += "<div class='card'>"
... |
41,741,171 | I would like to generate a HTML file out of an JSON in a loop. For example that's the result I want:
```
<div class="card">
<p>My name is: Peter</p>
<!-- another code -->
<p>My job is: Programmer</p>
<!-- some more code -->
</div>
<div class="card">
<p>My name is: John</p>
<!-- another code --... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41741171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7440759/"
] | **Take a look**
```js
var jsonData = '[{"Name":"Peter","Job":"Programmer"},{"Name":"John","Job":"Programmer"},{"Name":"Kevin","Job":"Scientist"}]';
UpdateView("#testDiv",jsonData);
function UpdateView(divId,jsonData){
var htmlTemplate = '<div class="card"><p>My name is: {0}</p><!-- another code --><p>My job is: {... | No need for jquery.
```
cards.forEach(function(card){
document.body.innerHTML += "<div class='card'><p>My Name is "+card.Name+"</p><p>My Job Is "+card.Job+"</p></div>"
});
``` |
41,741,171 | I would like to generate a HTML file out of an JSON in a loop. For example that's the result I want:
```
<div class="card">
<p>My name is: Peter</p>
<!-- another code -->
<p>My job is: Programmer</p>
<!-- some more code -->
</div>
<div class="card">
<p>My name is: John</p>
<!-- another code --... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41741171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7440759/"
] | Try this one:
```
function createCard(cardData) {
var cardTemplate = [
'<div class="card">',
'<p>My name is: ',
cardData.Name || 'No name provided',
'</p>',
'<p>My job is: ',
cardData.Job || 'No job provided',
'</p></div>'
];
// a jQuery node
return $(cardTemplate.join(''));
}
var... | Take a look.
<https://jsfiddle.net/c0w6jbpa/>
```
$.each(arr, function(i){ //Loop the array
var templateString = '<div class="card"><p>My name is: '+arr[i].Name+'</p><p>My job is: '+arr[i].Job+'</p></div>';
//You can get the prop of array with arr[i].Name
$('#test').append(templateString);
})
```
You... |
41,741,171 | I would like to generate a HTML file out of an JSON in a loop. For example that's the result I want:
```
<div class="card">
<p>My name is: Peter</p>
<!-- another code -->
<p>My job is: Programmer</p>
<!-- some more code -->
</div>
<div class="card">
<p>My name is: John</p>
<!-- another code --... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41741171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7440759/"
] | Take a look.
<https://jsfiddle.net/c0w6jbpa/>
```
$.each(arr, function(i){ //Loop the array
var templateString = '<div class="card"><p>My name is: '+arr[i].Name+'</p><p>My job is: '+arr[i].Job+'</p></div>';
//You can get the prop of array with arr[i].Name
$('#test').append(templateString);
})
```
You... | **Take a look**
```js
var jsonData = '[{"Name":"Peter","Job":"Programmer"},{"Name":"John","Job":"Programmer"},{"Name":"Kevin","Job":"Scientist"}]';
UpdateView("#testDiv",jsonData);
function UpdateView(divId,jsonData){
var htmlTemplate = '<div class="card"><p>My name is: {0}</p><!-- another code --><p>My job is: {... |
41,741,171 | I would like to generate a HTML file out of an JSON in a loop. For example that's the result I want:
```
<div class="card">
<p>My name is: Peter</p>
<!-- another code -->
<p>My job is: Programmer</p>
<!-- some more code -->
</div>
<div class="card">
<p>My name is: John</p>
<!-- another code --... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41741171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7440759/"
] | Take a look.
<https://jsfiddle.net/c0w6jbpa/>
```
$.each(arr, function(i){ //Loop the array
var templateString = '<div class="card"><p>My name is: '+arr[i].Name+'</p><p>My job is: '+arr[i].Job+'</p></div>';
//You can get the prop of array with arr[i].Name
$('#test').append(templateString);
})
```
You... | This will help you to generate divs :
```js
var data = [
{"Name":"Peter","Job":"Programmer"},
{"Name":"John","Job":"Programmer"},
{"Name":"Kevin","Job":"Scientist"},
];
var divs = "";
for( var i = 0; i < data.length;++i) {
divs += "<div class='card'>"
... |
41,741,171 | I would like to generate a HTML file out of an JSON in a loop. For example that's the result I want:
```
<div class="card">
<p>My name is: Peter</p>
<!-- another code -->
<p>My job is: Programmer</p>
<!-- some more code -->
</div>
<div class="card">
<p>My name is: John</p>
<!-- another code --... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41741171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7440759/"
] | Try this one:
```
function createCard(cardData) {
var cardTemplate = [
'<div class="card">',
'<p>My name is: ',
cardData.Name || 'No name provided',
'</p>',
'<p>My job is: ',
cardData.Job || 'No job provided',
'</p></div>'
];
// a jQuery node
return $(cardTemplate.join(''));
}
var... | In pure JavaScript, you could use a string template and append the HTML to a container, similar to this.
```js
var jsonData = '[{"Name":"Peter","Job":"Programmer"},{"Name":"John","Job":"Programmer"},{"Name":"Kevin","Job":"Scientist"}]'
var htmlTemplate = '<div class="card"><p>My name is: {0}</p><!-- another code -->... |
41,741,171 | I would like to generate a HTML file out of an JSON in a loop. For example that's the result I want:
```
<div class="card">
<p>My name is: Peter</p>
<!-- another code -->
<p>My job is: Programmer</p>
<!-- some more code -->
</div>
<div class="card">
<p>My name is: John</p>
<!-- another code --... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41741171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7440759/"
] | Take a look.
<https://jsfiddle.net/c0w6jbpa/>
```
$.each(arr, function(i){ //Loop the array
var templateString = '<div class="card"><p>My name is: '+arr[i].Name+'</p><p>My job is: '+arr[i].Job+'</p></div>';
//You can get the prop of array with arr[i].Name
$('#test').append(templateString);
})
```
You... | No need for jquery.
```
cards.forEach(function(card){
document.body.innerHTML += "<div class='card'><p>My Name is "+card.Name+"</p><p>My Job Is "+card.Job+"</p></div>"
});
``` |
41,741,171 | I would like to generate a HTML file out of an JSON in a loop. For example that's the result I want:
```
<div class="card">
<p>My name is: Peter</p>
<!-- another code -->
<p>My job is: Programmer</p>
<!-- some more code -->
</div>
<div class="card">
<p>My name is: John</p>
<!-- another code --... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41741171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7440759/"
] | Take a look.
<https://jsfiddle.net/c0w6jbpa/>
```
$.each(arr, function(i){ //Loop the array
var templateString = '<div class="card"><p>My name is: '+arr[i].Name+'</p><p>My job is: '+arr[i].Job+'</p></div>';
//You can get the prop of array with arr[i].Name
$('#test').append(templateString);
})
```
You... | You better learn how to do it in native javaScript:
JSON.parse(MyJsonArray).forEach(function (person){
document.getElementById("cardParentEl").innerHTML += ' my name is:'+ person.Name +'
my job is:'+ person.Job+'
';
});
As you can see, it's messy.. a better way to dynamically create html, if you have to do it ver... |
36,250,990 | I have a class that represents object. And I have a bunch of methods which modify this object state with no obvious return or obviously without any return. In C# I would declare all these methods as `void` and see no alternatives. But in Python I am about to make all the methods `return self` to give myself ability to ... | 2016/03/27 | [
"https://Stackoverflow.com/questions/36250990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5947296/"
] | Here is a mail from Guido van Rossum (the author of the Python programming language) about this topic: <https://mail.python.org/pipermail/python-dev/2003-October/038855.html>
>
> I'd like to explain once more why I'm so adamant that sort() shouldn't
> return 'self'.
>
>
> This comes from a coding style (popular in... | Here is an example which demonstrates a scenario when it may be a good technique
```
class A:
def __init__(self, x):
self.x = x
def add(self, y):
self.x += y
return self
def multiply(self, y):
self.x *= y
return self
def get(self):
return self.x
a = A(0)
... |
36,250,990 | I have a class that represents object. And I have a bunch of methods which modify this object state with no obvious return or obviously without any return. In C# I would declare all these methods as `void` and see no alternatives. But in Python I am about to make all the methods `return self` to give myself ability to ... | 2016/03/27 | [
"https://Stackoverflow.com/questions/36250990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5947296/"
] | Here is an example which demonstrates a scenario when it may be a good technique
```
class A:
def __init__(self, x):
self.x = x
def add(self, y):
self.x += y
return self
def multiply(self, y):
self.x *= y
return self
def get(self):
return self.x
a = A(0)
... | If you so desire, you can use a decorator here. It will stand out to someone looking through your code to see the interface, and you don't have to explicitly `return self` from every function (which could be annoying if you have multiple exit points).
```
import functools
def fluent(func):
@functools.wraps(func)
... |
36,250,990 | I have a class that represents object. And I have a bunch of methods which modify this object state with no obvious return or obviously without any return. In C# I would declare all these methods as `void` and see no alternatives. But in Python I am about to make all the methods `return self` to give myself ability to ... | 2016/03/27 | [
"https://Stackoverflow.com/questions/36250990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5947296/"
] | Here is a mail from Guido van Rossum (the author of the Python programming language) about this topic: <https://mail.python.org/pipermail/python-dev/2003-October/038855.html>
>
> I'd like to explain once more why I'm so adamant that sort() shouldn't
> return 'self'.
>
>
> This comes from a coding style (popular in... | It is an excellent idea for APIs where you are building state through methods. [SQLAlchemy](http://www.sqlalchemy.org/) uses this to great effect for example:
```
>>> from sqlalchemy.orm import aliased
>>> adalias1 = aliased(Address)
>>> adalias2 = aliased(Address)
>>> for username, email1, email2 in \
... session... |
36,250,990 | I have a class that represents object. And I have a bunch of methods which modify this object state with no obvious return or obviously without any return. In C# I would declare all these methods as `void` and see no alternatives. But in Python I am about to make all the methods `return self` to give myself ability to ... | 2016/03/27 | [
"https://Stackoverflow.com/questions/36250990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5947296/"
] | It is an excellent idea for APIs where you are building state through methods. [SQLAlchemy](http://www.sqlalchemy.org/) uses this to great effect for example:
```
>>> from sqlalchemy.orm import aliased
>>> adalias1 = aliased(Address)
>>> adalias2 = aliased(Address)
>>> for username, email1, email2 in \
... session... | If you so desire, you can use a decorator here. It will stand out to someone looking through your code to see the interface, and you don't have to explicitly `return self` from every function (which could be annoying if you have multiple exit points).
```
import functools
def fluent(func):
@functools.wraps(func)
... |
36,250,990 | I have a class that represents object. And I have a bunch of methods which modify this object state with no obvious return or obviously without any return. In C# I would declare all these methods as `void` and see no alternatives. But in Python I am about to make all the methods `return self` to give myself ability to ... | 2016/03/27 | [
"https://Stackoverflow.com/questions/36250990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5947296/"
] | Here is a mail from Guido van Rossum (the author of the Python programming language) about this topic: <https://mail.python.org/pipermail/python-dev/2003-October/038855.html>
>
> I'd like to explain once more why I'm so adamant that sort() shouldn't
> return 'self'.
>
>
> This comes from a coding style (popular in... | If you so desire, you can use a decorator here. It will stand out to someone looking through your code to see the interface, and you don't have to explicitly `return self` from every function (which could be annoying if you have multiple exit points).
```
import functools
def fluent(func):
@functools.wraps(func)
... |
44,277 | I'm building an Online Food Ordering website, where users can order food from their favourite restaurants. I'm confused in selecting the colors for the website, can any one help me with it.
1. Which colors should I use for website background or should I put delicious food images?
2. Which colors to use for the text?
... | 2013/08/28 | [
"https://ux.stackexchange.com/questions/44277",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35092/"
] | >
> Which colors should I use for website background or should I put delicious food images?
>
>
>
The answers to this question finally enlightened me why so many food sites go for that red & white design. Personally, I'm finding it quite boring, and I go to view a menu when I **want** to eat anyway so they don't n... | There is a lot of study on the subject of food and colour, it turns out that colour has a very strong effect on how we perceive food. Some choice examples from this research:
Test subjects will judge a liquid based on it's colour, even when the actual flavour dose not match up. A classic 80s experiment switched lime a... |
44,277 | I'm building an Online Food Ordering website, where users can order food from their favourite restaurants. I'm confused in selecting the colors for the website, can any one help me with it.
1. Which colors should I use for website background or should I put delicious food images?
2. Which colors to use for the text?
... | 2013/08/28 | [
"https://ux.stackexchange.com/questions/44277",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35092/"
] | Your best friend: <https://kuler.adobe.com/food-art-colors/>
You can search color pallets via keywords such as the one I have placed in the URL strand above. | There is a lot of study on the subject of food and colour, it turns out that colour has a very strong effect on how we perceive food. Some choice examples from this research:
Test subjects will judge a liquid based on it's colour, even when the actual flavour dose not match up. A classic 80s experiment switched lime a... |
44,277 | I'm building an Online Food Ordering website, where users can order food from their favourite restaurants. I'm confused in selecting the colors for the website, can any one help me with it.
1. Which colors should I use for website background or should I put delicious food images?
2. Which colors to use for the text?
... | 2013/08/28 | [
"https://ux.stackexchange.com/questions/44277",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35092/"
] | >
> Which colors should I use for website background or should I put delicious food images?
>
>
>
The answers to this question finally enlightened me why so many food sites go for that red & white design. Personally, I'm finding it quite boring, and I go to view a menu when I **want** to eat anyway so they don't n... | For starters, I recommend looking at the answers to this question, [which colors make you hungry](https://ux.stackexchange.com/questions/14239/which-colors-make-you-hungry) as that can give you some inputs about what colors to for your site assuming you already dont have a defined branding guideline in place.
With reg... |
44,277 | I'm building an Online Food Ordering website, where users can order food from their favourite restaurants. I'm confused in selecting the colors for the website, can any one help me with it.
1. Which colors should I use for website background or should I put delicious food images?
2. Which colors to use for the text?
... | 2013/08/28 | [
"https://ux.stackexchange.com/questions/44277",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35092/"
] | Your best friend: <https://kuler.adobe.com/food-art-colors/>
You can search color pallets via keywords such as the one I have placed in the URL strand above. | For starters, I recommend looking at the answers to this question, [which colors make you hungry](https://ux.stackexchange.com/questions/14239/which-colors-make-you-hungry) as that can give you some inputs about what colors to for your site assuming you already dont have a defined branding guideline in place.
With reg... |
44,277 | I'm building an Online Food Ordering website, where users can order food from their favourite restaurants. I'm confused in selecting the colors for the website, can any one help me with it.
1. Which colors should I use for website background or should I put delicious food images?
2. Which colors to use for the text?
... | 2013/08/28 | [
"https://ux.stackexchange.com/questions/44277",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35092/"
] | >
> Which colors should I use for website background or should I put delicious food images?
>
>
>
The answers to this question finally enlightened me why so many food sites go for that red & white design. Personally, I'm finding it quite boring, and I go to view a menu when I **want** to eat anyway so they don't n... | Your best friend: <https://kuler.adobe.com/food-art-colors/>
You can search color pallets via keywords such as the one I have placed in the URL strand above. |
5,076,194 | I need to change the color of a scrollbar button when the mouse moves over it which is at top and bottom (left and right) of scrollbar. How can I change it in WebKit? When I use hover, it is not working. Please help me. | 2011/02/22 | [
"https://Stackoverflow.com/questions/5076194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/573826/"
] | You may or may not be able to change the hover styles on scrollbar buttons as this is browser-dependent. ~~Namely, no known browser has hover styles for scrollbar buttons.~~
**EDIT:** thirtydot points out that scrollbar button hover styles are on their way to WebKit's implementation; see his comment for a demo. | You specifically said "how can i change it in webkit", so:
An older answer of mine: [Apple-like scrollbars using CSS](https://stackoverflow.com/questions/4641169/apple-like-scrollbars-using-css)
>
> Apple's version: <http://help.apple.com/mobileme/index.html#mm5b08c671>
>
>
> [***Live Demo***](http://jsfiddle.net/... |
5,076,194 | I need to change the color of a scrollbar button when the mouse moves over it which is at top and bottom (left and right) of scrollbar. How can I change it in WebKit? When I use hover, it is not working. Please help me. | 2011/02/22 | [
"https://Stackoverflow.com/questions/5076194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/573826/"
] | You may or may not be able to change the hover styles on scrollbar buttons as this is browser-dependent. ~~Namely, no known browser has hover styles for scrollbar buttons.~~
**EDIT:** thirtydot points out that scrollbar button hover styles are on their way to WebKit's implementation; see his comment for a demo. | So, is possible to change color on a scrollbar, but u have to consider that most browser don't like these css..
```
body {scrollbar-3dlight-color:#ffd700;
scrollbar-arrow-color:#ff0;
scrollbar-base-color:#ff6347;
scrollbar-darkshadow-color:#ffa500;
scrollbar-face-color:#008080;
scrollbar-highlight-color:#ff69b4; ... |
5,076,194 | I need to change the color of a scrollbar button when the mouse moves over it which is at top and bottom (left and right) of scrollbar. How can I change it in WebKit? When I use hover, it is not working. Please help me. | 2011/02/22 | [
"https://Stackoverflow.com/questions/5076194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/573826/"
] | You specifically said "how can i change it in webkit", so:
An older answer of mine: [Apple-like scrollbars using CSS](https://stackoverflow.com/questions/4641169/apple-like-scrollbars-using-css)
>
> Apple's version: <http://help.apple.com/mobileme/index.html#mm5b08c671>
>
>
> [***Live Demo***](http://jsfiddle.net/... | So, is possible to change color on a scrollbar, but u have to consider that most browser don't like these css..
```
body {scrollbar-3dlight-color:#ffd700;
scrollbar-arrow-color:#ff0;
scrollbar-base-color:#ff6347;
scrollbar-darkshadow-color:#ffa500;
scrollbar-face-color:#008080;
scrollbar-highlight-color:#ff69b4; ... |
14,734,535 | With the following code, I can access the row of a pointer to a matrix:
```
#include <iostream>
int main(void) {
const int size = 10;
float **mat = new float*[size];
int i,j;
for (i = 0; i != size; ++i) {
mat[i] = new float[size];
for (j = 0; j != size; ++j) {
mat[i][j] = i ... | 2013/02/06 | [
"https://Stackoverflow.com/questions/14734535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Well, if you want to access the elements of a *row* (not column, which is what you are already accessing) that should be simple:
```
for (i = 0; i != size; ++i)
{
std::cout << mat[i][size - 1] << " ";
}
```
Btw, your code is leaking, because you allocate memory that you never release. | Elements in a column are not guaranteed to be one after the other in memory... |
33,264,210 | Is it more efficient to leave the WHERE clause out in the 2nd SUB-SELECT. Works both ways but I am looking for most efficient way with this SQL statement...
There are many records and values for substr(FIELD\_G,10,3) in table 2 t2 so I am nor sure if I should filter that out in the 2nd SUB-SELECT first before left joi... | 2015/10/21 | [
"https://Stackoverflow.com/questions/33264210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5139409/"
] | We're using CKAN at the Natural History Museum (data.nhm.ac.uk) for some pretty hefty research datasets - our main specimen collection has 2.8 million records - and it's handling it very well. We have had to extend CKAN with some custom plugins to make this possible though - but they're open source and available on Git... | Yes :)
But there are extensions to use or build.
Take a look at the extensions built for CKAN Galleries (<http://datashades.com/ckan-galleries/>). We built that specifically for image and video assets that are referenced in the record level of a dataset resource.
There is an S3 cloud connector for object storage if... |
26,814,188 | I'm using rails 4.1.4 and ruby-2.1.1. My Gemfile :
```
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'
# Use mysql as the database for Active Record
gem 'mysql2'
gem 'devise'
gem "paperclip", "~> 4.2"
gem 'aws-sdk'
gem 'bootstrap-sass-rails'
gem 'bo... | 2014/11/08 | [
"https://Stackoverflow.com/questions/26814188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3083848/"
] | Try this:
```
gem 'therubyracer', :platform => :ruby
``` | As I see from your error traceback, you have Ruby 1.8 installed (OS default). Ruby on Rails 4.1 requires at least Ruby 1.9.3. So you can use [RVM](http://rvm.io) to install newer Ruby version. Then you'll be able to install all required gems. And using RVM or rbenv is recommended way to manage rubies nowadays. |
51,988,934 | ```
package main
import (
"encoding/json"
"fmt"
)
type InnerData struct {
M int64 `josn:"m"`
N int64 `json:"n"`
}
//JSONData is a json data example
type JSONData struct {
Hello string `json:"hello"`
Data InnerData `json:"data"`
}
func main() {
v := JSONData{Hello: "world", Data: Inne... | 2018/08/23 | [
"https://Stackoverflow.com/questions/51988934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1419057/"
] | Silly mistake in the tag declaration with the spelling of `json` as `josn`
```
type InnerData struct {
M int64 `josn:"m"` // the spelling is not correct for json.
N int64 `json:"n"`
}
```
Change the tag for field M as
```
type InnerData struct {
M int64 `json:"m"` // the spelling is not correct for jso... | You have typos in your code:
In your `InnerData`, you put `josn` instead of `json`.
Fix those typos and try again. |
90,976 | I am 90 % sure the drive is fine :-( - Was copying data from it yesterday.
Lent the drive from a mate to copy data, now it can't be found, plugging in and out no change - **AAAHHH** he is going to KILL me. Please help :-) | 2011/12/28 | [
"https://askubuntu.com/questions/90976",
"https://askubuntu.com",
"https://askubuntu.com/users/23063/"
] | Here is the Ubuntu official guide to automounting USB:
<https://help.ubuntu.com/community/Mount/USB>
If you have Ubuntu 10.04 Lucid Lynx, maybe you can take a look at this guide here:
<http://www.webupd8.org/2010/05/fix-usb-devices-automount-not-working.html>
You can also try to use Disk Utility, available in the U... | Try this also: This has something to do with the BIOS and floppy drives.
<http://www.webupd8.org/2010/05/fix-usb-devices-automount-not-working.html>
This worked for me when nothing else did. I tried:
```
sudo apt-get install dconf-tools
dconf-editor
sudo apt-get install usbmount
pmount
```
Finally I did modprobe a... |
90,976 | I am 90 % sure the drive is fine :-( - Was copying data from it yesterday.
Lent the drive from a mate to copy data, now it can't be found, plugging in and out no change - **AAAHHH** he is going to KILL me. Please help :-) | 2011/12/28 | [
"https://askubuntu.com/questions/90976",
"https://askubuntu.com",
"https://askubuntu.com/users/23063/"
] | Here is the Ubuntu official guide to automounting USB:
<https://help.ubuntu.com/community/Mount/USB>
If you have Ubuntu 10.04 Lucid Lynx, maybe you can take a look at this guide here:
<http://www.webupd8.org/2010/05/fix-usb-devices-automount-not-working.html>
You can also try to use Disk Utility, available in the U... | The link first suggested under "Ubuntu official guide to automounting USB" suggests
>
> Disks (the GNOME disk utility) that lists drives, including USB
> drives. If you click a drive on the list, you can view its details,
> and can click the triangle-shaped button (Play button) to mount the
> drive.
>
>
>
This... |
90,976 | I am 90 % sure the drive is fine :-( - Was copying data from it yesterday.
Lent the drive from a mate to copy data, now it can't be found, plugging in and out no change - **AAAHHH** he is going to KILL me. Please help :-) | 2011/12/28 | [
"https://askubuntu.com/questions/90976",
"https://askubuntu.com",
"https://askubuntu.com/users/23063/"
] | The link first suggested under "Ubuntu official guide to automounting USB" suggests
>
> Disks (the GNOME disk utility) that lists drives, including USB
> drives. If you click a drive on the list, you can view its details,
> and can click the triangle-shaped button (Play button) to mount the
> drive.
>
>
>
This... | Try this also: This has something to do with the BIOS and floppy drives.
<http://www.webupd8.org/2010/05/fix-usb-devices-automount-not-working.html>
This worked for me when nothing else did. I tried:
```
sudo apt-get install dconf-tools
dconf-editor
sudo apt-get install usbmount
pmount
```
Finally I did modprobe a... |
55,838 | The main form of my webapp looks like this:

With the next colors:
```
Background color...: #F4F9FD
Tittle color.......: #3C325C
Button color.......: #DE373D
```
Why do forms usually appears within a box? Does it improves the user experience? How?... | 2014/04/16 | [
"https://ux.stackexchange.com/questions/55838",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/33280/"
] | Visually the box provides a grouping of the elements - Grouping the form fields, making them distinct from the rest of the content. Working on the gestalt principle of closure.
That box is usually the fieldset element of the HTML. It's not clear from your example, but fieldsets usually go around related elements, so y... | Boxes help to group UI elements. When displayed on a page with many distractions from other elements it can be hard to see what element goes with what element. It can result in people not filling out the entire form.
A box can also help to make the user feel more secure when filling in the form. It's proven that when ... |
55,838 | The main form of my webapp looks like this:

With the next colors:
```
Background color...: #F4F9FD
Tittle color.......: #3C325C
Button color.......: #DE373D
```
Why do forms usually appears within a box? Does it improves the user experience? How?... | 2014/04/16 | [
"https://ux.stackexchange.com/questions/55838",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/33280/"
] | It can either be a matter of the context or simply a choice of visual style. If the form is displayed in the same context as other elements on the view (promotion message, login form, etc.) it can be a good idea to frame it in order to visually map it as a unity to the user and yield closure of completion. This is the ... | Visually the box provides a grouping of the elements - Grouping the form fields, making them distinct from the rest of the content. Working on the gestalt principle of closure.
That box is usually the fieldset element of the HTML. It's not clear from your example, but fieldsets usually go around related elements, so y... |
55,838 | The main form of my webapp looks like this:

With the next colors:
```
Background color...: #F4F9FD
Tittle color.......: #3C325C
Button color.......: #DE373D
```
Why do forms usually appears within a box? Does it improves the user experience? How?... | 2014/04/16 | [
"https://ux.stackexchange.com/questions/55838",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/33280/"
] | Visually the box provides a grouping of the elements - Grouping the form fields, making them distinct from the rest of the content. Working on the gestalt principle of closure.
That box is usually the fieldset element of the HTML. It's not clear from your example, but fieldsets usually go around related elements, so y... | This is a question that can possibly related to Gestalt grouping.
<http://en.wikipedia.org/wiki/Principles_of_grouping>
The box simply is a way, visually, to tie elements together. There are multiple ways of grouping elements but I think the most common we see is proximity and using elements to create visual containe... |
55,838 | The main form of my webapp looks like this:

With the next colors:
```
Background color...: #F4F9FD
Tittle color.......: #3C325C
Button color.......: #DE373D
```
Why do forms usually appears within a box? Does it improves the user experience? How?... | 2014/04/16 | [
"https://ux.stackexchange.com/questions/55838",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/33280/"
] | It can either be a matter of the context or simply a choice of visual style. If the form is displayed in the same context as other elements on the view (promotion message, login form, etc.) it can be a good idea to frame it in order to visually map it as a unity to the user and yield closure of completion. This is the ... | Boxes help to group UI elements. When displayed on a page with many distractions from other elements it can be hard to see what element goes with what element. It can result in people not filling out the entire form.
A box can also help to make the user feel more secure when filling in the form. It's proven that when ... |
55,838 | The main form of my webapp looks like this:

With the next colors:
```
Background color...: #F4F9FD
Tittle color.......: #3C325C
Button color.......: #DE373D
```
Why do forms usually appears within a box? Does it improves the user experience? How?... | 2014/04/16 | [
"https://ux.stackexchange.com/questions/55838",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/33280/"
] | This is a question that can possibly related to Gestalt grouping.
<http://en.wikipedia.org/wiki/Principles_of_grouping>
The box simply is a way, visually, to tie elements together. There are multiple ways of grouping elements but I think the most common we see is proximity and using elements to create visual containe... | Boxes help to group UI elements. When displayed on a page with many distractions from other elements it can be hard to see what element goes with what element. It can result in people not filling out the entire form.
A box can also help to make the user feel more secure when filling in the form. It's proven that when ... |
55,838 | The main form of my webapp looks like this:

With the next colors:
```
Background color...: #F4F9FD
Tittle color.......: #3C325C
Button color.......: #DE373D
```
Why do forms usually appears within a box? Does it improves the user experience? How?... | 2014/04/16 | [
"https://ux.stackexchange.com/questions/55838",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/33280/"
] | It can either be a matter of the context or simply a choice of visual style. If the form is displayed in the same context as other elements on the view (promotion message, login form, etc.) it can be a good idea to frame it in order to visually map it as a unity to the user and yield closure of completion. This is the ... | This is a question that can possibly related to Gestalt grouping.
<http://en.wikipedia.org/wiki/Principles_of_grouping>
The box simply is a way, visually, to tie elements together. There are multiple ways of grouping elements but I think the most common we see is proximity and using elements to create visual containe... |
76,721 | What size metric wire is required from a 240 VAC 30 Amps breaker located in house with run of 90M or <100 feet to a garage for washer, drier, fridge and lighting on 3 X 10 amp and 1 X 5 amp breakers located in the garage. And, please give me the URL for a good conversion site, Thanks. | 2015/10/23 | [
"https://diy.stackexchange.com/questions/76721",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/44848/"
] | In the US, a 30 ampere circuit would use 10 AWG conductors. 10 AWG is 5.261 mm². However, if you're going 90 meters (295 feet), you might have to compensate for voltage drop. You might go up to 8 AWG (8.367 mm²), or possibly even 6 AWG (13.3 mm²).
These figures are based on codes in the US, so you'll have to check loc... | Based on [BS7671](https://en.wikipedia.org/wiki/BS_7671), for a 5% voltage drop, with cable in conduit, you need 16mm² according to the calculator at <http://www.doncastercables.com/technical-help/> but it depends on the cable type as well.
The calculator at <http://myelectrical.com/tools/cable-sizing-calculator> sugg... |
49,233,464 | I'm using Wordpress and the Woocommerce plugin. Further I have WPML Plugin installed for 4 languages. Additionally I'm using an Ionic 2 App, which is connected to the Shop with WP Rest API. I would like now to get the categories in the translated languages in the app. Following is the code to get the categories. I trie... | 2018/03/12 | [
"https://Stackoverflow.com/questions/49233464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4193689/"
] | Just in case anyone else hits this problem, which I'm guessing they will given the issue is with iOS Google Authenticator, I solved the problem by string replacing the trailing = characters with base 32 encodable characters | According the Google Authenticator repo (<https://github.com/google/google-authenticator/wiki/Key-Uri-Format#algorithm>), the padding (i.e. the = signs should be omitted from the `secret` parameter.
>
> REQUIRED: The secret parameter is an arbitrary key value encoded in Base32 according to RFC 3548. The padding speci... |
44,244 | I usually use XMonad as window manager. When playing around with GUI programming I sometimes just want to see how the windows would look under Compiz for example.
So is it possible to run another window manager, say Compiz, on a specific workspace under XMonad? | 2012/07/29 | [
"https://unix.stackexchange.com/questions/44244",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/5289/"
] | Nested X11 sessions are possible with [Xephyr](http://www.freedesktop.org/wiki/Software/Xephyr), see this example [from the wikipedia page](http://en.wikipedia.org/wiki/Xephyr):

This is independent of the "base" WM (XMonad), since it's... | Alternatively you can start another session from your login manager (while your main session keeps alive) and login as another user configured to use the window manager of your choice.
`LightDM` and `GDM` allow for that, and maybe other login manager. You can then switch back to your original session with `Ctrl``Alt`... |
30,570,234 | Given an array of size n, **for each k from 1 to n**, find the maximum sum of contiguous subarray of size k.
This problem has an obvious solution with time complexity O(N2) and O(1) space. Lua code:
```
array = {7, 1, 3, 1, 4, 5, 1, 3, 6}
n = #array
function maxArray(k)
ksum = 0
for i = 1, k do
ksum ... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30570234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1293417/"
] | An Efficient Solution is based on the fact that sum of a subarray (or window) of size k can be obtained in O(1) time using the sum of previous subarray (or window) of size k. Except the first subarray of size k, for other subarrays, we compute sum by removing the first element of the last window and adding the last ele... | I don't think there is a more efficient solution than O(N²) if you don't add any other constraint. In other words, there is no other way to decide you have found the maximum-sum subarray but to explore all the other subarrays.
Thus the least-complex solution comprises O(N²/2) which is the overall number of contiguous ... |
30,570,234 | Given an array of size n, **for each k from 1 to n**, find the maximum sum of contiguous subarray of size k.
This problem has an obvious solution with time complexity O(N2) and O(1) space. Lua code:
```
array = {7, 1, 3, 1, 4, 5, 1, 3, 6}
n = #array
function maxArray(k)
ksum = 0
for i = 1, k do
ksum ... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30570234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1293417/"
] | An Efficient Solution is based on the fact that sum of a subarray (or window) of size k can be obtained in O(1) time using the sum of previous subarray (or window) of size k. Except the first subarray of size k, for other subarrays, we compute sum by removing the first element of the last window and adding the last ele... | ```
The above question can be solved by O(n).
Please try this algorithm.
lets say k=3.
array = {7, 1, 3, 1, 4, 5, 1, 3, 6}
maxsum=0.
1)We start with adding 7+1+3 and store sum=11.since sum >maxsum.maxsum=11.
2)Now since size of k=3,next continuous array is 1+3+1.so how we get this sum??
remo... |
30,570,234 | Given an array of size n, **for each k from 1 to n**, find the maximum sum of contiguous subarray of size k.
This problem has an obvious solution with time complexity O(N2) and O(1) space. Lua code:
```
array = {7, 1, 3, 1, 4, 5, 1, 3, 6}
n = #array
function maxArray(k)
ksum = 0
for i = 1, k do
ksum ... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30570234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1293417/"
] | An Efficient Solution is based on the fact that sum of a subarray (or window) of size k can be obtained in O(1) time using the sum of previous subarray (or window) of size k. Except the first subarray of size k, for other subarrays, we compute sum by removing the first element of the last window and adding the last ele... | below process might help you
1) Pick first k elements and create a Self-Balancing Binary Search Tree (BST) of size k.
2) Run a loop for i = 0 to n – k
…..a) Get the maximum element from the BST, and print it.
…..b) Search for arr[i] in the BST and delete it from the BST.
…..c) Insert arr[i+k] into the BST.
Time C... |
30,570,234 | Given an array of size n, **for each k from 1 to n**, find the maximum sum of contiguous subarray of size k.
This problem has an obvious solution with time complexity O(N2) and O(1) space. Lua code:
```
array = {7, 1, 3, 1, 4, 5, 1, 3, 6}
n = #array
function maxArray(k)
ksum = 0
for i = 1, k do
ksum ... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30570234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1293417/"
] | An Efficient Solution is based on the fact that sum of a subarray (or window) of size k can be obtained in O(1) time using the sum of previous subarray (or window) of size k. Except the first subarray of size k, for other subarrays, we compute sum by removing the first element of the last window and adding the last ele... | The problem can be reduced to min-sum convultion, see section 2.4 (MCSP) in <https://core.ac.uk/download/pdf/84869149.pdf>. Therefore, currently the best complexity you can expect is probably O(n^2/polylog(n)). |
30,570,234 | Given an array of size n, **for each k from 1 to n**, find the maximum sum of contiguous subarray of size k.
This problem has an obvious solution with time complexity O(N2) and O(1) space. Lua code:
```
array = {7, 1, 3, 1, 4, 5, 1, 3, 6}
n = #array
function maxArray(k)
ksum = 0
for i = 1, k do
ksum ... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30570234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1293417/"
] | ```
int maxCrossingSum(int arr[], int l, int m, int h)
{
// Include elements on left of mid.
int sum = 0;
int left_sum = INT_MIN;
for (int i = m; i >= l; i--)
{
sum = sum + arr[i];
if (sum > left_sum)
left_sum = sum;
}
// Include elements on right of mid... | below process might help you
1) Pick first k elements and create a Self-Balancing Binary Search Tree (BST) of size k.
2) Run a loop for i = 0 to n – k
…..a) Get the maximum element from the BST, and print it.
…..b) Search for arr[i] in the BST and delete it from the BST.
…..c) Insert arr[i+k] into the BST.
Time C... |
30,570,234 | Given an array of size n, **for each k from 1 to n**, find the maximum sum of contiguous subarray of size k.
This problem has an obvious solution with time complexity O(N2) and O(1) space. Lua code:
```
array = {7, 1, 3, 1, 4, 5, 1, 3, 6}
n = #array
function maxArray(k)
ksum = 0
for i = 1, k do
ksum ... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30570234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1293417/"
] | The problem can be reduced to min-sum convultion, see section 2.4 (MCSP) in <https://core.ac.uk/download/pdf/84869149.pdf>. Therefore, currently the best complexity you can expect is probably O(n^2/polylog(n)). | below process might help you
1) Pick first k elements and create a Self-Balancing Binary Search Tree (BST) of size k.
2) Run a loop for i = 0 to n – k
…..a) Get the maximum element from the BST, and print it.
…..b) Search for arr[i] in the BST and delete it from the BST.
…..c) Insert arr[i+k] into the BST.
Time C... |
30,570,234 | Given an array of size n, **for each k from 1 to n**, find the maximum sum of contiguous subarray of size k.
This problem has an obvious solution with time complexity O(N2) and O(1) space. Lua code:
```
array = {7, 1, 3, 1, 4, 5, 1, 3, 6}
n = #array
function maxArray(k)
ksum = 0
for i = 1, k do
ksum ... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30570234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1293417/"
] | The problem can be reduced to min-sum convultion, see section 2.4 (MCSP) in <https://core.ac.uk/download/pdf/84869149.pdf>. Therefore, currently the best complexity you can expect is probably O(n^2/polylog(n)). | I don't think there is a more efficient solution than O(N²) if you don't add any other constraint. In other words, there is no other way to decide you have found the maximum-sum subarray but to explore all the other subarrays.
Thus the least-complex solution comprises O(N²/2) which is the overall number of contiguous ... |
30,570,234 | Given an array of size n, **for each k from 1 to n**, find the maximum sum of contiguous subarray of size k.
This problem has an obvious solution with time complexity O(N2) and O(1) space. Lua code:
```
array = {7, 1, 3, 1, 4, 5, 1, 3, 6}
n = #array
function maxArray(k)
ksum = 0
for i = 1, k do
ksum ... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30570234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1293417/"
] | The problem can be reduced to min-sum convultion, see section 2.4 (MCSP) in <https://core.ac.uk/download/pdf/84869149.pdf>. Therefore, currently the best complexity you can expect is probably O(n^2/polylog(n)). | We create a Dequeue, Qi of capacity k, that stores only useful elements of current window of k elements. An element is useful if it is in current window and is greater than all other elements on left side of it in current window. We process all array elements one by one and maintain Qi to contain useful elements of cur... |
30,570,234 | Given an array of size n, **for each k from 1 to n**, find the maximum sum of contiguous subarray of size k.
This problem has an obvious solution with time complexity O(N2) and O(1) space. Lua code:
```
array = {7, 1, 3, 1, 4, 5, 1, 3, 6}
n = #array
function maxArray(k)
ksum = 0
for i = 1, k do
ksum ... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30570234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1293417/"
] | I don't think there is a more efficient solution than O(N²) if you don't add any other constraint. In other words, there is no other way to decide you have found the maximum-sum subarray but to explore all the other subarrays.
Thus the least-complex solution comprises O(N²/2) which is the overall number of contiguous ... | below process might help you
1) Pick first k elements and create a Self-Balancing Binary Search Tree (BST) of size k.
2) Run a loop for i = 0 to n – k
…..a) Get the maximum element from the BST, and print it.
…..b) Search for arr[i] in the BST and delete it from the BST.
…..c) Insert arr[i+k] into the BST.
Time C... |
30,570,234 | Given an array of size n, **for each k from 1 to n**, find the maximum sum of contiguous subarray of size k.
This problem has an obvious solution with time complexity O(N2) and O(1) space. Lua code:
```
array = {7, 1, 3, 1, 4, 5, 1, 3, 6}
n = #array
function maxArray(k)
ksum = 0
for i = 1, k do
ksum ... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30570234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1293417/"
] | The problem can be reduced to min-sum convultion, see section 2.4 (MCSP) in <https://core.ac.uk/download/pdf/84869149.pdf>. Therefore, currently the best complexity you can expect is probably O(n^2/polylog(n)). | ```
int maxCrossingSum(int arr[], int l, int m, int h)
{
// Include elements on left of mid.
int sum = 0;
int left_sum = INT_MIN;
for (int i = m; i >= l; i--)
{
sum = sum + arr[i];
if (sum > left_sum)
left_sum = sum;
}
// Include elements on right of mid... |
6,676,191 | how can i get current time From Internet (External Resource - Not From Server)?
**Edited**
For Example From the Below WebSite :
<http://www.timeanddate.com/worldclock>
**Reason**
i will redirect my pages to a Lock page after one month (by checking DateTime.Now) and in that page user should input activati... | 2011/07/13 | [
"https://Stackoverflow.com/questions/6676191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268588/"
] | You can't, not by using `DateTime.Now`. It is a property of the `DateTime` structure that can't be overridden.
You can use an [NTP server](http://www.ntp.org/) to get time (though there is not support in the BCL for one). | You can get the DateTime using JavaScript
```
myDate = new Date();
myday = myDate.getDay();
mymonth = myDate.getMonth();
myweekday= myDate.getDate();
```
Check this article to [javascript date and time object](http://www.tizag.com/javascriptT/javascriptdate.php)
and look at this as well [JavaScript ... |
6,676,191 | how can i get current time From Internet (External Resource - Not From Server)?
**Edited**
For Example From the Below WebSite :
<http://www.timeanddate.com/worldclock>
**Reason**
i will redirect my pages to a Lock page after one month (by checking DateTime.Now) and in that page user should input activati... | 2011/07/13 | [
"https://Stackoverflow.com/questions/6676191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268588/"
] | I think this will help you out of it.Apply the below mentioned code for retrieving the date from Internet.
```
public static DateTime GetFastestNISTDate()
{
var result = DateTime.MinValue;
// Initialize the list of NIST time servers
// http://tf.nist.gov/tf-cgi/servers.cgi
string[] servers = new strin... | You can get the DateTime using JavaScript
```
myDate = new Date();
myday = myDate.getDay();
mymonth = myDate.getMonth();
myweekday= myDate.getDate();
```
Check this article to [javascript date and time object](http://www.tizag.com/javascriptT/javascriptdate.php)
and look at this as well [JavaScript ... |
6,676,191 | how can i get current time From Internet (External Resource - Not From Server)?
**Edited**
For Example From the Below WebSite :
<http://www.timeanddate.com/worldclock>
**Reason**
i will redirect my pages to a Lock page after one month (by checking DateTime.Now) and in that page user should input activati... | 2011/07/13 | [
"https://Stackoverflow.com/questions/6676191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268588/"
] | You can't, not by using `DateTime.Now`. It is a property of the `DateTime` structure that can't be overridden.
You can use an [NTP server](http://www.ntp.org/) to get time (though there is not support in the BCL for one). | Why not use a HttpRequest to query the RSS feed of [a site](http://www.worldtimeserver.com/) which gives world time? Is this what you mean? |
6,676,191 | how can i get current time From Internet (External Resource - Not From Server)?
**Edited**
For Example From the Below WebSite :
<http://www.timeanddate.com/worldclock>
**Reason**
i will redirect my pages to a Lock page after one month (by checking DateTime.Now) and in that page user should input activati... | 2011/07/13 | [
"https://Stackoverflow.com/questions/6676191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268588/"
] | I think this will help you out of it.Apply the below mentioned code for retrieving the date from Internet.
```
public static DateTime GetFastestNISTDate()
{
var result = DateTime.MinValue;
// Initialize the list of NIST time servers
// http://tf.nist.gov/tf-cgi/servers.cgi
string[] servers = new strin... | Why not use a HttpRequest to query the RSS feed of [a site](http://www.worldtimeserver.com/) which gives world time? Is this what you mean? |
6,676,191 | how can i get current time From Internet (External Resource - Not From Server)?
**Edited**
For Example From the Below WebSite :
<http://www.timeanddate.com/worldclock>
**Reason**
i will redirect my pages to a Lock page after one month (by checking DateTime.Now) and in that page user should input activati... | 2011/07/13 | [
"https://Stackoverflow.com/questions/6676191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268588/"
] | You can't, not by using `DateTime.Now`. It is a property of the `DateTime` structure that can't be overridden.
You can use an [NTP server](http://www.ntp.org/) to get time (though there is not support in the BCL for one). | Why would you want to get it from the internet, you would still be getting it from someone's sever. |
6,676,191 | how can i get current time From Internet (External Resource - Not From Server)?
**Edited**
For Example From the Below WebSite :
<http://www.timeanddate.com/worldclock>
**Reason**
i will redirect my pages to a Lock page after one month (by checking DateTime.Now) and in that page user should input activati... | 2011/07/13 | [
"https://Stackoverflow.com/questions/6676191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268588/"
] | I think this will help you out of it.Apply the below mentioned code for retrieving the date from Internet.
```
public static DateTime GetFastestNISTDate()
{
var result = DateTime.MinValue;
// Initialize the list of NIST time servers
// http://tf.nist.gov/tf-cgi/servers.cgi
string[] servers = new strin... | You can't, not by using `DateTime.Now`. It is a property of the `DateTime` structure that can't be overridden.
You can use an [NTP server](http://www.ntp.org/) to get time (though there is not support in the BCL for one). |
6,676,191 | how can i get current time From Internet (External Resource - Not From Server)?
**Edited**
For Example From the Below WebSite :
<http://www.timeanddate.com/worldclock>
**Reason**
i will redirect my pages to a Lock page after one month (by checking DateTime.Now) and in that page user should input activati... | 2011/07/13 | [
"https://Stackoverflow.com/questions/6676191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268588/"
] | I think this will help you out of it.Apply the below mentioned code for retrieving the date from Internet.
```
public static DateTime GetFastestNISTDate()
{
var result = DateTime.MinValue;
// Initialize the list of NIST time servers
// http://tf.nist.gov/tf-cgi/servers.cgi
string[] servers = new strin... | Why would you want to get it from the internet, you would still be getting it from someone's sever. |
48,049,106 | I have two tables called Product and Unit, FieldID UnitID is a common field between the two tables.
In the form in which the product table is patched, there is a combo box that, when we give it, returns the UnitID value from the Unit table to the point where we have no problem.
My problem is when this Cambodox box is c... | 2018/01/01 | [
"https://Stackoverflow.com/questions/48049106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9160285/"
] | You have to use textarea in that case. Try this:
```
<div class="input-group">
<label>Some input</label>
<textarea name="var_1" rows="5" cols="10" wrap="soft"></textarea>
</div>
```
you can change number of row and cols to customize textarea input field size. | YES, TextArea is the only way that is featured by HTML for multiple-line input.
Refer doc :: [TextArea Doc by HTML](https://html.com/tags/textarea/) for more information
Thanks. |
68,242,465 | I have a over 100 mb csv file that i would like to upload to github using lfs. However, i am facing this issue (Screenshot added). I have put the csv file in the local folder where the repository is located.
[enter image description here](https://i.stack.imgur.com/WH0a1.png) | 2021/07/04 | [
"https://Stackoverflow.com/questions/68242465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16375610/"
] | Give searchbar `z-index:50` and `z-index:10` to sidebar. This way searchbar will stay beneath the sidebar. | Add margin-left = width-of-nav whenever nav is visible(non-collapsible mode).
If you simply want the nav bar on top and the search bar to be not used then use`overflow: hidden` style to search bar/entire page content except nav.
Other way is to add `z-index` to change the stacking order. |
68,242,465 | I have a over 100 mb csv file that i would like to upload to github using lfs. However, i am facing this issue (Screenshot added). I have put the csv file in the local folder where the repository is located.
[enter image description here](https://i.stack.imgur.com/WH0a1.png) | 2021/07/04 | [
"https://Stackoverflow.com/questions/68242465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16375610/"
] | Give searchbar `z-index:50` and `z-index:10` to sidebar. This way searchbar will stay beneath the sidebar. | navbar :
position:'sticky'
main:
z-index:100 |
4,145,531 | I am running a website, and there is a scoring system that gives you points for the number of times you play a game.
It uses hashing to prove the integrity of http request for scoring so users cannot change anything, however as I feared might happen, someone figured out that they didn't need to change it, they just ne... | 2010/11/10 | [
"https://Stackoverflow.com/questions/4145531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | It's actually quite easy to do... There are some libraries out there to do it for you:
1. [PHP Nonce Library](http://fullthrottledevelopment.com/php-nonce-library)
2. [OpenID Nonce Library](http://shupp.org/openiddoc/__filesource/fsource_OpenID__OpenIDNonce.php.html)
Or if you want to write your own, it's pretty simp... | One option (which I mentioned in comment) is recording gameplay and replay it in secure environment.
The other thing is to randomly, or at some specified times, record some seemingly innocent data, which later can be used to validate it on server (like suddenly live goes from 1% to 100%, or score from 1 to 1000 which ... |
4,145,531 | I am running a website, and there is a scoring system that gives you points for the number of times you play a game.
It uses hashing to prove the integrity of http request for scoring so users cannot change anything, however as I feared might happen, someone figured out that they didn't need to change it, they just ne... | 2010/11/10 | [
"https://Stackoverflow.com/questions/4145531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | One option (which I mentioned in comment) is recording gameplay and replay it in secure environment.
The other thing is to randomly, or at some specified times, record some seemingly innocent data, which later can be used to validate it on server (like suddenly live goes from 1% to 100%, or score from 1 to 1000 which ... | It is not possible to prevent cheating. You can only make it more difficult.
If someone came here looking for a PHP Nonce Library: I recommend not using [the first one given by ircmaxwell](http://fullthrottledevelopment.com/php-nonce-library "the first one given by ircmaxwell").
The first comment on the website desc... |
4,145,531 | I am running a website, and there is a scoring system that gives you points for the number of times you play a game.
It uses hashing to prove the integrity of http request for scoring so users cannot change anything, however as I feared might happen, someone figured out that they didn't need to change it, they just ne... | 2010/11/10 | [
"https://Stackoverflow.com/questions/4145531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | Nonces are a can of worms.
--------------------------
No, really, one of the motivations for several [CAESAR](https://competitions.cr.yp.to/caesar.html) entries was to design an authenticated encryption scheme, preferably based on a stream cipher, that is resistant to nonce reuse. (Reusing a nonce with AES-CTR, for ex... | One option (which I mentioned in comment) is recording gameplay and replay it in secure environment.
The other thing is to randomly, or at some specified times, record some seemingly innocent data, which later can be used to validate it on server (like suddenly live goes from 1% to 100%, or score from 1 to 1000 which ... |
4,145,531 | I am running a website, and there is a scoring system that gives you points for the number of times you play a game.
It uses hashing to prove the integrity of http request for scoring so users cannot change anything, however as I feared might happen, someone figured out that they didn't need to change it, they just ne... | 2010/11/10 | [
"https://Stackoverflow.com/questions/4145531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | It's actually quite easy to do... There are some libraries out there to do it for you:
1. [PHP Nonce Library](http://fullthrottledevelopment.com/php-nonce-library)
2. [OpenID Nonce Library](http://shupp.org/openiddoc/__filesource/fsource_OpenID__OpenIDNonce.php.html)
Or if you want to write your own, it's pretty simp... | It is not possible to prevent cheating. You can only make it more difficult.
If someone came here looking for a PHP Nonce Library: I recommend not using [the first one given by ircmaxwell](http://fullthrottledevelopment.com/php-nonce-library "the first one given by ircmaxwell").
The first comment on the website desc... |
4,145,531 | I am running a website, and there is a scoring system that gives you points for the number of times you play a game.
It uses hashing to prove the integrity of http request for scoring so users cannot change anything, however as I feared might happen, someone figured out that they didn't need to change it, they just ne... | 2010/11/10 | [
"https://Stackoverflow.com/questions/4145531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | It's actually quite easy to do... There are some libraries out there to do it for you:
1. [PHP Nonce Library](http://fullthrottledevelopment.com/php-nonce-library)
2. [OpenID Nonce Library](http://shupp.org/openiddoc/__filesource/fsource_OpenID__OpenIDNonce.php.html)
Or if you want to write your own, it's pretty simp... | Nonces are a can of worms.
--------------------------
No, really, one of the motivations for several [CAESAR](https://competitions.cr.yp.to/caesar.html) entries was to design an authenticated encryption scheme, preferably based on a stream cipher, that is resistant to nonce reuse. (Reusing a nonce with AES-CTR, for ex... |
4,145,531 | I am running a website, and there is a scoring system that gives you points for the number of times you play a game.
It uses hashing to prove the integrity of http request for scoring so users cannot change anything, however as I feared might happen, someone figured out that they didn't need to change it, they just ne... | 2010/11/10 | [
"https://Stackoverflow.com/questions/4145531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | It's actually quite easy to do... There are some libraries out there to do it for you:
1. [PHP Nonce Library](http://fullthrottledevelopment.com/php-nonce-library)
2. [OpenID Nonce Library](http://shupp.org/openiddoc/__filesource/fsource_OpenID__OpenIDNonce.php.html)
Or if you want to write your own, it's pretty simp... | This very simple nonce changes every 1000 seconds (16 minutes)
and can be used for avoiding XSS where you are posting data to and from the same application. (For example if you are in a single page application where you are posting data via javascript. Note that you must have access to the same seed and nonce generator... |
4,145,531 | I am running a website, and there is a scoring system that gives you points for the number of times you play a game.
It uses hashing to prove the integrity of http request for scoring so users cannot change anything, however as I feared might happen, someone figured out that they didn't need to change it, they just ne... | 2010/11/10 | [
"https://Stackoverflow.com/questions/4145531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | Nonces are a can of worms.
--------------------------
No, really, one of the motivations for several [CAESAR](https://competitions.cr.yp.to/caesar.html) entries was to design an authenticated encryption scheme, preferably based on a stream cipher, that is resistant to nonce reuse. (Reusing a nonce with AES-CTR, for ex... | It is not possible to prevent cheating. You can only make it more difficult.
If someone came here looking for a PHP Nonce Library: I recommend not using [the first one given by ircmaxwell](http://fullthrottledevelopment.com/php-nonce-library "the first one given by ircmaxwell").
The first comment on the website desc... |
4,145,531 | I am running a website, and there is a scoring system that gives you points for the number of times you play a game.
It uses hashing to prove the integrity of http request for scoring so users cannot change anything, however as I feared might happen, someone figured out that they didn't need to change it, they just ne... | 2010/11/10 | [
"https://Stackoverflow.com/questions/4145531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | This very simple nonce changes every 1000 seconds (16 minutes)
and can be used for avoiding XSS where you are posting data to and from the same application. (For example if you are in a single page application where you are posting data via javascript. Note that you must have access to the same seed and nonce generator... | It is not possible to prevent cheating. You can only make it more difficult.
If someone came here looking for a PHP Nonce Library: I recommend not using [the first one given by ircmaxwell](http://fullthrottledevelopment.com/php-nonce-library "the first one given by ircmaxwell").
The first comment on the website desc... |
4,145,531 | I am running a website, and there is a scoring system that gives you points for the number of times you play a game.
It uses hashing to prove the integrity of http request for scoring so users cannot change anything, however as I feared might happen, someone figured out that they didn't need to change it, they just ne... | 2010/11/10 | [
"https://Stackoverflow.com/questions/4145531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | Nonces are a can of worms.
--------------------------
No, really, one of the motivations for several [CAESAR](https://competitions.cr.yp.to/caesar.html) entries was to design an authenticated encryption scheme, preferably based on a stream cipher, that is resistant to nonce reuse. (Reusing a nonce with AES-CTR, for ex... | This very simple nonce changes every 1000 seconds (16 minutes)
and can be used for avoiding XSS where you are posting data to and from the same application. (For example if you are in a single page application where you are posting data via javascript. Note that you must have access to the same seed and nonce generator... |
473,018 | I want to draw a table given below as it is
[](https://i.stack.imgur.com/JlnQU.png)
I don't how to make it properly. I can make a table like this given below:
```
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{table}[]
\begin{... | 2019/02/02 | [
"https://tex.stackexchange.com/questions/473018",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/173138/"
] | try the following:
```
\documentclass{article}
\usepackage[table]{xcolor}
\newcommand\mrh{\color{white}\bfseries}
\newcommand\mrc[1]{\begin{tabular}{@{}l@{}} #1 \end{tabular}}
\setlength\arrayrulewidth{0.8pt}
\begin{document}
\begin{table}[htb]
\arrayrulecolor{white}
\begin{tabular}{>{\columncolor{gray!10}} l... | Maybe something like this?
```
\documentclass[10pt]{article}
\usepackage{amsthm,amsmath,bm}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage{bigstrut}
\newcommand{\minitab}[2][1]{\begin{tabular}{#1}#2\end{tabular}}
\begin{document}
\begin{table}[htbp]
\arrayrulecolor{white}
\centering
\begin{tabular}{|c... |
2,396,782 | Why doesn't php support this syntax:
```
$s = explode('-', 'foo-bar')[0];
```
? | 2010/03/07 | [
"https://Stackoverflow.com/questions/2396782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/288251/"
] | It's a limitation in the PHP parser. There's no reason why it can't support this form of reduction, it just doesn't. | The syntax `‘foo-bar’)[0]` is wrong as far as php is concerned. I don't know which language you have seen such thing in but PHP has no implementation for such syntax. However, you can split your string like this:
```
explode(‘-’, ‘foo-bar’);
``` |
2,396,782 | Why doesn't php support this syntax:
```
$s = explode('-', 'foo-bar')[0];
```
? | 2010/03/07 | [
"https://Stackoverflow.com/questions/2396782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/288251/"
] | It's a limitation in the PHP parser. There's no reason why it can't support this form of reduction, it just doesn't. | You can write it using [`list`](http://php.net/manual/en/function.list.php):
```
list($first_value) = explode(‘-’,‘foo-bar’);
``` |
2,396,782 | Why doesn't php support this syntax:
```
$s = explode('-', 'foo-bar')[0];
```
? | 2010/03/07 | [
"https://Stackoverflow.com/questions/2396782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/288251/"
] | It's a limitation in the PHP parser. There's no reason why it can't support this form of reduction, it just doesn't. | Instead you could use this if you'r force to use inline :
substr($var,0, strrpos($var,'-'));
But I prefer the list solution , it's more elegant !
--- |
2,396,782 | Why doesn't php support this syntax:
```
$s = explode('-', 'foo-bar')[0];
```
? | 2010/03/07 | [
"https://Stackoverflow.com/questions/2396782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/288251/"
] | You can write it using [`list`](http://php.net/manual/en/function.list.php):
```
list($first_value) = explode(‘-’,‘foo-bar’);
``` | The syntax `‘foo-bar’)[0]` is wrong as far as php is concerned. I don't know which language you have seen such thing in but PHP has no implementation for such syntax. However, you can split your string like this:
```
explode(‘-’, ‘foo-bar’);
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.