qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
21,971,036 | I tried to export a settings.json as documented in the meteor.js documentation in order to connect my Meteor.js app with an external MongoHQ database :
```
{
"env": {
"MONGO_URL" : "mongodb://xxx:xxxx@troup.mongohq.com:10037/xxx"
}
}
```
with the command :
```
mrt deploy myapp.meteor.com --settings... | 2014/02/23 | [
"https://Stackoverflow.com/questions/21971036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2917448/"
] | Create a `lib` folder under the `server` folder and write:
```
Meteor.settings = { //your settings };
```
According to documentation everything inside a folder named `lib` will be executed before anything, so this way we ensure that no code will be execute before this, preventing errors from accessing Metrics that d... | Regarded to the Unoficial Meteor.js FAQ, thats not possible to do it easily, that might be tricky.
So i signed up for a modulus Account, with MongoHQ Database.
It works right now. |
21,971,036 | I tried to export a settings.json as documented in the meteor.js documentation in order to connect my Meteor.js app with an external MongoHQ database :
```
{
"env": {
"MONGO_URL" : "mongodb://xxx:xxxx@troup.mongohq.com:10037/xxx"
}
}
```
with the command :
```
mrt deploy myapp.meteor.com --settings... | 2014/02/23 | [
"https://Stackoverflow.com/questions/21971036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2917448/"
] | The application-configuration package (built in meteor package) contains the code to set mongo\_url. See my answer here <https://stackoverflow.com/a/23485319/2391620> | having a settings.json file is not enough you need to run with
```
meteor --settings settings.json
```
which is you cant do with meteor.com deploy. |
21,971,036 | I tried to export a settings.json as documented in the meteor.js documentation in order to connect my Meteor.js app with an external MongoHQ database :
```
{
"env": {
"MONGO_URL" : "mongodb://xxx:xxxx@troup.mongohq.com:10037/xxx"
}
}
```
with the command :
```
mrt deploy myapp.meteor.com --settings... | 2014/02/23 | [
"https://Stackoverflow.com/questions/21971036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2917448/"
] | Create a `lib` folder under the `server` folder and write:
```
Meteor.settings = { //your settings };
```
According to documentation everything inside a folder named `lib` will be executed before anything, so this way we ensure that no code will be execute before this, preventing errors from accessing Metrics that d... | having a settings.json file is not enough you need to run with
```
meteor --settings settings.json
```
which is you cant do with meteor.com deploy. |
21,971,036 | I tried to export a settings.json as documented in the meteor.js documentation in order to connect my Meteor.js app with an external MongoHQ database :
```
{
"env": {
"MONGO_URL" : "mongodb://xxx:xxxx@troup.mongohq.com:10037/xxx"
}
}
```
with the command :
```
mrt deploy myapp.meteor.com --settings... | 2014/02/23 | [
"https://Stackoverflow.com/questions/21971036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2917448/"
] | Create a `lib` folder under the `server` folder and write:
```
Meteor.settings = { //your settings };
```
According to documentation everything inside a folder named `lib` will be executed before anything, so this way we ensure that no code will be execute before this, preventing errors from accessing Metrics that d... | The application-configuration package (built in meteor package) contains the code to set mongo\_url. See my answer here <https://stackoverflow.com/a/23485319/2391620> |
15,679,498 | When I'm using Kunena on my site I have problems on the navigation bar.
Whenever I'm in a Kunena "page" the navigation is not showing the FORUM as active. | 2013/03/28 | [
"https://Stackoverflow.com/questions/15679498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2112678/"
] | A work around will be to change the active with java script or jquery
add this script to your index template
```
<script>
var j = jQuery.noConflict();
var isForumActive = <?php if (strpos($_SERVER['REQUEST_URI'], "/forum") !== false){ echo "true"; } else echo "false";?>;
if(isForumActive){
j(".item120").addCl... | I solved this problem by creating all Kunena menu items as sub-menu items of the Forum menu item in the main menu and using [split menus](http://docs.joomla.org/Split_menus). |
29,313,546 | Can anyone help me use a message box to display the random number and the square in two columns with a label for each?
```
const int NUM_ROWS = 10;
const int NUM_COLS = 2;
int[,] randint = new int [NUM_ROWS,NUM_COLS];
Random randNum = new Random();
for (int row = 0; row < randint.GetL... | 2015/03/28 | [
"https://Stackoverflow.com/questions/29313546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4722898/"
] | You can do it like this.
```
MessageBox.Show(string.Format("{0,5:d} {1,5:d}\n", randint[row, 0], randint[row, 1]), "Message Box",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
```
If you place this line inside the `for` loop a message box... | Start you project in :
```
Windows Forms Application -> C#
```
You can use `MessageBox` to help you solve your display content. |
29,313,546 | Can anyone help me use a message box to display the random number and the square in two columns with a label for each?
```
const int NUM_ROWS = 10;
const int NUM_COLS = 2;
int[,] randint = new int [NUM_ROWS,NUM_COLS];
Random randNum = new Random();
for (int row = 0; row < randint.GetL... | 2015/03/28 | [
"https://Stackoverflow.com/questions/29313546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4722898/"
] | I have achieved it by adding reference of System.Windows.Forms to my console application and got the result you desired. Here is my code:
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ConsoleApplication6
{
class Program
{
... | You can do it like this.
```
MessageBox.Show(string.Format("{0,5:d} {1,5:d}\n", randint[row, 0], randint[row, 1]), "Message Box",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
```
If you place this line inside the `for` loop a message box... |
29,313,546 | Can anyone help me use a message box to display the random number and the square in two columns with a label for each?
```
const int NUM_ROWS = 10;
const int NUM_COLS = 2;
int[,] randint = new int [NUM_ROWS,NUM_COLS];
Random randNum = new Random();
for (int row = 0; row < randint.GetL... | 2015/03/28 | [
"https://Stackoverflow.com/questions/29313546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4722898/"
] | I have achieved it by adding reference of System.Windows.Forms to my console application and got the result you desired. Here is my code:
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ConsoleApplication6
{
class Program
{
... | Start you project in :
```
Windows Forms Application -> C#
```
You can use `MessageBox` to help you solve your display content. |
28,641,948 | This addresses "a specific programming problem" from [On-Topic](https://stackoverflow.com/help/on-topic)
I am working on an interview question from [Amazon Software Interview](http://www.glassdoor.com/Interview/Given-a-triangle-of-integers-find-the-path-of-the-largest-sum-without-skipping-QTN_623875.htm)
The questi... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28641948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3761297/"
] | You should put them in linear memory and access them as:
```
int triangular(int row){
return row * (row + 1) / 2 + 1;
}
int[] r = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
for(int i=0; i<n_rows; i++){
for(int j=0; j<=i; j++){
System.out.print(r[triangular(i)+j]+" ");
}System.out.println("");
}
row, c... | You don't need to represent it at all! The starting number of row `r` (starting at 0) is given by the expression:
```
r * (r + 1) / 2 + 1
``` |
28,641,948 | This addresses "a specific programming problem" from [On-Topic](https://stackoverflow.com/help/on-topic)
I am working on an interview question from [Amazon Software Interview](http://www.glassdoor.com/Interview/Given-a-triangle-of-integers-find-the-path-of-the-largest-sum-without-skipping-QTN_623875.htm)
The questi... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28641948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3761297/"
] | You should put them in linear memory and access them as:
```
int triangular(int row){
return row * (row + 1) / 2 + 1;
}
int[] r = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
for(int i=0; i<n_rows; i++){
for(int j=0; j<=i; j++){
System.out.print(r[triangular(i)+j]+" ");
}System.out.println("");
}
row, c... | >
> I thought about using a 2 dimensional matrix structure but those have to have arrays of the same size.
>
>
>
Not correct.
In Java you can use arrays to represent non-rectangular data structures; e.g.
```
int[][] triangle = {{1},
{2, 3},
{4, 5, 6},
... |
28,641,948 | This addresses "a specific programming problem" from [On-Topic](https://stackoverflow.com/help/on-topic)
I am working on an interview question from [Amazon Software Interview](http://www.glassdoor.com/Interview/Given-a-triangle-of-integers-find-the-path-of-the-largest-sum-without-skipping-QTN_623875.htm)
The questi... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28641948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3761297/"
] | You should put them in linear memory and access them as:
```
int triangular(int row){
return row * (row + 1) / 2 + 1;
}
int[] r = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
for(int i=0; i<n_rows; i++){
for(int j=0; j<=i; j++){
System.out.print(r[triangular(i)+j]+" ");
}System.out.println("");
}
row, c... | I'd use a 2D array with guard-bands. In the example below, the 0's represent invalid entries in the array. The top and bottom rows, as well as the leftmost and rightmost columns are the guard-bands. The advantage is that your pathfinding algorithm can wander around the array without having to constantly check for out-o... |
28,641,948 | This addresses "a specific programming problem" from [On-Topic](https://stackoverflow.com/help/on-topic)
I am working on an interview question from [Amazon Software Interview](http://www.glassdoor.com/Interview/Given-a-triangle-of-integers-find-the-path-of-the-largest-sum-without-skipping-QTN_623875.htm)
The questi... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28641948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3761297/"
] | >
> I thought about using a 2 dimensional matrix structure but those have to have arrays of the same size.
>
>
>
Not correct.
In Java you can use arrays to represent non-rectangular data structures; e.g.
```
int[][] triangle = {{1},
{2, 3},
{4, 5, 6},
... | You don't need to represent it at all! The starting number of row `r` (starting at 0) is given by the expression:
```
r * (r + 1) / 2 + 1
``` |
28,641,948 | This addresses "a specific programming problem" from [On-Topic](https://stackoverflow.com/help/on-topic)
I am working on an interview question from [Amazon Software Interview](http://www.glassdoor.com/Interview/Given-a-triangle-of-integers-find-the-path-of-the-largest-sum-without-skipping-QTN_623875.htm)
The questi... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28641948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3761297/"
] | I'd use a 2D array with guard-bands. In the example below, the 0's represent invalid entries in the array. The top and bottom rows, as well as the leftmost and rightmost columns are the guard-bands. The advantage is that your pathfinding algorithm can wander around the array without having to constantly check for out-o... | You don't need to represent it at all! The starting number of row `r` (starting at 0) is given by the expression:
```
r * (r + 1) / 2 + 1
``` |
28,641,948 | This addresses "a specific programming problem" from [On-Topic](https://stackoverflow.com/help/on-topic)
I am working on an interview question from [Amazon Software Interview](http://www.glassdoor.com/Interview/Given-a-triangle-of-integers-find-the-path-of-the-largest-sum-without-skipping-QTN_623875.htm)
The questi... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28641948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3761297/"
] | >
> I thought about using a 2 dimensional matrix structure but those have to have arrays of the same size.
>
>
>
Not correct.
In Java you can use arrays to represent non-rectangular data structures; e.g.
```
int[][] triangle = {{1},
{2, 3},
{4, 5, 6},
... | I'd use a 2D array with guard-bands. In the example below, the 0's represent invalid entries in the array. The top and bottom rows, as well as the leftmost and rightmost columns are the guard-bands. The advantage is that your pathfinding algorithm can wander around the array without having to constantly check for out-o... |
14,029,038 | I am developing a registration system that lists events and the users will be able to register in these events. Each event has a specific number of seats. The problem that I am facing now is even when the number of registration reaches the number of seats, the event is still avaiable and I cannot stop the booking proce... | 2012/12/25 | [
"https://Stackoverflow.com/questions/14029038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1897016/"
] | Try :
```
LinkButtton lbtn = new LinkButtton();
lbtn = (LinkButton)e.Row.FindControl("ButtonId");
```
Then use `lbtn` for further operations.
Thanks | The RowDataBound event is for the GridView so the sender parameter cannot be cast into a LinkButton.
Modify you code to include the following.
```
if(numberOfBookings >= numberOfAvailableSeats)
{
if (e.Row.Cells[0].HasControls())
{
var button = e.Row.Cells[0].Controls[1] as LinkButton;
... |
14,029,038 | I am developing a registration system that lists events and the users will be able to register in these events. Each event has a specific number of seats. The problem that I am facing now is even when the number of registration reaches the number of seats, the event is still avaiable and I cannot stop the booking proce... | 2012/12/25 | [
"https://Stackoverflow.com/questions/14029038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1897016/"
] | Please use below code to hide the LinkButton, i.e. `lnkTitle`.
The code is as follows:
```
protected void ListOfAvailableEvents_GrivView_RowDataBound(object sender, GridViewRowEventArgs e)
{
int numberOfBookings = 0;
int numberOfAvailableSeats = 0;
string connString = "Data Source=appServer\\sqlexpress;I... | The RowDataBound event is for the GridView so the sender parameter cannot be cast into a LinkButton.
Modify you code to include the following.
```
if(numberOfBookings >= numberOfAvailableSeats)
{
if (e.Row.Cells[0].HasControls())
{
var button = e.Row.Cells[0].Controls[1] as LinkButton;
... |
8,688,185 | How I can find in XPath 1.0 all rows with empty `col name="POW"`?
```
<row>
<col name="WOJ">02</col>
<col name="POW"/>
<col name="GMI"/>
<col name="RODZ"/>
<col name="NAZWA">DOLNOŚLĄSKIE</col>
<col name="NAZDOD">województwo</col>
<col name="STAN_NA">2011-01-01</col>
</row>
```
I tried many solutions. Few times in Fi... | 2011/12/31 | [
"https://Stackoverflow.com/questions/8688185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/499768/"
] | ```
//row[col[@name='POW' and not(normalize-space())]]
```
To ensure that the POW column also doesn't have any child elements(even if they don't contain any text), then add an additional predicate filter:
```
//row[col[@name='POW' and not(normalize-space()) and not(*)]]
``` | Use this:
```
//row[col[@name = 'POW' and not(text())]]
``` |
8,688,185 | How I can find in XPath 1.0 all rows with empty `col name="POW"`?
```
<row>
<col name="WOJ">02</col>
<col name="POW"/>
<col name="GMI"/>
<col name="RODZ"/>
<col name="NAZWA">DOLNOŚLĄSKIE</col>
<col name="NAZDOD">województwo</col>
<col name="STAN_NA">2011-01-01</col>
</row>
```
I tried many solutions. Few times in Fi... | 2011/12/31 | [
"https://Stackoverflow.com/questions/8688185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/499768/"
] | >
> How I can find in XPath 1.0 all rows with empty `col name="POW"`?
>
>
>
There are many possible definitions of "empty" and for each one of them there is a different XPath expression selecting "empty" elements.
A reasonable definition for an empty element is: an element that has no children elements and no tex... | Use this:
```
//row[col[@name = 'POW' and not(text())]]
``` |
8,688,185 | How I can find in XPath 1.0 all rows with empty `col name="POW"`?
```
<row>
<col name="WOJ">02</col>
<col name="POW"/>
<col name="GMI"/>
<col name="RODZ"/>
<col name="NAZWA">DOLNOŚLĄSKIE</col>
<col name="NAZDOD">województwo</col>
<col name="STAN_NA">2011-01-01</col>
</row>
```
I tried many solutions. Few times in Fi... | 2011/12/31 | [
"https://Stackoverflow.com/questions/8688185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/499768/"
] | >
> How I can find in XPath 1.0 all rows with empty `col name="POW"`?
>
>
>
There are many possible definitions of "empty" and for each one of them there is a different XPath expression selecting "empty" elements.
A reasonable definition for an empty element is: an element that has no children elements and no tex... | ```
//row[col[@name='POW' and not(normalize-space())]]
```
To ensure that the POW column also doesn't have any child elements(even if they don't contain any text), then add an additional predicate filter:
```
//row[col[@name='POW' and not(normalize-space()) and not(*)]]
``` |
52,269,829 | I am having trouble finding a way to authenticate an user.
When you start the Node JS Server manually this worked fine (and yeah its ugly code):
```
if (data.URL.includes("https://share.url.com")) {
await page.type('#userNameInput', 'user');
await page.type('#passwordInput', 'pass');
await pa... | 2018/09/11 | [
"https://Stackoverflow.com/questions/52269829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7156350/"
] | About
>
> Saving user cred. in browser (chrom(ium)):
>
>
>
I had similar situation - I wanted to do screenshot from facebook when I'm logged in. To achieve it I did steps like:
1) Created temp user data dir
```
mkdir /tmp/puppeteer_test
```
2) Run Chrome with these arguments
```
/usr/bin/google-chrome --user... | I am doing following for SharePoint
```
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({width: 1920, height: 1080});
// Open SharePoint page
console.log("Opening page");
await page.goto('https://mytenant.sharepoint.com/sites/mysite');
await page.waitForNavigati... |
33,581,329 | How I can pass a Map parameter as a GET param in url to Spring REST controller ? | 2015/11/07 | [
"https://Stackoverflow.com/questions/33581329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1219755/"
] | There are different ways (*but a simple `@RequestParam('myMap')Map<String,String>` does not work - maybe not true anymore!*)
The (IMHO) easiest solution is to use a command object then you could use `[key]` in the url to specifiy the map key:
@Controller
```
@RequestMapping("/demo")
public class DemoController {
... | It’s possible to bind all request parameters in a Map just by adding a Map object after the annotation:
```
@RequestMapping("/demo")
public String example(@RequestParam Map<String, String> map){
String apple = map.get("APPLE");//apple
String banana = map.get("BANANA");//banana
return apple + banana;
}
``... |
12,124,297 | I need a scheduler (for one time only actions) for a site I'm coding (in php), and I had two ideas:
1- Run a php script with crontab and verify against a database of scheduled actions and execute ones that are older than current time.
2- Schedule various tasks with the "at" command.
The second option seems much bett... | 2012/08/25 | [
"https://Stackoverflow.com/questions/12124297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1445420/"
] | You can prepend `phpscript` with a `#!/usr/bin/php` (or wherever your php script is stored) and make `/path/to/phpscript` executable. This is exactly what the `#!` syntax is for.
Just so it's clear, your `phpscript` would look like this:
```
#!/usr/bin/php
...your code goes here
``` | The command you specify to `at` is executed by `/bin/sh`, but sh can invoke any command, executed directly or by any specified interpreter.
The following works on my Ubuntu 12.04 system with the bash shell:
```
$ cat hello.php
#!/usr/bin/php
<?php
echo "Hello, PHP\n";
?>
$ echo "$PWD/hello.php > hello.php.out" | ... |
55,690,637 | I have some data files with around 10k records; each record containing a value plus the standard deviation for it.
I'm plotting the standard deviation as a slightly transparent `filledcurve`. However, since there were some weird artifacts with painting so many points, I've resorted to using the `every` command to plot... | 2019/04/15 | [
"https://Stackoverflow.com/questions/55690637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1356926/"
] | [amended to show full treatment of NaN value. Demo'ed with a real data file]
Instead of `every`, you can construct a filter function for the `using` specifier.
```
set xrange [100:600]
xmax = 600
filter(x) = (int(column(0))%9 == 0 || x == xmax) ? 1 : 0
set datafile missing NaN
plot 'silver.dat' using (filter($1)?$1... | You mentioned the iridescent patterns when plotting about 10k datapoints with transparent? Although different terminals look different, I can't observe this behaviour with gnuplot 5.2.6 under Win7 or we are talking about different things. Maybe, your data or terminal or OS is special?
**Test code:**
```
### transpar... |
10,664 | What is the food with the highest calorie per unit price that you can buy and eat regularly? The food cannot give you any undesirable health effect due to the sole reason that you eat it regularly. | 2017/01/01 | [
"https://health.stackexchange.com/questions/10664",
"https://health.stackexchange.com",
"https://health.stackexchange.com/users/7809/"
] | For **1 US Dollar** you can get:
Foods with mainly *carbohydrates:*
* **Polenta/cornmeal,** raw, 847 g = **2,930** Cal
* **Potatoes, white,** raw, 2,400 g = **1,844** Cal
* **Bread, black,** 680 g = **1,536** Cal
* **Oatmeal,** raw, 340 g = **1,244** Cal
* **Rice, white,** raw, 320 g = **1,117** Cal-
* **Chickpeas (g... | For millennia, "Rice and Beans" have been a staple worldwide for good reason: they are cheap crops that together provide a "compete protien", that is, every type of amino acid that we cannot synthesize ourselves.
Though they're slightly more time consuming to cook, go with dried beans instead of canned if it'll be a r... |
2,716,178 | How do I handle closing tags (ex: `</h1>`) with the Java HTML Parser Library?
For example, if I have the following:
```
public class MyFilter implements NodeFilter {
public boolean accept(Node node) {
if (node instanceof TagNode) {
TagNode theNode = (TagNode) node;
if (theNode.getRawTagName().equals("h1")) ... | 2010/04/26 | [
"https://Stackoverflow.com/questions/2716178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/326284/"
] | A `DataContext` follows a pattern known as a Unit of Work. It tracks all inserts, updates, and deletes you do during a piece of code.
Once that piece of code is done running, the `SubmitChanges` method sends all modifications to the database *at one time*. There is no need for you to do anything; changes you make will... | Just don't write this method :)
Any time some business logic needs to update specific fields on a person, *update the specific fields on that person* (and remember to update the datacontext before the http context is unloaded)
You were on the right track when you said "Is that redundant since L2S already mapped my Pe... |
2,716,178 | How do I handle closing tags (ex: `</h1>`) with the Java HTML Parser Library?
For example, if I have the following:
```
public class MyFilter implements NodeFilter {
public boolean accept(Node node) {
if (node instanceof TagNode) {
TagNode theNode = (TagNode) node;
if (theNode.getRawTagName().equals("h1")) ... | 2010/04/26 | [
"https://Stackoverflow.com/questions/2716178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/326284/"
] | Just don't write this method :)
Any time some business logic needs to update specific fields on a person, *update the specific fields on that person* (and remember to update the datacontext before the http context is unloaded)
You were on the right track when you said "Is that redundant since L2S already mapped my Pe... | What is wrong with your Update method is that you have are creating a datacontext instance within it.
And I presume you also have other CRUD methods which do the same.
If you abstract your CRUD operations to a Repository class you will be using the DataContext as it was meant to be used.
See the answer to this [ques... |
2,716,178 | How do I handle closing tags (ex: `</h1>`) with the Java HTML Parser Library?
For example, if I have the following:
```
public class MyFilter implements NodeFilter {
public boolean accept(Node node) {
if (node instanceof TagNode) {
TagNode theNode = (TagNode) node;
if (theNode.getRawTagName().equals("h1")) ... | 2010/04/26 | [
"https://Stackoverflow.com/questions/2716178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/326284/"
] | A `DataContext` follows a pattern known as a Unit of Work. It tracks all inserts, updates, and deletes you do during a piece of code.
Once that piece of code is done running, the `SubmitChanges` method sends all modifications to the database *at one time*. There is no need for you to do anything; changes you make will... | What is wrong with your Update method is that you have are creating a datacontext instance within it.
And I presume you also have other CRUD methods which do the same.
If you abstract your CRUD operations to a Repository class you will be using the DataContext as it was meant to be used.
See the answer to this [ques... |
60,937,975 | >
> Since Digital Ocean Spaces API is compatible with AWS SDK, how to
> upload images to Digital Ocean Spaces programmatically using AWS SDK
> for Yii2?
>
>
>
Here my details
```
Good, we have the following data:
1. endpoint: fra1.digitaloceanspaces.com
2. bucket name: dev-abc
3. api key: xxxxxxxxxxxxx and api... | 2020/03/30 | [
"https://Stackoverflow.com/questions/60937975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5994023/"
] | You can php code to upload image in digital ocean:
1. Configure a client:
use Aws\S3\S3Client;
```
$client = new Aws\S3\S3Client([
'version' => 'latest',
'region' => 'us-east-1',
'endpoint' => 'https://nyc3.digitaloceanspaces.com',
'credentials' => [
'key' => getenv('SPACES_KEY'),
... | Install composer from <https://getcomposer.org/download/> and then run the following to setup the AWS PHP dependencies:
```
composer require aws/aws-sdk-php
```
The following code has a form for uploading images, the code processes the files and uploads them to DO Spaces. Replace your values with those in the code.
... |
60,937,975 | >
> Since Digital Ocean Spaces API is compatible with AWS SDK, how to
> upload images to Digital Ocean Spaces programmatically using AWS SDK
> for Yii2?
>
>
>
Here my details
```
Good, we have the following data:
1. endpoint: fra1.digitaloceanspaces.com
2. bucket name: dev-abc
3. api key: xxxxxxxxxxxxx and api... | 2020/03/30 | [
"https://Stackoverflow.com/questions/60937975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5994023/"
] | **Here how i mange to go this**
Added the three libraries gulp,gulp-awspublish,gulp-rename
```
var gulp = require('gulp');
var awspublish = require('gulp-awspublish');
var rename = require('gulp-rename');
var publisherDev = awspublish.create({
region: 'fra1',
params: {
Bucket: 'dev-static-abc-ro'
},
acce... | Install composer from <https://getcomposer.org/download/> and then run the following to setup the AWS PHP dependencies:
```
composer require aws/aws-sdk-php
```
The following code has a form for uploading images, the code processes the files and uploads them to DO Spaces. Replace your values with those in the code.
... |
188,156 | The users need to be about to print the forms they've filled out on SharePoint after they've filled them out. In just wondering if it is easily possible because I'm not finding anything.
Forms are hosted on SharePoint and created in InfoPath | 2016/07/29 | [
"https://sharepoint.stackexchange.com/questions/188156",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/56516/"
] | * Go to list > Customize List> select your form.
* Add a Content Editor Web part or Script Editor for SharePoint 2013 to the page.
[](https://i.stack.imgur.com/9aUbI.png)
- Add the following code.
```
`< input type="button" value=" Print this page " ... | Have you possibly looked into this: <http://infopathprinter.codeplex.com/>
You can add the option as a Custom Action XML |
188,156 | The users need to be about to print the forms they've filled out on SharePoint after they've filled them out. In just wondering if it is easily possible because I'm not finding anything.
Forms are hosted on SharePoint and created in InfoPath | 2016/07/29 | [
"https://sharepoint.stackexchange.com/questions/188156",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/56516/"
] | * Go to list > Customize List> select your form.
* Add a Content Editor Web part or Script Editor for SharePoint 2013 to the page.
[](https://i.stack.imgur.com/9aUbI.png)
- Add the following code.
```
`< input type="button" value=" Print this page " ... | If you are looking for "Print" button on the form page
Edit the default list form, add "Content Editor" webpart and put the below HTML as content.
you can add css in the same place for formatting. |
84,473 | The Nachem prayer for tisha b'av describes he city as השוממה מאין יושב, "desolate without inhabitant." What does this mean? In what way was Jerusalem desolate without inhabitants? Does this have a non-literal meaning? NOTE: I am not referring to the question of Nachem after 1967. I am asking what this prayer could have... | 2017/07/31 | [
"https://judaism.stackexchange.com/questions/84473",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/14599/"
] | Two thousand years beforehand, they may not have said this text.
[Rambam's text](http://www.mechon-mamre.org/i/2700.htm#23), for example, does not have it, nor do Seder Rav Amram Gaon (ed. Harpenes: Seder Tisha B'av), or Seder Rav Sa'adya Gaon, which just has השוממה.
Nevertheless, it is present in the Siddur of [R. E... | Perhaps מאין יושב. Does not refer to a complete absence of inhabitants, but a lack. This would seem more literally accurate for much of history |
15,174,517 | I want to send multiple SMS' via using smslib. I make a Java class to send SMS in a loop. But it works only one time. then it returns the following exception:
```
org.smslib.GatewayException: Comm library exception:
java.lang.RuntimeException: javax.comm.PortInUseException:
Port currently owned by org.smslib
... | 2013/03/02 | [
"https://Stackoverflow.com/questions/15174517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2126003/"
] | I don't know the smslib, but I imagine everything until `startService` should only happen once, not each time you want to send a message, as follows:
```
class SendSMS1
{
public SendSMS1(String modemName, String port, int bitRate,
String modemPin, String SMSC)
{
OutboundNotification... | Change this.It's Working
```
public static void main(String[] args) throws Exception {
Calendar now = Calendar.getInstance();
String ar=(dateFormat.format(now.getTime()));
String text = "We are the Future of Science "+" "+ar;
SendSMS app = new SendSMS("Huawei", "COM20", 115200, "00... |
15,174,517 | I want to send multiple SMS' via using smslib. I make a Java class to send SMS in a loop. But it works only one time. then it returns the following exception:
```
org.smslib.GatewayException: Comm library exception:
java.lang.RuntimeException: javax.comm.PortInUseException:
Port currently owned by org.smslib
... | 2013/03/02 | [
"https://Stackoverflow.com/questions/15174517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2126003/"
] | You must remove the gateway.
can use this-
*Service.getInstance().removeGateway(gateway);*
you should insert it in doIt method, after - *Service.getInstance().stopService();* | Change this.It's Working
```
public static void main(String[] args) throws Exception {
Calendar now = Calendar.getInstance();
String ar=(dateFormat.format(now.getTime()));
String text = "We are the Future of Science "+" "+ar;
SendSMS app = new SendSMS("Huawei", "COM20", 115200, "00... |
60,657,831 | I've set my mapping up as follows:
```
CreateMap<SourceClass, DestinationClass>().ForMember(destinationMember => destinationMember.Provider,
memberOptions => memberOptions.MapFrom(src => src.Providers.FirstOrDefault()));
```
Where I'm mapping from a List in my SourceClass to a string in my destinatio... | 2020/03/12 | [
"https://Stackoverflow.com/questions/60657831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4162438/"
] | Like what @goto1 mentioned in a comment, you may create a custom hook to use for a cleaner and reusable look. Here's my take on a custom hook called `useCbOnce` which calls any event callback once:
```
const useCbOnce = (cb) => {
const [called, setCalled] = useState(false);
// Below can be wrapped in useCallb... | You can reuse `onSubmit` logic with simple [custom hook](https://reactjs.org/docs/hooks-custom.html#using-a-custom-hook).
I oversimplified the logic so it won't cause unnecessary renders:
```
const useOnSubmit = () => {
const [, setSubmitted] = useState(false);
const onSubmit = useCallback(e => {
e.preventDe... |
60,657,831 | I've set my mapping up as follows:
```
CreateMap<SourceClass, DestinationClass>().ForMember(destinationMember => destinationMember.Provider,
memberOptions => memberOptions.MapFrom(src => src.Providers.FirstOrDefault()));
```
Where I'm mapping from a List in my SourceClass to a string in my destinatio... | 2020/03/12 | [
"https://Stackoverflow.com/questions/60657831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4162438/"
] | Like what @goto1 mentioned in a comment, you may create a custom hook to use for a cleaner and reusable look. Here's my take on a custom hook called `useCbOnce` which calls any event callback once:
```
const useCbOnce = (cb) => {
const [called, setCalled] = useState(false);
// Below can be wrapped in useCallb... | Here's an example that lets you customize what action happens on submit, but always prevents the default and only calls the action once.
```js
function useSubmitAction(action=null, dependencies = [action]) {
const [submitted, setSubmitted] = React.useState(false)
return React.useCallback(function (event, ...rest... |
120,425 | There are several questions around limiting ftp users to certain directories. However, most of them refer to vsftpd, which I don't think I have installed on my system. I'm running Ubuntu 9.04. How can I tell what ftp service I have installed, and then limit certain users to only the `/home/ftpuser` directory instead of... | 2010/03/08 | [
"https://serverfault.com/questions/120425",
"https://serverfault.com",
"https://serverfault.com/users/37112/"
] | I'd recommend using [proftpd](http://www.proftpd.org/) with Ubuntu.... I follwed these steps recently and it worked ver y well....
Here's quick install steps:
```
sudo apt-get install proftpd
# Add this line in /etc/shells file (sudo gedit /etc/shells to open the file)
/bin/false
cd /home
sudo mkdir FTP-shared
sud... | ```
dpkg --list |grep -i ftp
```
should show you the list of packages on your machine that include 'ftp' in the name. If there's not one, then you may not have any kind of FTP server installed. |
22,528,853 | I have a data frame with alternating columns that I want to reshape. The problem is that `stats::reshape` and `reshape2::reshape` are both very slow and memory intensive on my actual use case. I suspect that the no-copy approach of `data.table` will save me time and use less resources, but I barely know where to start ... | 2014/03/20 | [
"https://Stackoverflow.com/questions/22528853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1036500/"
] | You could either do it this way
```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.newapp.Firstscreen$PlaceholderFragment"... | Change `Height` and `Width` of `ImageView` to `match_parent`.
```
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/background" />
```
Edit-
Complete code-
```
<RelativeLayout xmlns:android="http:/... |
22,528,853 | I have a data frame with alternating columns that I want to reshape. The problem is that `stats::reshape` and `reshape2::reshape` are both very slow and memory intensive on my actual use case. I suspect that the no-copy approach of `data.table` will save me time and use less resources, but I barely know where to start ... | 2014/03/20 | [
"https://Stackoverflow.com/questions/22528853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1036500/"
] | Change `Height` and `Width` of `ImageView` to `match_parent`.
```
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/background" />
```
Edit-
Complete code-
```
<RelativeLayout xmlns:android="http:/... | Add this line to your ImageView
```
android:scaleType="fitXY"
```
and set the width and height as match\_parent. |
22,528,853 | I have a data frame with alternating columns that I want to reshape. The problem is that `stats::reshape` and `reshape2::reshape` are both very slow and memory intensive on my actual use case. I suspect that the no-copy approach of `data.table` will save me time and use less resources, but I barely know where to start ... | 2014/03/20 | [
"https://Stackoverflow.com/questions/22528853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1036500/"
] | You could either do it this way
```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.newapp.Firstscreen$PlaceholderFragment"... | Add this line to your ImageView
```
android:scaleType="fitXY"
```
and set the width and height as match\_parent. |
5,077,070 | I have a scenario where my Java program has to continuously communicate with the database table, for example my Java program has to get the data of my table when new rows are added to it at runtime. There should be continuous communication between my program and database.
If the table has 10 rows initially and 2 rows ... | 2011/02/22 | [
"https://Stackoverflow.com/questions/5077070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399944/"
] | With HSQLDB, this is supported without continuous polling.
HSQLDB TRIGGERs support synchronous or asynchronous notifications to be sent by the trigger event. The target may be the user's app or any other app.
See <http://hsqldb.org/doc/2.0/guide/triggers-chapt.html> | What do you mean by continuous communication? The connection to database should be kept open once established until you finish the task here. But you will have to keep polling to fetch new records. |
5,077,070 | I have a scenario where my Java program has to continuously communicate with the database table, for example my Java program has to get the data of my table when new rows are added to it at runtime. There should be continuous communication between my program and database.
If the table has 10 rows initially and 2 rows ... | 2011/02/22 | [
"https://Stackoverflow.com/questions/5077070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399944/"
] | For HSQL you can use trigger. Ref: <http://hsqldb.org/doc/2.0/guide/triggers-chapt.html>
Trigger Action in Java
A trigger action can be written as a Java class that implements the org.hsqldb.Trigger interface. This interface has a single method which is called when the trigger is activated, either before or after the... | What do you mean by continuous communication? The connection to database should be kept open once established until you finish the task here. But you will have to keep polling to fetch new records. |
5,077,070 | I have a scenario where my Java program has to continuously communicate with the database table, for example my Java program has to get the data of my table when new rows are added to it at runtime. There should be continuous communication between my program and database.
If the table has 10 rows initially and 2 rows ... | 2011/02/22 | [
"https://Stackoverflow.com/questions/5077070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399944/"
] | With HSQLDB, this is supported without continuous polling.
HSQLDB TRIGGERs support synchronous or asynchronous notifications to be sent by the trigger event. The target may be the user's app or any other app.
See <http://hsqldb.org/doc/2.0/guide/triggers-chapt.html> | This is not possible. You'll have to regularly poll the database in order to detect changes. |
5,077,070 | I have a scenario where my Java program has to continuously communicate with the database table, for example my Java program has to get the data of my table when new rows are added to it at runtime. There should be continuous communication between my program and database.
If the table has 10 rows initially and 2 rows ... | 2011/02/22 | [
"https://Stackoverflow.com/questions/5077070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399944/"
] | For HSQL you can use trigger. Ref: <http://hsqldb.org/doc/2.0/guide/triggers-chapt.html>
Trigger Action in Java
A trigger action can be written as a Java class that implements the org.hsqldb.Trigger interface. This interface has a single method which is called when the trigger is activated, either before or after the... | This is not possible. You'll have to regularly poll the database in order to detect changes. |
5,077,070 | I have a scenario where my Java program has to continuously communicate with the database table, for example my Java program has to get the data of my table when new rows are added to it at runtime. There should be continuous communication between my program and database.
If the table has 10 rows initially and 2 rows ... | 2011/02/22 | [
"https://Stackoverflow.com/questions/5077070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399944/"
] | With HSQLDB, this is supported without continuous polling.
HSQLDB TRIGGERs support synchronous or asynchronous notifications to be sent by the trigger event. The target may be the user's app or any other app.
See <http://hsqldb.org/doc/2.0/guide/triggers-chapt.html> | For HSQL you can use trigger. Ref: <http://hsqldb.org/doc/2.0/guide/triggers-chapt.html>
Trigger Action in Java
A trigger action can be written as a Java class that implements the org.hsqldb.Trigger interface. This interface has a single method which is called when the trigger is activated, either before or after the... |
7,114,082 | I'm using django to do a pixel tracker on an email
Is it easy to return an actual image from a django view (and how would this be done?) or is it easier to just return a redirect to the url where the actual image lives? | 2011/08/18 | [
"https://Stackoverflow.com/questions/7114082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443722/"
] | You don't need an actual image for a tracker pixel. In fact, it's better if you don't have one.
Just use the view as the source for the image tag, and have it return a blank response. | Django has a [static file](https://docs.djangoproject.com/en/dev/howto/static-files/) helper that could be used to serve up the image, but it is not recommended because of performance. I believe that having a view that does the bookkeeping to track the pixel, then redirect to a url that [serves the actual image via the... |
7,114,082 | I'm using django to do a pixel tracker on an email
Is it easy to return an actual image from a django view (and how would this be done?) or is it easier to just return a redirect to the url where the actual image lives? | 2011/08/18 | [
"https://Stackoverflow.com/questions/7114082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443722/"
] | Since this was the first result on my google search and the best answer is buried in the link by Daniel (but not mentioned as the best), I figured I would just post the answer so nobody is tempted to return a blank response which as a Michael points out is not ideal.
The solution is to use a standard view and return a... | Django has a [static file](https://docs.djangoproject.com/en/dev/howto/static-files/) helper that could be used to serve up the image, but it is not recommended because of performance. I believe that having a view that does the bookkeeping to track the pixel, then redirect to a url that [serves the actual image via the... |
7,114,082 | I'm using django to do a pixel tracker on an email
Is it easy to return an actual image from a django view (and how would this be done?) or is it easier to just return a redirect to the url where the actual image lives? | 2011/08/18 | [
"https://Stackoverflow.com/questions/7114082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443722/"
] | Django has a [static file](https://docs.djangoproject.com/en/dev/howto/static-files/) helper that could be used to serve up the image, but it is not recommended because of performance. I believe that having a view that does the bookkeeping to track the pixel, then redirect to a url that [serves the actual image via the... | **Python2.x:**
```
from django.http import HttpResponse
PIXEL_GIF_DATA = """
R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
""".strip().decode('base64')
def pixel_gif(request):
return HttpResponse(PIXEL_GIF_DATA, content_type='image/gif')
```
**Python3.x:**
```
import base64
from django.http import ... |
7,114,082 | I'm using django to do a pixel tracker on an email
Is it easy to return an actual image from a django view (and how would this be done?) or is it easier to just return a redirect to the url where the actual image lives? | 2011/08/18 | [
"https://Stackoverflow.com/questions/7114082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443722/"
] | You don't need an actual image for a tracker pixel. In fact, it's better if you don't have one.
Just use the view as the source for the image tag, and have it return a blank response. | Since this was the first result on my google search and the best answer is buried in the link by Daniel (but not mentioned as the best), I figured I would just post the answer so nobody is tempted to return a blank response which as a Michael points out is not ideal.
The solution is to use a standard view and return a... |
7,114,082 | I'm using django to do a pixel tracker on an email
Is it easy to return an actual image from a django view (and how would this be done?) or is it easier to just return a redirect to the url where the actual image lives? | 2011/08/18 | [
"https://Stackoverflow.com/questions/7114082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443722/"
] | You don't need an actual image for a tracker pixel. In fact, it's better if you don't have one.
Just use the view as the source for the image tag, and have it return a blank response. | **Python2.x:**
```
from django.http import HttpResponse
PIXEL_GIF_DATA = """
R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
""".strip().decode('base64')
def pixel_gif(request):
return HttpResponse(PIXEL_GIF_DATA, content_type='image/gif')
```
**Python3.x:**
```
import base64
from django.http import ... |
7,114,082 | I'm using django to do a pixel tracker on an email
Is it easy to return an actual image from a django view (and how would this be done?) or is it easier to just return a redirect to the url where the actual image lives? | 2011/08/18 | [
"https://Stackoverflow.com/questions/7114082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443722/"
] | Since this was the first result on my google search and the best answer is buried in the link by Daniel (but not mentioned as the best), I figured I would just post the answer so nobody is tempted to return a blank response which as a Michael points out is not ideal.
The solution is to use a standard view and return a... | **Python2.x:**
```
from django.http import HttpResponse
PIXEL_GIF_DATA = """
R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
""".strip().decode('base64')
def pixel_gif(request):
return HttpResponse(PIXEL_GIF_DATA, content_type='image/gif')
```
**Python3.x:**
```
import base64
from django.http import ... |
12,917,001 | I have this site : <http://test.tamarawobben.nl>
What's the best way to achieve that the footer will always be on the bottom of the screen? | 2012/10/16 | [
"https://Stackoverflow.com/questions/12917001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1692026/"
] | CSS for the footer
```
footer {
position:absolute;
bottom:0;
width:100%;
height:60px; /* Height of the footer */
background:#6cf;
}
```
Full article on this : [How to keep footers at the bottom of the page](http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page) | Take a look at this tutorial on how to do this - <http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page>.
Should get you what you're looking for. |
12,917,001 | I have this site : <http://test.tamarawobben.nl>
What's the best way to achieve that the footer will always be on the bottom of the screen? | 2012/10/16 | [
"https://Stackoverflow.com/questions/12917001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1692026/"
] | It depends on what you mean by "always on the bottom". There are two type of footers that are "always on the bottom": Fixed and sticky.
A fixed footer is always on the bottom *of the browser window*, where as a sticky footer is always on the bottom *of the page content or the browser, whichever is lower*.
For the sti... | Take a look at this tutorial on how to do this - <http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page>.
Should get you what you're looking for. |
49,674,318 | I've noticed that in PHP the following code works with no complaints:
```
class A {
public static function echoes($b) {
echo $b->protectedFunction();
}
}
class B extends A {
protected function protectedFunction() {
return "this is protected";
}
}
$b = new B();
A::e... | 2018/04/05 | [
"https://Stackoverflow.com/questions/49674318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/487813/"
] | The way that C# restricts access seems to be the most logical way to do it.
A parent should not be able to inherit anything from a child. And without inheriting anything from the child, the parent should not have access to the child's protected methods. | I think you might get problems letting the parent know something about the children. Because parents are used to extract and bundle behavior and attributes from multiple classes, so the way of information is just in one direction.
Maybe there are cases in which you need to access the protected attributes, but I guess ... |
49,674,318 | I've noticed that in PHP the following code works with no complaints:
```
class A {
public static function echoes($b) {
echo $b->protectedFunction();
}
}
class B extends A {
protected function protectedFunction() {
return "this is protected";
}
}
$b = new B();
A::e... | 2018/04/05 | [
"https://Stackoverflow.com/questions/49674318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/487813/"
] | I think you might get problems letting the parent know something about the children. Because parents are used to extract and bundle behavior and attributes from multiple classes, so the way of information is just in one direction.
Maybe there are cases in which you need to access the protected attributes, but I guess ... | PHP is a dynamically typed language. Function and method calls are not checked until that line of code is actually executed. In PHP you can have two objects instances from the same class with different methods. [This works fine.](https://stackoverflow.com/questions/2938004/how-to-add-a-new-method-to-a-php-object-on-the... |
49,674,318 | I've noticed that in PHP the following code works with no complaints:
```
class A {
public static function echoes($b) {
echo $b->protectedFunction();
}
}
class B extends A {
protected function protectedFunction() {
return "this is protected";
}
}
$b = new B();
A::e... | 2018/04/05 | [
"https://Stackoverflow.com/questions/49674318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/487813/"
] | The way that C# restricts access seems to be the most logical way to do it.
A parent should not be able to inherit anything from a child. And without inheriting anything from the child, the parent should not have access to the child's protected methods. | PHP is a dynamically typed language. Function and method calls are not checked until that line of code is actually executed. In PHP you can have two objects instances from the same class with different methods. [This works fine.](https://stackoverflow.com/questions/2938004/how-to-add-a-new-method-to-a-php-object-on-the... |
69,737,525 | I am working on a form in React e-commerce project.
Here's how it should work: When user fills up the form and clicks the submit button I want to post the form data to a server and redirect the user to a confirmation/thank you page.
Unfortunately, when I fill up the form and click the submit button the following code... | 2021/10/27 | [
"https://Stackoverflow.com/questions/69737525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15278400/"
] | You can loop over each key value pair and replace the value if its empty. Be aware that a backslash is used for escaping a character. To fix this we first replace the backslashes with dashes and then replace the rest.
The regex could also be simplified to `/[^-|]/g` which means replace all symbols except `-` and `|`
... | You should just iterate between your object's keys like this:
```js
// find first non-empty field, !! - conversion to boolean
let nonEmptyKey = Object.keys(obj).find(key => !!obj[key]);
for(let key of Object.keys(obj)) {
// check if value is empty
if(!obj[key]) {
obj[key] = obj[nonEmptyKey].replace(/[0-9-. a-... |
269,379 | I am using the `fp` package to write a coursework in mechanics **and** calculate the numerical values on the fly. Here is some example code:
```
\documentclass{article}
\usepackage[nomessages]{fp} % http://ctan.org/pkg/fp
\begin{document}
\section{Requirements}
\FPset{P_output_kW}{11}
\FPset{n_output_max_rpm}{5000}
... | 2015/09/24 | [
"https://tex.stackexchange.com/questions/269379",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/45581/"
] | The following sets the variable name in typewriter font, the number via `\FPprint` and the unit is taken from the variable name:
```
\documentclass{article}
\usepackage[nomessages]{fp} % http://ctan.org/pkg/fp
\newcommand*{\VarOutput}[1]{%
\begingroup
\fontencoding{T1}%
\fontfamily{lmvtt}\selectfont % vari... | This uses \csname.
```
\documentclass{article}
\usepackage{showframe}
\usepackage{siunitx}
\usepackage{pgfmath}
\parindent=0pt
\newcommand{\FPset}[2]% #1 = varaible name, #2 = value
{\expandafter\gdef\csname FPV#1\endcsname{#2}}
\newcommand{\FPunit}[2]% #1 = variable name, #2 = units
{\expandafter\gdef\csname FP... |
969,824 | I'm trying to set up a brand-new Epson WorkForce WF-3640 printer and it seems there are some weird mechanical issues. It would seem the carriage is not moving freely. This is *before* I get to install the ink cartridges.
The printer may make a loud grinding noise and return errors 0xF1, 0xEA, 0xE8, or 0xE1. Alternativ... | 2015/09/08 | [
"https://superuser.com/questions/969824",
"https://superuser.com",
"https://superuser.com/users/73918/"
] | ### 0xE8 and later 0xEA codes
>
> There is a blue tape on the interior that needs to be removed- once I did this it worked fine.
>
>
>
...
>
> I had the same issue: 0xE8 and later 0xEA codes. I could see that it
> was the white moving clip under the ink tank holder when on the far
> right that was catching it. ... | Epson technical support stated that this is a hardware failure. Standard troubleshooting steps have not produced a solution.
The printer is being replaced under warranty.
---
**Update:** The replacement printer has been set up and is fully operational. Well, defective product is defective... |
969,824 | I'm trying to set up a brand-new Epson WorkForce WF-3640 printer and it seems there are some weird mechanical issues. It would seem the carriage is not moving freely. This is *before* I get to install the ink cartridges.
The printer may make a loud grinding noise and return errors 0xF1, 0xEA, 0xE8, or 0xE1. Alternativ... | 2015/09/08 | [
"https://superuser.com/questions/969824",
"https://superuser.com",
"https://superuser.com/users/73918/"
] | ### 0xE8 and later 0xEA codes
>
> There is a blue tape on the interior that needs to be removed- once I did this it worked fine.
>
>
>
...
>
> I had the same issue: 0xE8 and later 0xEA codes. I could see that it
> was the white moving clip under the ink tank holder when on the far
> right that was catching it. ... | Same error code 0xEA for WF-3640 received today.
...multiple attempts to clear it, but each time (after I finally got the carriage to go to the left), the carriage returned to the right, locked up, and error'd out.
Called Epson...cycled through the same process, even sent them a picture of the l-shaped bracket (for w... |
969,824 | I'm trying to set up a brand-new Epson WorkForce WF-3640 printer and it seems there are some weird mechanical issues. It would seem the carriage is not moving freely. This is *before* I get to install the ink cartridges.
The printer may make a loud grinding noise and return errors 0xF1, 0xEA, 0xE8, or 0xE1. Alternativ... | 2015/09/08 | [
"https://superuser.com/questions/969824",
"https://superuser.com",
"https://superuser.com/users/73918/"
] | ### 0xE8 and later 0xEA codes
>
> There is a blue tape on the interior that needs to be removed- once I did this it worked fine.
>
>
>
...
>
> I had the same issue: 0xE8 and later 0xEA codes. I could see that it
> was the white moving clip under the ink tank holder when on the far
> right that was catching it. ... | Had 0xF1 and 0x69 errors on our Epson. Solved 0xF1 by discovering the lever on the ink carriage was open and required closing, then rebooting the machine.
0x69 was solved by re-seating the ink cartridges.
Not a good start for a brand new printer. |
969,824 | I'm trying to set up a brand-new Epson WorkForce WF-3640 printer and it seems there are some weird mechanical issues. It would seem the carriage is not moving freely. This is *before* I get to install the ink cartridges.
The printer may make a loud grinding noise and return errors 0xF1, 0xEA, 0xE8, or 0xE1. Alternativ... | 2015/09/08 | [
"https://superuser.com/questions/969824",
"https://superuser.com",
"https://superuser.com/users/73918/"
] | Epson technical support stated that this is a hardware failure. Standard troubleshooting steps have not produced a solution.
The printer is being replaced under warranty.
---
**Update:** The replacement printer has been set up and is fully operational. Well, defective product is defective... | Same error code 0xEA for WF-3640 received today.
...multiple attempts to clear it, but each time (after I finally got the carriage to go to the left), the carriage returned to the right, locked up, and error'd out.
Called Epson...cycled through the same process, even sent them a picture of the l-shaped bracket (for w... |
969,824 | I'm trying to set up a brand-new Epson WorkForce WF-3640 printer and it seems there are some weird mechanical issues. It would seem the carriage is not moving freely. This is *before* I get to install the ink cartridges.
The printer may make a loud grinding noise and return errors 0xF1, 0xEA, 0xE8, or 0xE1. Alternativ... | 2015/09/08 | [
"https://superuser.com/questions/969824",
"https://superuser.com",
"https://superuser.com/users/73918/"
] | Epson technical support stated that this is a hardware failure. Standard troubleshooting steps have not produced a solution.
The printer is being replaced under warranty.
---
**Update:** The replacement printer has been set up and is fully operational. Well, defective product is defective... | Had 0xF1 and 0x69 errors on our Epson. Solved 0xF1 by discovering the lever on the ink carriage was open and required closing, then rebooting the machine.
0x69 was solved by re-seating the ink cartridges.
Not a good start for a brand new printer. |
43,830,633 | How create query with using CriteriaQuery and EntityManager for this SQL query:
```
SELECT * FROM user WHERE user.login = '?' and user.password = '?'
```
I try so:
```
final CriteriaBuilder criteriaBuilder = getEntityManager().getCriteriaBuilder();
final CriteriaQuery<User> criteriaQuery = criteria... | 2017/05/07 | [
"https://Stackoverflow.com/questions/43830633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7785247/"
] | Your code looks like it's on the right track, except that it only has one `WHERE` condition, which does not agree with your raw SQL query, which has two conditions.
```
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<User> q = cb.createQuery(User.class);
Root<User> c = q.from(User.class);
q.select(c);
Para... | This worked for me in the end was this:
```
entityManager.getTransaction().begin();
CriteriaQuery<Object> criteriaQuery = criteriaBuilder.createQuery();
Root<Profile> fromRoot = criteriaQuery.from(Profile.class);
criteriaQuery.select(fromRoot);
criteriaQuery.where(criteriaBuilder.equal(fromRoot.... |
53,452,937 | While reading a csv file with PHP a problem occured with a line break within the CSV file. The contents of one cell will be split once a comma is followed by a line break:
```
$csv = array_map('str_getcsv', file($file));
first,second,"third,
more,text","forth"
next,dataset
```
This will result in:
```
1) firs... | 2018/11/23 | [
"https://Stackoverflow.com/questions/53452937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547262/"
] | Don't do that, use [`fgetcsv()`](https://secure.php.net/manual/en/function.fgetcsv.php). You're having problems because `file()` doesn't care about the string encapsulation in your file.
```
$fh = fopen('file.csv', 'r');
while( $line = fgetcsv($fh) ) {
// do a thing
}
fclose($fh);
```
<https://secure.php.net/m... | ```
<?php
$csvString = "ID,Condition,Condition,Condition,Condition,AdSize,Content:Text,Content:Text,Content:Text,Content:ImageUrl,Content:LandingPageUrl,Archive,Default
ID,Locations:Region,Device Properties:Device,Weather:Condition,Dmp:Liveramp,AdSize,title1,description1,price1,imageUrl1,landingPageUrl1,Archive,Defaul... |
50,488,474 | The data source passed to a report has a `Serial` property, I need to write a field in this format for every details section: [Serial] from [Top serial]
I wrote this formula for the top serial:
```
Maximum({VW_Sizes.Serial})
```
but it gets the current serial, so instead of : 1 of 2, 2 of 2
It gets 1 of 1, 2 of 2. | 2018/05/23 | [
"https://Stackoverflow.com/questions/50488474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6197785/"
] | The problem you are running into is that when each iteration of the details section prints to the report, it only knows the Max value for SERIAL for the rows that have already printed to the report.
I prefer to use a SQL Expression Field to get around this issue. This allows you to use a SQL query to retrieve the max... | You can concatenate that variable in a *Formula Field* inside your detail section with a content about this:
```
{VW_Sizes.Serial} & " from " & Maximum ({VW_Sizes.Serial})
```
otherwise you only can put a summary field with the maximum value outside the detail section, for example in *Grand Total (Report Footer)*. |
50,488,474 | The data source passed to a report has a `Serial` property, I need to write a field in this format for every details section: [Serial] from [Top serial]
I wrote this formula for the top serial:
```
Maximum({VW_Sizes.Serial})
```
but it gets the current serial, so instead of : 1 of 2, 2 of 2
It gets 1 of 1, 2 of 2. | 2018/05/23 | [
"https://Stackoverflow.com/questions/50488474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6197785/"
] | You can concatenate that variable in a *Formula Field* inside your detail section with a content about this:
```
{VW_Sizes.Serial} & " from " & Maximum ({VW_Sizes.Serial})
```
otherwise you only can put a summary field with the maximum value outside the detail section, for example in *Grand Total (Report Footer)*. | i think there is an easier way to do something like that, from the report you need to create running field from the field explorer :
* set field name e.g. (max\_Serial)
* select your field to summarize.
* after selecting your field crystal report provides multiple types of summary according to field data type.
* selec... |
50,488,474 | The data source passed to a report has a `Serial` property, I need to write a field in this format for every details section: [Serial] from [Top serial]
I wrote this formula for the top serial:
```
Maximum({VW_Sizes.Serial})
```
but it gets the current serial, so instead of : 1 of 2, 2 of 2
It gets 1 of 1, 2 of 2. | 2018/05/23 | [
"https://Stackoverflow.com/questions/50488474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6197785/"
] | The problem you are running into is that when each iteration of the details section prints to the report, it only knows the Max value for SERIAL for the rows that have already printed to the report.
I prefer to use a SQL Expression Field to get around this issue. This allows you to use a SQL query to retrieve the max... | i think there is an easier way to do something like that, from the report you need to create running field from the field explorer :
* set field name e.g. (max\_Serial)
* select your field to summarize.
* after selecting your field crystal report provides multiple types of summary according to field data type.
* selec... |
189,160 | I want to include an image that contains 4-5 graphs from diverse sources next to each other, in order to illustrate their similarities. Since I do not own any of those images I want to include, how do I properly cite them? | 2022/09/28 | [
"https://academia.stackexchange.com/questions/189160",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/163127/"
] | I'd suggest no link at all for several reasons. Most important is that you don't want the reader to go off somewhere else while reading your SoP. You want them to focus on what you write.
Also, as you note, you don't know how the SoP will be read (paper, electronic...). And, you probably have a word limit and might fi... | From my experience, only mention it in the PS if that book is truly important for your development (Do you have a good reason to justify that to yourself?). If the book is popular, it is probably unnecessary to provide extra information on the details of the book. If it is obscure, as Buffy answered, it is not a terrib... |
16,126,290 | I need to be able to check if a variable exists (if if it doesn't assign it to {}) without throwing an error in javascript. When I try this code
```
if (a) {}
```
it throws uncaughtReferenceError
What I really want to do is something like this without throwing an error:
```
a = a || {}
```
or maybe it lo... | 2013/04/20 | [
"https://Stackoverflow.com/questions/16126290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2303307/"
] | ```
if (typeof a === 'undefined'){
// variable is not available and you can write a = {}
}
```
but `a = a || {}` is shortly | ```
a = a || {}
```
simply won't work, because `a` is not defined. But you can use `typeof` to check if it exists or not.
```
a = (typeof(a) === 'undefined' ? {} : a);
``` |
16,126,290 | I need to be able to check if a variable exists (if if it doesn't assign it to {}) without throwing an error in javascript. When I try this code
```
if (a) {}
```
it throws uncaughtReferenceError
What I really want to do is something like this without throwing an error:
```
a = a || {}
```
or maybe it lo... | 2013/04/20 | [
"https://Stackoverflow.com/questions/16126290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2303307/"
] | If `a` is a global, you can use the *global object* to avoid the error. In browsers, that object is `window`:
```
window.a = window.a || {};
```
Or, as Ozerich suggested, you can use [`typeof`](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/typeof), which won't throw reference errors:
```
i... | ```
a = a || {}
```
simply won't work, because `a` is not defined. But you can use `typeof` to check if it exists or not.
```
a = (typeof(a) === 'undefined' ? {} : a);
``` |
27,216,645 | I'm looking into ways of deploying my application (web / DB / application tier) across multiple hosts while utilizing Chef. What I've come up with is **using Chef recipes to represent each step of the deployment as an individual node state**. For example if there is a step that handles the stopping of X daemons & monit... | 2014/11/30 | [
"https://Stackoverflow.com/questions/27216645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1906965/"
] | This is really not the kind of thing Chef is best for. Chef excels at convergent configuration, less so with the procedural bits. Use Chef for handling the parts where you do a convergent change like deploying new code or rewriting config files, use a procedural tool for the other bits.
As for tools to coordinate this... | Puppet and Chef are not orchestration tools and they do a very bad job from this perspective. They were not designed to be orchestration and even though some parties with specific interests are pushing the boundaries of the definition of orchestration to get Chef to be considered for orchestration, they are ignoring cr... |
26,251,429 | In a form I've 3 subgrids with N:N relation which point on the same entity (but don't display the same view).
When I create only 1 of theses subgrids, I've correctly the addbutton and I can add records in my subgrids.
But when I've more than 1 subgrid, the + button in each subgrids (and all the button like edit etc w... | 2014/10/08 | [
"https://Stackoverflow.com/questions/26251429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4120191/"
] | Hide it -
```
v.findViewById(R.id.links_bar).setVisibility(View.GONE);
```
show it again with -
```
v.findViewById(R.id.links_bar).setVisibility(View.VISIBLE);
```
or `numero_info <=0` is never `= true` | I assume you want to show/hide views from the layout.
You have correctly used setVisibility() method but FYI there are 3 attributes you can use with it:
* View.VISIBLE - which makes item visible and stays there in layout
* View.INVISIBLE - which makes item invisible but stays there in layout
* View.GONE - whic makes... |
26,251,429 | In a form I've 3 subgrids with N:N relation which point on the same entity (but don't display the same view).
When I create only 1 of theses subgrids, I've correctly the addbutton and I can add records in my subgrids.
But when I've more than 1 subgrid, the + button in each subgrids (and all the button like edit etc w... | 2014/10/08 | [
"https://Stackoverflow.com/questions/26251429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4120191/"
] | I assume you want to show/hide views from the layout.
You have correctly used setVisibility() method but FYI there are 3 attributes you can use with it:
* View.VISIBLE - which makes item visible and stays there in layout
* View.INVISIBLE - which makes item invisible but stays there in layout
* View.GONE - whic makes... | Here is an example of mine I use for animating.
Java
```
if (mIsVisibleAfter) {
mAnimatedView.setVisibility(View.Visible);
}
```
XML
```
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+i... |
26,251,429 | In a form I've 3 subgrids with N:N relation which point on the same entity (but don't display the same view).
When I create only 1 of theses subgrids, I've correctly the addbutton and I can add records in my subgrids.
But when I've more than 1 subgrid, the + button in each subgrids (and all the button like edit etc w... | 2014/10/08 | [
"https://Stackoverflow.com/questions/26251429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4120191/"
] | Hide it -
```
v.findViewById(R.id.links_bar).setVisibility(View.GONE);
```
show it again with -
```
v.findViewById(R.id.links_bar).setVisibility(View.VISIBLE);
```
or `numero_info <=0` is never `= true` | You can use the option GONE instead of INVISIBLE.
A good option is to define it in XML as GONE and when you need it make it visible.
```
<ListView
android:id="@+id/links_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:vis... |
26,251,429 | In a form I've 3 subgrids with N:N relation which point on the same entity (but don't display the same view).
When I create only 1 of theses subgrids, I've correctly the addbutton and I can add records in my subgrids.
But when I've more than 1 subgrid, the + button in each subgrids (and all the button like edit etc w... | 2014/10/08 | [
"https://Stackoverflow.com/questions/26251429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4120191/"
] | You can use the option GONE instead of INVISIBLE.
A good option is to define it in XML as GONE and when you need it make it visible.
```
<ListView
android:id="@+id/links_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:vis... | Here is an example of mine I use for animating.
Java
```
if (mIsVisibleAfter) {
mAnimatedView.setVisibility(View.Visible);
}
```
XML
```
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+i... |
26,251,429 | In a form I've 3 subgrids with N:N relation which point on the same entity (but don't display the same view).
When I create only 1 of theses subgrids, I've correctly the addbutton and I can add records in my subgrids.
But when I've more than 1 subgrid, the + button in each subgrids (and all the button like edit etc w... | 2014/10/08 | [
"https://Stackoverflow.com/questions/26251429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4120191/"
] | Hide it -
```
v.findViewById(R.id.links_bar).setVisibility(View.GONE);
```
show it again with -
```
v.findViewById(R.id.links_bar).setVisibility(View.VISIBLE);
```
or `numero_info <=0` is never `= true` | Here is an example of mine I use for animating.
Java
```
if (mIsVisibleAfter) {
mAnimatedView.setVisibility(View.Visible);
}
```
XML
```
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+i... |
40,250,590 | I want to Partition the input number to use its ciphers.
For example, I have an input number : 1563
How can I separate 1, 5, 6 and 3 and use them as separate integers?
```
package todicemal;
public class um {
public static void main(String[] args) {
// TODO Auto-generated method stub
int k=... | 2016/10/25 | [
"https://Stackoverflow.com/questions/40250590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7061863/"
] | Here's a simple and more elegant way of what you're trying to do.
First, simplify your function (if your'e going to be using it in a pipe, it doesn't need to take the entire df as an argument):
```
fun.rb <- function(estimate, baseline){
(estimate-baseline)/(baseline)*100
}
```
Now, all you need to do is crea... | This may not be the most elegant. I'm just a hack. But I think it does what you want.
```
> library(dplyr)
> newdf <- df %>% filter(method=="method0") %>%
+ rename(method0_value = estimate) %>%
+ select(-method)
> head(newdf)
site group method0_value
1 A group1 2.529237
2 B group2 7.863411
```... |
13,547,367 | I have a question about Safety. I have a Javascript variable:
```
var toSearch = "something"
```
I want to send this variable to another php page. I'm using sessions: `<?php session_start(); ?>`
From what I've read I need to use a AJAX GET/POST procedure to pass this javascript client side variable to PHP server si... | 2012/11/25 | [
"https://Stackoverflow.com/questions/13547367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850432/"
] | It's only unsafe depending on what you do with it. Anyone can type whatever they like in the address bar, and you have no control over that. For instance, I could go to
```
http://example.com/myphpfile.php?name=fuzzball
```
Now, that's not a danger in itself, but if I were to put some MySQL code and you were placing... | Well the better solution would be to go with an ajax request if you dont want to force page reload. regarding security its the same hence every user can manipulate querystrings with ease... we have an address bar for this :)
```
window.XMLHttpRequest = window.XMLHttpRequest || window.ActiveXObject('MSXML2.XMLHTTP') ||... |
13,547,367 | I have a question about Safety. I have a Javascript variable:
```
var toSearch = "something"
```
I want to send this variable to another php page. I'm using sessions: `<?php session_start(); ?>`
From what I've read I need to use a AJAX GET/POST procedure to pass this javascript client side variable to PHP server si... | 2012/11/25 | [
"https://Stackoverflow.com/questions/13547367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850432/"
] | It's only unsafe depending on what you do with it. Anyone can type whatever they like in the address bar, and you have no control over that. For instance, I could go to
```
http://example.com/myphpfile.php?name=fuzzball
```
Now, that's not a danger in itself, but if I were to put some MySQL code and you were placing... | If you are not good with JavaScript or Ajax requests, I suggest the jquery .ajax method. jQuery is really well-documented and great for beginners.
Also, your variable is not set properly. Should be:
```
var toSearch = "something";
```
So visit: <http://api.jquery.com/jQuery.ajax/> to get started.
A sample of how t... |
13,547,367 | I have a question about Safety. I have a Javascript variable:
```
var toSearch = "something"
```
I want to send this variable to another php page. I'm using sessions: `<?php session_start(); ?>`
From what I've read I need to use a AJAX GET/POST procedure to pass this javascript client side variable to PHP server si... | 2012/11/25 | [
"https://Stackoverflow.com/questions/13547367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850432/"
] | Well the better solution would be to go with an ajax request if you dont want to force page reload. regarding security its the same hence every user can manipulate querystrings with ease... we have an address bar for this :)
```
window.XMLHttpRequest = window.XMLHttpRequest || window.ActiveXObject('MSXML2.XMLHTTP') ||... | If you are not good with JavaScript or Ajax requests, I suggest the jquery .ajax method. jQuery is really well-documented and great for beginners.
Also, your variable is not set properly. Should be:
```
var toSearch = "something";
```
So visit: <http://api.jquery.com/jQuery.ajax/> to get started.
A sample of how t... |
33,354 | I am the owner of a Google Group. I am using the new interface. The group is a public group and is available at <https://groups.google.com/forum/?fromgroups=&nomobile=true#!forum/sr-api>.
I cannot find a way to subscribe to new posts using an RSS reader. I have done some googling and it seems that the new Google Grou... | 2012/10/17 | [
"https://webapps.stackexchange.com/questions/33354",
"https://webapps.stackexchange.com",
"https://webapps.stackexchange.com/users/25097/"
] | You can find it here:
<https://groups.google.com/group/sr-api/about?noredirect>
The link is currently missing from the About page in the new Group groups. | Combining answers by [Rich Feit](https://webapps.stackexchange.com/a/33390/30592) and [vishvAs vAsuki](https://webapps.stackexchange.com/a/41045/30592), the about page for your project is reached via
<https://groups.google.com/group/sr-api/about?noredirect> please replace `sr-api` with your group
This will lead to li... |
44,567,580 | I'm writing a custom control that inherits ItemsControl. I need to call a method whenever certain properties change. For my own dependency properties I can call this in the setter no problem, but for inherited ones like ItemsSource I don't know how to do this and I'd like to learn how without overriding the whole thing... | 2017/06/15 | [
"https://Stackoverflow.com/questions/44567580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5357729/"
] | There's a new method in UWP called `RegisterPropertyChangedCallback` designed just for this. For example, the following is how I remove the default entrance transition in an extended `GridView` control.
```
// Remove the default entrance transition if existed.
RegisterPropertyChangedCallback(ItemContainerTransitionsPr... | For the `ItemsSource` property you could just override the `OnItemsSourceChanged` method but for any other dependency property you could use a `DependencyPropertyDescriptor`:
```
public class MyItemsControl : ItemsControl
{
public MyItemsControl()
{
DependencyPropertyDescriptor dpd = DependencyProperty... |
70,878,553 | So I'm trying to migrate a table from MySQL to MSSQL (`sql server migration assistant MySQL`), but I get this error:
```
Migrating data...
Analyzing metadata...
Preparing table testreportingdebug.testcase...
Preparing data migration package...
Starting data migration Engine
Starting data migration...
The data migratio... | 2022/01/27 | [
"https://Stackoverflow.com/questions/70878553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15552128/"
] | There's the [Python debugging console](https://code.visualstudio.com/docs/python/debugging) in VSCode.
When your code stops on a breakpoint, you can click on the debug console button to open an interactive Python console with your current program state loaded in.
[ request, where someone pointed the Debug-Console out which lets you interact with python at the point, where you're debugging. |
70,878,553 | So I'm trying to migrate a table from MySQL to MSSQL (`sql server migration assistant MySQL`), but I get this error:
```
Migrating data...
Analyzing metadata...
Preparing table testreportingdebug.testcase...
Preparing data migration package...
Starting data migration Engine
Starting data migration...
The data migratio... | 2022/01/27 | [
"https://Stackoverflow.com/questions/70878553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15552128/"
] | There's the [Python debugging console](https://code.visualstudio.com/docs/python/debugging) in VSCode.
When your code stops on a breakpoint, you can click on the debug console button to open an interactive Python console with your current program state loaded in.
[](https://i.stack.imgur.com/02fyF.jpg)
Here is a video where it shows how to debug a server written in python and goes over the code using debug console: <http... |
38,731,743 | transition opacity from 0 to 1 is not working. here is my code: <https://jsfiddle.net/ax4aLhjq/19/>
```
//html
<div id="a">
<div style="height:20px"></div>
</div>
//css
#a{
width:200px;
background-color:salmon;
margin:0px;
padding:0px;
height:200px;
overflow: auto;
}
#a .item{
margin:0px 5px;
backg... | 2016/08/02 | [
"https://Stackoverflow.com/questions/38731743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/714211/"
] | I've found the answer here: <https://timtaubert.de/blog/2012/09/css-transitions-for-dynamically-created-dom-elements/>
It appears that when an element is added, repaint is needed and somehow the browser is trying to optimize the computation, and is doing the opacity=0 and opacity=1 in the same cycle.
The solution is t... | **Problem:**
You are setting the `opacity`to `1` the same time you were creating the element.
**Solution:**
You have to delay tha action of showing the element, you need to set the opacity within a timeout to make the animation effect otherwise all elements will be just appended.
You can see this snippet I used a `... |
38,731,743 | transition opacity from 0 to 1 is not working. here is my code: <https://jsfiddle.net/ax4aLhjq/19/>
```
//html
<div id="a">
<div style="height:20px"></div>
</div>
//css
#a{
width:200px;
background-color:salmon;
margin:0px;
padding:0px;
height:200px;
overflow: auto;
}
#a .item{
margin:0px 5px;
backg... | 2016/08/02 | [
"https://Stackoverflow.com/questions/38731743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/714211/"
] | **Problem:**
You are setting the `opacity`to `1` the same time you were creating the element.
**Solution:**
You have to delay tha action of showing the element, you need to set the opacity within a timeout to make the animation effect otherwise all elements will be just appended.
You can see this snippet I used a `... | Make a setTimeout like this *window.setTimeout(function(){div.style.opacity=1;},17);*. So the animation will effect next time. |
38,731,743 | transition opacity from 0 to 1 is not working. here is my code: <https://jsfiddle.net/ax4aLhjq/19/>
```
//html
<div id="a">
<div style="height:20px"></div>
</div>
//css
#a{
width:200px;
background-color:salmon;
margin:0px;
padding:0px;
height:200px;
overflow: auto;
}
#a .item{
margin:0px 5px;
backg... | 2016/08/02 | [
"https://Stackoverflow.com/questions/38731743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/714211/"
] | I've found the answer here: <https://timtaubert.de/blog/2012/09/css-transitions-for-dynamically-created-dom-elements/>
It appears that when an element is added, repaint is needed and somehow the browser is trying to optimize the computation, and is doing the opacity=0 and opacity=1 in the same cycle.
The solution is t... | Make a setTimeout like this *window.setTimeout(function(){div.style.opacity=1;},17);*. So the animation will effect next time. |
1,579,306 | They're more noticeable when in maximize windows:
>
> [](https://i.stack.imgur.com/YLX5v.png).
>
>
> | 2020/08/20 | [
"https://superuser.com/questions/1579306",
"https://superuser.com",
"https://superuser.com/users/1209370/"
] | These borders are part of the default Windows 7 windows appearance. Eithe set your border to 0 pixels width or use an alternative style.
Both may require hacks, and will not be limited to just IrfanView | As of Version 4.60 (Release date: 2022-03-18) there is a shortcut that will permit "thin" borders, in a way similar to the original request:
New hotkey: `ALT` + `SHIFT` + `B`: Show thin or normal border (current session only) |
62,233,061 | I've been re-factoring some code and using it to explore how to structure maintainable, flexible, concise code when using Pandas and Numpy. (Usually I only use them briefly, I'm now in a role where I should be aiming to become an ex-spurt.)
One example I came across is a function that can sometimes be called on one co... | 2020/06/06 | [
"https://Stackoverflow.com/questions/62233061",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53341/"
] | ```
In [101]: df = pd.DataFrame(np.arange(12).reshape(4,3))
In [102]: df
Out[102]:
0 1 2
0 0 1 2
1 3 4 5
2 6 7 8
3 9 10 11
```
You are making a (n,m) array from n columns of the dataframe:
```
In [1... | I don't like accepting my own answers, so I'm not going to change the accepted answer.
@hpaulj helped me explore this problem further by making additional functionality and opportunities clear to me. This helped me more clearly define my competing objectives, and also to be able to begin ascribing priority to them.
1... |
7,486,543 | I need to store an CARD ID number in Database. So there is no calculation just a search of the ID and putting the value in Session as property in a class.
The is ID is always numeric and it's 12 positions.
e.g. 123456789012 and I would like to show on the screen in this format. 123.456.789.012 (every 3 digit a dot).
... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7486543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472092/"
] | `nvarchar` is definitely not needed. if it's always 12 digits, `char(12)` would be fine, but I think a 64-bit integer would be most appropriate. | If you need to store the formatting, and it's just a numeric value, use varchar, don't waste time with nvarchar as it increases your storage size and won't do you any good unless you expect special (international) chars |
7,486,543 | I need to store an CARD ID number in Database. So there is no calculation just a search of the ID and putting the value in Session as property in a class.
The is ID is always numeric and it's 12 positions.
e.g. 123456789012 and I would like to show on the screen in this format. 123.456.789.012 (every 3 digit a dot).
... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7486543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472092/"
] | Try writing
```
lblCardID.Text = ent.CardID.ToString("#,###")
```
You can user the `decimal(12,0)` or the `bigint` datatype. `bigint` requires one byte less (8 bytes total) per stored value. | If it's never going to be calculated on, I would store it as char(12).
Then in your code, split it with something like this and use the replace function to convert commas to dots:
`lblCardID.Text = ent.CardID.ToString("#,###").Replace(",", ".")` |
7,486,543 | I need to store an CARD ID number in Database. So there is no calculation just a search of the ID and putting the value in Session as property in a class.
The is ID is always numeric and it's 12 positions.
e.g. 123456789012 and I would like to show on the screen in this format. 123.456.789.012 (every 3 digit a dot).
... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7486543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472092/"
] | `nvarchar` is definitely not needed. if it's always 12 digits, `char(12)` would be fine, but I think a 64-bit integer would be most appropriate. | If it's never going to be calculated on, I would store it as char(12).
Then in your code, split it with something like this and use the replace function to convert commas to dots:
`lblCardID.Text = ent.CardID.ToString("#,###").Replace(",", ".")` |
7,486,543 | I need to store an CARD ID number in Database. So there is no calculation just a search of the ID and putting the value in Session as property in a class.
The is ID is always numeric and it's 12 positions.
e.g. 123456789012 and I would like to show on the screen in this format. 123.456.789.012 (every 3 digit a dot).
... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7486543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472092/"
] | Try writing
```
lblCardID.Text = ent.CardID.ToString("#,###")
```
You can user the `decimal(12,0)` or the `bigint` datatype. `bigint` requires one byte less (8 bytes total) per stored value. | If it's an ID number store it as a string datatype, you're not going to be doing sums on it, you also won't have problems losing any leading zeros. You could also then store the card id with the embedded dots, sorting out your formatting problems. |
7,486,543 | I need to store an CARD ID number in Database. So there is no calculation just a search of the ID and putting the value in Session as property in a class.
The is ID is always numeric and it's 12 positions.
e.g. 123456789012 and I would like to show on the screen in this format. 123.456.789.012 (every 3 digit a dot).
... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7486543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472092/"
] | `nvarchar` is definitely not needed. if it's always 12 digits, `char(12)` would be fine, but I think a 64-bit integer would be most appropriate. | If it's an ID number store it as a string datatype, you're not going to be doing sums on it, you also won't have problems losing any leading zeros. You could also then store the card id with the embedded dots, sorting out your formatting problems. |
7,486,543 | I need to store an CARD ID number in Database. So there is no calculation just a search of the ID and putting the value in Session as property in a class.
The is ID is always numeric and it's 12 positions.
e.g. 123456789012 and I would like to show on the screen in this format. 123.456.789.012 (every 3 digit a dot).
... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7486543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472092/"
] | I would use [`bigint`](http://msdn.microsoft.com/en-us/library/aa933198%28v=sql.80%29.aspx) because it needs only 8 bytes per value.
[`decimal(12,0)`](http://msdn.microsoft.com/en-us/library/aa258832%28v=sql.80%29.aspx) needs 9 bytes and `varchar` or `nvarchar` even more (12 or 24 bytes respectively in case of storin... | If it's an ID number store it as a string datatype, you're not going to be doing sums on it, you also won't have problems losing any leading zeros. You could also then store the card id with the embedded dots, sorting out your formatting problems. |
7,486,543 | I need to store an CARD ID number in Database. So there is no calculation just a search of the ID and putting the value in Session as property in a class.
The is ID is always numeric and it's 12 positions.
e.g. 123456789012 and I would like to show on the screen in this format. 123.456.789.012 (every 3 digit a dot).
... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7486543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472092/"
] | The colon is coming from the colon in your format string. The "0:" at the beginning of the format string is needed when you are using string.Format(), as a placeholder to identify which of the arguments to format, but not if you are using ToString() (since there's only one value being formatted). | If it's an ID number store it as a string datatype, you're not going to be doing sums on it, you also won't have problems losing any leading zeros. You could also then store the card id with the embedded dots, sorting out your formatting problems. |
7,486,543 | I need to store an CARD ID number in Database. So there is no calculation just a search of the ID and putting the value in Session as property in a class.
The is ID is always numeric and it's 12 positions.
e.g. 123456789012 and I would like to show on the screen in this format. 123.456.789.012 (every 3 digit a dot).
... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7486543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472092/"
] | Try writing
```
lblCardID.Text = ent.CardID.ToString("#,###")
```
You can user the `decimal(12,0)` or the `bigint` datatype. `bigint` requires one byte less (8 bytes total) per stored value. | Does your identifier's domain have matematical properties, other than being composed of digits? If not, your value is fixed width, so use `CHAR(12)`. Do not forget to add appropriate domain checks (no characters other than digits, no leading zero, etc) e.g.
```
CREATE TABLE Cards
(
card_ID CHAR(12) NOT NULL
UNI... |
7,486,543 | I need to store an CARD ID number in Database. So there is no calculation just a search of the ID and putting the value in Session as property in a class.
The is ID is always numeric and it's 12 positions.
e.g. 123456789012 and I would like to show on the screen in this format. 123.456.789.012 (every 3 digit a dot).
... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7486543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472092/"
] | The colon is coming from the colon in your format string. The "0:" at the beginning of the format string is needed when you are using string.Format(), as a placeholder to identify which of the arguments to format, but not if you are using ToString() (since there's only one value being formatted). | Does your identifier's domain have matematical properties, other than being composed of digits? If not, your value is fixed width, so use `CHAR(12)`. Do not forget to add appropriate domain checks (no characters other than digits, no leading zero, etc) e.g.
```
CREATE TABLE Cards
(
card_ID CHAR(12) NOT NULL
UNI... |
7,486,543 | I need to store an CARD ID number in Database. So there is no calculation just a search of the ID and putting the value in Session as property in a class.
The is ID is always numeric and it's 12 positions.
e.g. 123456789012 and I would like to show on the screen in this format. 123.456.789.012 (every 3 digit a dot).
... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7486543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472092/"
] | Try writing
```
lblCardID.Text = ent.CardID.ToString("#,###")
```
You can user the `decimal(12,0)` or the `bigint` datatype. `bigint` requires one byte less (8 bytes total) per stored value. | If you need to store the formatting, and it's just a numeric value, use varchar, don't waste time with nvarchar as it increases your storage size and won't do you any good unless you expect special (international) chars |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.