qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
40,160,233 | I'm looking for a set data structure that's optimised for a very low probability that an item is part of the set.
The use case is the Gnip/Twitter compliance firehose where we get approx 1,000 events per second (that's deletions from all of Twitter). We have a table of, let's say 10 million stored tweets (growing by ... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40160233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/148423/"
] | Your upload script doesn't appear to be setting the `GOOGLE_APP_ID` var.It should something like:
**# Replace this with the `GOOGLE_APP_ID` from your `GoogleService-Info.plist` file**
```
1:xxxxxxxxx:ios:xxxxxxxxxxx=1:my:app:id
```
**`# Replace the /Path/To/ServiceAccount.json with the path to the key you just down... | Your upload script doesn't appear to be setting the GOOGLE\_APP\_ID env var. The upload run script step should look something like the following:
```
# Replace this with the GOOGLE_APP_ID from your GoogleService-Info.plist file
GOOGLE_APP_ID=1:1234567890123:ios:1234abc567de89
# Replace the /Path/To/ServiceAccount.js... |
15,809,497 | I have a class like this:
```
class MyClass(object):
def f_1(self,x):
return foo(x, self.property_1)
def f_2(self,x):
return foo(x, self.property_2)
```
The idea is that multiple functions `f_n` have a common structure, but depend on different properties `property_n` of the class.
I look f... | 2013/04/04 | [
"https://Stackoverflow.com/questions/15809497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1954677/"
] | If you want to generate these methods *per class*, use a class decorator:
```
def property_functions(**properties):
def construct_method(prop):
def f_n(self):
return foo(getattr(self, prop))
return f_n
def class_decorator(cls):
for name, prop in properties.iteritems():
... | You can have a look at **getattr** or **getattribute** . They allow you dynamically create and reference attributes. For ex
It works something like this:
```
class foo:
def __init__(self):
self.a = "a"
def __getattr__(self, attribute):
return "You asked for %s, but I'm giving you default" % at... |
5,295,568 | I'm trying to solve project euler [problem #54](http://projecteuler.net/index.php?section=problems&id=54) in C#, but I'm confused to understand what to they mean with **5H 5C 6S 7S KD**? Could anyone please help in understanding this part? | 2011/03/14 | [
"https://Stackoverflow.com/questions/5295568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/658327/"
] | The question is about playing cards; 5-of-hearts, 5-of-clubs, 6-of-spades, 7-of-spades, king-of-diamonds; i.e. 5♥ 5♣ 6♠ 7♠ K♦ | It just describes a hand of the following cards:
* 5 of hearts
* 5 of clubs
* 6 of spades
* 7 of spades
* King of diamonds |
26,874,187 | I have a datatable. I would like to list the double entries. This would I make with a simple sql query like this:
```
SELECT artnr, COUNT(artnr) AS cnt FROM table GROUP BY artnr HAVING COUNT(artnr)>1
```
How should this looke with linq?
Every time, when I need to work with linq, I get always stuck with it. I dislik... | 2014/11/11 | [
"https://Stackoverflow.com/questions/26874187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1958929/"
] | Not sure what your table looks like, but give this a try.
Also I'm sure there are plenty of answers on stack that illustrate grouping in VB.
This might be a duplicate question.
```
Dim artnrGroups = From a In table _
Group a By Key = a.artnr Into Group _
Where Group.Count() > ... | And you can put the Count() into that query like this
```
Dim duplicateRows = From row In table _
Group row By row.artnr Into g _
Where g.Count() > 1 _
Select row
``` |
4,938,975 | ```
<html>
<head>
<style type="text/css">
a{
color: #753C52;
font-weight:bold;
font-size:11px;
text-decoration:none;
border: solid 1px yellow;
}
.viewInBrowserLinkStyle {
color: #666666;
font-size: 20px;
line-height: 14px;
border: solid 1px red;
text-decoration:underlined;
... | 2011/02/08 | [
"https://Stackoverflow.com/questions/4938975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265650/"
] | It's `underline`, not `underlined`. | *underlined* should be *underline* |
4,938,975 | ```
<html>
<head>
<style type="text/css">
a{
color: #753C52;
font-weight:bold;
font-size:11px;
text-decoration:none;
border: solid 1px yellow;
}
.viewInBrowserLinkStyle {
color: #666666;
font-size: 20px;
line-height: 14px;
border: solid 1px red;
text-decoration:underlined;
... | 2011/02/08 | [
"https://Stackoverflow.com/questions/4938975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265650/"
] | It's `underline`, not `underlined`. | Because it is `text-decoration: underline` |
4,938,975 | ```
<html>
<head>
<style type="text/css">
a{
color: #753C52;
font-weight:bold;
font-size:11px;
text-decoration:none;
border: solid 1px yellow;
}
.viewInBrowserLinkStyle {
color: #666666;
font-size: 20px;
line-height: 14px;
border: solid 1px red;
text-decoration:underlined;
... | 2011/02/08 | [
"https://Stackoverflow.com/questions/4938975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265650/"
] | It's `underline`, not `underlined`. | To fix this you need to change your stylesheet a little. So instead of `.viewInBrowserLinkStyle` you should use `a.viewInBrowserLinkStyle`. Then it will work. This is because you are globally specifying all anchor tags to not be underlined. And to override that you need to specify any anchor tag with that classname nee... |
4,938,975 | ```
<html>
<head>
<style type="text/css">
a{
color: #753C52;
font-weight:bold;
font-size:11px;
text-decoration:none;
border: solid 1px yellow;
}
.viewInBrowserLinkStyle {
color: #666666;
font-size: 20px;
line-height: 14px;
border: solid 1px red;
text-decoration:underlined;
... | 2011/02/08 | [
"https://Stackoverflow.com/questions/4938975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265650/"
] | It's `underline`, not `underlined`. | You wrote wrong the attribute, it's `text-decoration: underline`, not *underlined*.
If still you don't uses, I recommend to you use debug tools, it's more easy to identify these problems and erros.
This link shows some CSS debug tools: <http://designshack.co.uk/articles/css/html-and-css-debugging-tools> |
4,938,975 | ```
<html>
<head>
<style type="text/css">
a{
color: #753C52;
font-weight:bold;
font-size:11px;
text-decoration:none;
border: solid 1px yellow;
}
.viewInBrowserLinkStyle {
color: #666666;
font-size: 20px;
line-height: 14px;
border: solid 1px red;
text-decoration:underlined;
... | 2011/02/08 | [
"https://Stackoverflow.com/questions/4938975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265650/"
] | *underlined* should be *underline* | Because it is `text-decoration: underline` |
4,938,975 | ```
<html>
<head>
<style type="text/css">
a{
color: #753C52;
font-weight:bold;
font-size:11px;
text-decoration:none;
border: solid 1px yellow;
}
.viewInBrowserLinkStyle {
color: #666666;
font-size: 20px;
line-height: 14px;
border: solid 1px red;
text-decoration:underlined;
... | 2011/02/08 | [
"https://Stackoverflow.com/questions/4938975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265650/"
] | *underlined* should be *underline* | To fix this you need to change your stylesheet a little. So instead of `.viewInBrowserLinkStyle` you should use `a.viewInBrowserLinkStyle`. Then it will work. This is because you are globally specifying all anchor tags to not be underlined. And to override that you need to specify any anchor tag with that classname nee... |
4,938,975 | ```
<html>
<head>
<style type="text/css">
a{
color: #753C52;
font-weight:bold;
font-size:11px;
text-decoration:none;
border: solid 1px yellow;
}
.viewInBrowserLinkStyle {
color: #666666;
font-size: 20px;
line-height: 14px;
border: solid 1px red;
text-decoration:underlined;
... | 2011/02/08 | [
"https://Stackoverflow.com/questions/4938975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265650/"
] | *underlined* should be *underline* | You wrote wrong the attribute, it's `text-decoration: underline`, not *underlined*.
If still you don't uses, I recommend to you use debug tools, it's more easy to identify these problems and erros.
This link shows some CSS debug tools: <http://designshack.co.uk/articles/css/html-and-css-debugging-tools> |
3,643,977 | I want to prove the following equation
$$\frac{-\sqrt{2 - \sqrt{2 - \sqrt{2}}}}{\sqrt{2}} + \frac{\sqrt{2 + \sqrt{2}}}{\sqrt{2} \sqrt{2 - \sqrt{2 - \sqrt{2}}}}$$
I know this must be equal to $\sqrt{2-\sqrt{2+\sqrt{2}}}$, but I find it pretty hard to prove it manually, without requiring a calculator nor estimates (sinc... | 2020/04/25 | [
"https://math.stackexchange.com/questions/3643977",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/351735/"
] | Note that the second term of the LHS can be expressed as
$$\begin{align}
\frac{\sqrt{2 + \sqrt{2} }}{\sqrt{2} \sqrt{2 - \sqrt{2 - \sqrt{2}}}}
=\frac{\sqrt{2 + \sqrt{2 - \sqrt{2}}}}
{\sqrt{2}}
\end{align}$$
which can be verified by cross multiply. Then,
$$LHS = \sqrt{ \frac{2 + \sqrt{2 - \sqrt{2}}} {2} }
- \sqrt{ \fra... | $a=\sqrt{2-\sqrt{2-\sqrt{2}}}+\sqrt{2-\sqrt{2+\sqrt{2}}}$
$a^2=4+\sqrt{2}$
$a=\sqrt{2(2+\sqrt{2})}$
$b=\sqrt{2-\sqrt{2-\sqrt{2}}}\*\sqrt{2-\sqrt{2+\sqrt{2}}}=\sqrt{4+\sqrt{2}-2(\sqrt{2-\sqrt{2-\sqrt{2}}}+\sqrt{2-\sqrt{2+\sqrt{2}}})}=\sqrt{4+\sqrt{2}-2(\sqrt{2(2+\sqrt{2})})} $
$-\sqrt{2-\sqrt{2-\sqrt{2}}}/\sqrt{2}+\... |
54,510,317 | Here's my dataset
```
id descriptions
0 kartu debit 20 10 indomaretcipete r
1 tarikan atm 20 10
2 tarikan atm 19 10
3 biaya a... | 2019/02/04 | [
"https://Stackoverflow.com/questions/54510317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7585973/"
] | IIUC, you need to remove numbers from the dataframe, use below:
```
df_new=df.replace('\d+ ','',regex=True)
print(df_new)
id descriptions
0 0 kartu debit indomaretcipete r
1 1 tarikan atm 10
2 2 tarikan atm 10
3 3 biaya adm
4 4 ... | You need:
```
def replace_numbers(s):
return re.sub(r'\d*', '', s)
df['description'] = df['description'].apply(replace_numbers)
``` |
54,510,317 | Here's my dataset
```
id descriptions
0 kartu debit 20 10 indomaretcipete r
1 tarikan atm 20 10
2 tarikan atm 19 10
3 biaya a... | 2019/02/04 | [
"https://Stackoverflow.com/questions/54510317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7585973/"
] | Use [`str.extractall`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.str.extractall.html) and [`groupby.agg`](https://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.core.groupby.DataFrameGroupBy.agg.html):
```
df['descriptions'] = (df['descriptions'].str.extractall('([a-zA_Z]+... | You need:
```
def replace_numbers(s):
return re.sub(r'\d*', '', s)
df['description'] = df['description'].apply(replace_numbers)
``` |
190,816 | I have an Risk/Issue where the user selects from a drop down list if the item is an issue or a risk.
Two fields severity and probability calculate together to give a score for Risks in my list. My problem is that I've been asked is it possible to make probability read only if the user selects an issue when creating a ... | 2016/08/17 | [
"https://sharepoint.stackexchange.com/questions/190816",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/34232/"
] | Calling a JavaScript function is not supported by any kind of workflow manager which means that you cannot call your java scripts functions in workflow. Now if you want to perform something in list, you have an option of using Web Service. So you can research more on web service instead of calling java script | You can not call JavaScript function but you can call web service from SharePoint workflow.
[Working with Web Services in SharePoint 2013 Workflows using SharePoint Designer 2013](https://msdn.microsoft.com/en-us/library/office/dn567558.aspx) |
23,562 | I am using Magento 1.8. and custom theme.
I have added the button called BUY NOW for each product, and url of that button is
`echo Mage::helper('checkout/url')->getCheckoutUrl($_product);`
It redirects to checkout but Its unable to add that product to cart.
How it is possible to add product to cart and redirect to ... | 2014/06/10 | [
"https://magento.stackexchange.com/questions/23562",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/6316/"
] | To add product in the cart and from there you can proceed to checkout.
Try
```
Mage::helper('checkout/cart')->getAddUrl($_product);
```
This will generate add to cart link | If I understand correctly, you've essentially renamed the "Add to cart" button to "Buy now" and would like to by-pass the cart and go directly to the checkout page.
To achieve this do the following:
1. Copy **CartController.php** from **/app/code/core/Mage/Checkout/controllers/** to **/app/code/local/Mage/Checkout/co... |
23,562 | I am using Magento 1.8. and custom theme.
I have added the button called BUY NOW for each product, and url of that button is
`echo Mage::helper('checkout/url')->getCheckoutUrl($_product);`
It redirects to checkout but Its unable to add that product to cart.
How it is possible to add product to cart and redirect to ... | 2014/06/10 | [
"https://magento.stackexchange.com/questions/23562",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/6316/"
] | To add product in the cart and from there you can proceed to checkout.
Try
```
Mage::helper('checkout/cart')->getAddUrl($_product);
```
This will generate add to cart link | Magento generates an add to cart url for add to cart buttons.
It's in the form of
`http://{YOUR SITE NAME}/checkout/cart/add/uenc/{Base64 Encoded Redirect Url},/product/{PRODUCT ID}/form_key/{FORM KEY}/`
```
$url = strtr(base64_encode($url), '+/=', '-_,'); // for base64 encode
$form_key = Mage::getSingleton('core/s... |
23,562 | I am using Magento 1.8. and custom theme.
I have added the button called BUY NOW for each product, and url of that button is
`echo Mage::helper('checkout/url')->getCheckoutUrl($_product);`
It redirects to checkout but Its unable to add that product to cart.
How it is possible to add product to cart and redirect to ... | 2014/06/10 | [
"https://magento.stackexchange.com/questions/23562",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/6316/"
] | To add product in the cart and from there you can proceed to checkout.
Try
```
Mage::helper('checkout/cart')->getAddUrl($_product);
```
This will generate add to cart link | Kindly open app/design/frontend/package/theme/template/catalog/product/view.phtml
Add below line into `<form>` Tag
```
<input type="hidden" name="buy_now" id="buy_now" value="" />
```
Put below button at anywhere where you want
```
<button type="button" onclick="jQuery('#buy_now').val('buy_now');productAddToCartFo... |
15,401,714 | I have created a program that I need to run constantly. It currently lives at scripts/mailman. I start it by doing this:
```
sudo bundle exec rails runner script/mailman &
```
It seams to stop after I logout of the server. Here is the contents of my mailman program:
```
#!/usr/bin/env ruby
require "rubygems"
requir... | 2013/03/14 | [
"https://Stackoverflow.com/questions/15401714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/985723/"
] | create a Timer:
```
Timer timer = new Timer();
```
if you need to run it once then:
```
timer.schedule(new TimerTask() {
@Override
public void run() {
// Your code here
}
}, 2*1000);
```
to run repeatedly:
```
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
// You... | You could make a Runnable that is a wrapper for your list of Runnables, and keeps track of what is sent. Then give that single Runnable as the object for the scheduler.
```
public class RunnableList implements Runnable {
private List<Runnable> runList = Collections.synchronizedList(
... |
15,401,714 | I have created a program that I need to run constantly. It currently lives at scripts/mailman. I start it by doing this:
```
sudo bundle exec rails runner script/mailman &
```
It seams to stop after I logout of the server. Here is the contents of my mailman program:
```
#!/usr/bin/env ruby
require "rubygems"
requir... | 2013/03/14 | [
"https://Stackoverflow.com/questions/15401714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/985723/"
] | create a Timer:
```
Timer timer = new Timer();
```
if you need to run it once then:
```
timer.schedule(new TimerTask() {
@Override
public void run() {
// Your code here
}
}, 2*1000);
```
to run repeatedly:
```
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
// You... | One question. Does these Runnables need to be executed N seconds *after* its previous runnable has completed or N seconds after the previous was scheduled.
If the latter you can continously schedule and increment a time counter.
```
int timeToWait = 2000;
ScheduledExecutorService scheduler =Executors.newScheduledTh... |
4,293,811 | For example, imagine a Javascript app running in Safari, containing some local in memory state, and is partway through execution (say, it's spinning an animated ball). What happens if the phone rings and I pick up? Will the animation continue from where it left off when I return to the browser?
If Safari doesn't do th... | 2010/11/27 | [
"https://Stackoverflow.com/questions/4293811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173773/"
] | Yes, use a paged datagrid. Its a better practice.
EDIT : `<asp:DataGrid ID="DataGrid1" AllowPaging="True" />`
After allowing paging to datagrid, you'l need to do something like this..
```
private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid... | You can add `LIMIT 10` to only show 10 rows.
`LIMIT 30, 10` will show 10 rows, starting at row 30. |
4,293,811 | For example, imagine a Javascript app running in Safari, containing some local in memory state, and is partway through execution (say, it's spinning an animated ball). What happens if the phone rings and I pick up? Will the animation continue from where it left off when I return to the browser?
If Safari doesn't do th... | 2010/11/27 | [
"https://Stackoverflow.com/questions/4293811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173773/"
] | Yes, use a paged datagrid. Its a better practice.
EDIT : `<asp:DataGrid ID="DataGrid1" AllowPaging="True" />`
After allowing paging to datagrid, you'l need to do something like this..
```
private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid... | 1)
Also you can achieve this by using Stored Procedure, Please see [here](http://www.codeproject.com/KB/database/row_number.aspx) for more. RowNumber does the magic in SQL Server, I am not sure about Oracle or other DB whether RowNumber exist in that.
```
CREATE PROCEDURE [dbo].[sp_getzipcodes]
@start int = 0
... |
4,293,811 | For example, imagine a Javascript app running in Safari, containing some local in memory state, and is partway through execution (say, it's spinning an animated ball). What happens if the phone rings and I pick up? Will the animation continue from where it left off when I return to the browser?
If Safari doesn't do th... | 2010/11/27 | [
"https://Stackoverflow.com/questions/4293811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173773/"
] | Yes, use a paged datagrid. Its a better practice.
EDIT : `<asp:DataGrid ID="DataGrid1" AllowPaging="True" />`
After allowing paging to datagrid, you'l need to do something like this..
```
private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid... | I did a blog post on Custom Paging and Sorting for the Telerik RadGrid. The concepts are still valid for an ASP GridView.
<http://dotnetblogger.com/post/2010/03/07/RadGrid-with-Custom-Paging-Sorting-Filtering.aspx>
Basically you want to add pagination to your grid and you probably don't want to return everything "\*"... |
12,782,275 | Hey guys im trying to connect to an database and collect some data out of the table `zuordnung` but it doesn't work correct everything i get is a white page im frustated because i can't find the error mabye another pair of eyes sees it so here is what i have so far:
```
<html>
<head>
<title>PHP Test</title>
</head... | 2012/10/08 | [
"https://Stackoverflow.com/questions/12782275",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1489323/"
] | ```
while($resultarray = mysql_fetch_array($result))
{
echo('<p>'.$resultarray['HW_Typ']."</p>");
echo('<p>'.$resultarray['Hostname_alt']."</p>");
echo('<p>'.$resultarray['Username']."</p>");
echo('<p>'.$resultarray['Emailadresse']."</p>");
echo('<p>'.$resulta... | try this
`require_once($_SERVER['DOCUMENT_ROOT']."db_login.php");`
instead of Include
and u need to echo `resultarray` in a while loop if u are having more than 1 record. |
12,782,275 | Hey guys im trying to connect to an database and collect some data out of the table `zuordnung` but it doesn't work correct everything i get is a white page im frustated because i can't find the error mabye another pair of eyes sees it so here is what i have so far:
```
<html>
<head>
<title>PHP Test</title>
</head... | 2012/10/08 | [
"https://Stackoverflow.com/questions/12782275",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1489323/"
] | ```
while($resultarray = mysql_fetch_array($result))
{
echo('<p>'.$resultarray['HW_Typ']."</p>");
echo('<p>'.$resultarray['Hostname_alt']."</p>");
echo('<p>'.$resultarray['Username']."</p>");
echo('<p>'.$resultarray['Emailadresse']."</p>");
echo('<p>'.$resulta... | are u forgotten to loop
use loop,like this.
```
while($resultarray = mysql_fetch_array($result))
{
echo('<p>'.$resultarray['HW_Typ']."</p>");
echo('<p>'.$resultarray['Hostname_alt']."</p>");
echo('<p>'.$resultarray['Username']."</p>");
echo('<p>'.$resultarray['Emailadresse']."</... |
8,415 | How to pronounce "Chicago"?
I have 2 issues with it.
First is how to pronounce the "Ch" in "Chicago".
I have heard it pronounced as in "cheese", but also as in "ship" by the natives.
Second is how to pronounce the "a" in "Chicago".
SHould it be "a" as in "Albert" or "a" as in "I am"?
Are there any differences bet... | 2013/07/26 | [
"https://ell.stackexchange.com/questions/8415",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/1795/"
] | Any good dictionary will provide you a pronunciation guide. Online dictionaries have an advantage over print editions: they can embed audio files for additional help.
Pronunciation guides list all of these as valid pronunciations:
* /SHiˈkôgō, -ˈkägō/ (from [ODO](http://oxforddictionaries.com/us/definition/american_... | \*\*\*I think the apt pronunciation would be - (shicago) cause The name "Chicago" is derived from a French rendering of the Native American word shikaakwa and this holds the word 'sh'. |
17,352,813 | When I login with the correct username and password I get an error "Wrong Username or Password" the database connection works and I think there is something wrong with the password + username check.
```
<?php
$host="mysql12-int.cp.hostnet.nl"; // Host name
$username="u33936_mick"; // username
$password... | 2013/06/27 | [
"https://Stackoverflow.com/questions/17352813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2528939/"
] | Foremost, I suggest you look in to transitioning away from the deprecated `mysql_*` family of functions in favor of `mysqli` ([docs](http://php.net/manual/en/book.mysqli.php)) or PDO ([docs](http://php.net/manual/en/book.pdo.php)), neither of which require any significant change on your part as far as code goes.
As fo... | A few problems:
* You should use `$_POST['myusername']` etc. to get the posted variables. If you are relying on [`register_globals`](http://php.net/manual/en/security.globals.php) you should turn that off as it is deprecated and poses a security risk;
* The `LIMIT` clause comes at the end in mysql;
* You should not mo... |
9,515,994 | I have the next problem:
The database in the system has denormalized tables with lets say "CompanyID" field held on almost every table in the database. This was done due to business rules purposes and should be that way. Sometimes the data is inconsistent as the Customer being with CompanyID == 1 has the order with C... | 2012/03/01 | [
"https://Stackoverflow.com/questions/9515994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420555/"
] | Okay Have looked at your code using firebug.
Why are you inserting more than one
```
<div class="col1">
...
</div>
```
You should just place all boxes in the same col1. You do not need two of these.
Basically, do not use two versions of col1 but place all boxes in the same col1, one below each other.
```
<di... | i would suggest removing the
```
float:left;
```
from columns... and add:
```
display:block;
``` |
9,515,994 | I have the next problem:
The database in the system has denormalized tables with lets say "CompanyID" field held on almost every table in the database. This was done due to business rules purposes and should be that way. Sometimes the data is inconsistent as the Customer being with CompanyID == 1 has the order with C... | 2012/03/01 | [
"https://Stackoverflow.com/questions/9515994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420555/"
] | Okay Have looked at your code using firebug.
Why are you inserting more than one
```
<div class="col1">
...
</div>
```
You should just place all boxes in the same col1. You do not need two of these.
Basically, do not use two versions of col1 but place all boxes in the same col1, one below each other.
```
<di... | I would suggest to put both columns into a div:
```
<div class="sidebar">
<div id="col1"></div>
<div id="col2"></div>
</div>
```
Now `float: left;` for both center box and left sidebar. In order to have col1 and col2 underneath each other use as Philip said `display: block;`
Edit:
As you already ... |
9,515,994 | I have the next problem:
The database in the system has denormalized tables with lets say "CompanyID" field held on almost every table in the database. This was done due to business rules purposes and should be that way. Sometimes the data is inconsistent as the Customer being with CompanyID == 1 has the order with C... | 2012/03/01 | [
"https://Stackoverflow.com/questions/9515994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420555/"
] | Okay Have looked at your code using firebug.
Why are you inserting more than one
```
<div class="col1">
...
</div>
```
You should just place all boxes in the same col1. You do not need two of these.
Basically, do not use two versions of col1 but place all boxes in the same col1, one below each other.
```
<di... | Here you go : <http://jsfiddle.net/d47Vs/> |
11,927,144 | Currently, I am learning some FPGA design techniques using VHDL, my problem is whether we can use := and <= interchangeably in VHDL or not, though I've seen the use of := in constants declarations and <= in assignments? Thanks in advance! | 2012/08/13 | [
"https://Stackoverflow.com/questions/11927144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1500882/"
] | The rules are a little more complex than this, but basically: you use `<=` to do signal assignment, which takes effect on the next delta cycle. You use `:=` to do variable assignment, which takes place immediately. So if you have a signal, you always use `<=`. If you have a variable, you always use `:=`.
Some places w... | if you use ***signal temp:std\_logic\_vector*** then you'll have to use **<=**
if you use ***variable temp:std\_logic\_vector*** then you'll have to use **:=** |
11,927,144 | Currently, I am learning some FPGA design techniques using VHDL, my problem is whether we can use := and <= interchangeably in VHDL or not, though I've seen the use of := in constants declarations and <= in assignments? Thanks in advance! | 2012/08/13 | [
"https://Stackoverflow.com/questions/11927144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1500882/"
] | The rules are a little more complex than this, but basically: you use `<=` to do signal assignment, which takes effect on the next delta cycle. You use `:=` to do variable assignment, which takes place immediately. So if you have a signal, you always use `<=`. If you have a variable, you always use `:=`.
Some places w... | `<=`
**UseCase**: **Signal** assignments that take place in the next cycle.
**Example**: `signal temp:std_logic_vector`
`:=`
**UseCase**: **Variable** assignments that take place immediately.
**Example**: `variable temp:std_logic_vector`
---
Except for adding initial values to signals, you can also use `:=`. |
11,927,144 | Currently, I am learning some FPGA design techniques using VHDL, my problem is whether we can use := and <= interchangeably in VHDL or not, though I've seen the use of := in constants declarations and <= in assignments? Thanks in advance! | 2012/08/13 | [
"https://Stackoverflow.com/questions/11927144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1500882/"
] | if you use ***signal temp:std\_logic\_vector*** then you'll have to use **<=**
if you use ***variable temp:std\_logic\_vector*** then you'll have to use **:=** | `<=`
**UseCase**: **Signal** assignments that take place in the next cycle.
**Example**: `signal temp:std_logic_vector`
`:=`
**UseCase**: **Variable** assignments that take place immediately.
**Example**: `variable temp:std_logic_vector`
---
Except for adding initial values to signals, you can also use `:=`. |
5,595,491 | ```
ruby-1.9.2-p180 :007 > Factory.define :user do |user|
ruby-1.9.2-p180 :008 > user.email "user@example.com"
ruby-1.9.2-p180 :009?> user.password "foobar"
ruby-1.9.2-p180 :010?> user.password_confirmation "foobar"
ruby-1.9.2-p180 :011?> end
NameError: uninitialized cons... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5595491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/435951/"
] | I suppose you try in console in development environment. But you add the Factory gem only in test environment.
If you want access to Factory\_girl in development use in your Gemfile :
```
group :test, :development do
gem 'factory_girl_rails'
end
```
Or if you want test your Factory launch your console in test env... | We had a similar problem on our end, rake spec seemed to be randomly failing with the error uninitialized constant FactoryGirl. The error was random -> coming and going. We went back half a dozen git commits to try and resolve it. In the end it was a silly mistake.
The fundamental problem is RAILS\_ENV is set to **dev... |
5,595,491 | ```
ruby-1.9.2-p180 :007 > Factory.define :user do |user|
ruby-1.9.2-p180 :008 > user.email "user@example.com"
ruby-1.9.2-p180 :009?> user.password "foobar"
ruby-1.9.2-p180 :010?> user.password_confirmation "foobar"
ruby-1.9.2-p180 :011?> end
NameError: uninitialized cons... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5595491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/435951/"
] | I suppose you try in console in development environment. But you add the Factory gem only in test environment.
If you want access to Factory\_girl in development use in your Gemfile :
```
group :test, :development do
gem 'factory_girl_rails'
end
```
Or if you want test your Factory launch your console in test env... | You should also change Factory.define to FactoryGirl.define, like in this example
```
FactoryGirl.define do
factory :user do
name 'John Doe'
date_of_birth { 21.years.ago }
end
end
```
from the [factory\_girl documentation](https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md) |
5,595,491 | ```
ruby-1.9.2-p180 :007 > Factory.define :user do |user|
ruby-1.9.2-p180 :008 > user.email "user@example.com"
ruby-1.9.2-p180 :009?> user.password "foobar"
ruby-1.9.2-p180 :010?> user.password_confirmation "foobar"
ruby-1.9.2-p180 :011?> end
NameError: uninitialized cons... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5595491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/435951/"
] | I suppose you try in console in development environment. But you add the Factory gem only in test environment.
If you want access to Factory\_girl in development use in your Gemfile :
```
group :test, :development do
gem 'factory_girl_rails'
end
```
Or if you want test your Factory launch your console in test env... | I also ran into this while I was doing the Hartl tutorial.
If you are using "**Spork**" to speed up your tests and it is running in the background when you add the FactoryGirl code, you will need to stop it and restart it. |
5,595,491 | ```
ruby-1.9.2-p180 :007 > Factory.define :user do |user|
ruby-1.9.2-p180 :008 > user.email "user@example.com"
ruby-1.9.2-p180 :009?> user.password "foobar"
ruby-1.9.2-p180 :010?> user.password_confirmation "foobar"
ruby-1.9.2-p180 :011?> end
NameError: uninitialized cons... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5595491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/435951/"
] | We had a similar problem on our end, rake spec seemed to be randomly failing with the error uninitialized constant FactoryGirl. The error was random -> coming and going. We went back half a dozen git commits to try and resolve it. In the end it was a silly mistake.
The fundamental problem is RAILS\_ENV is set to **dev... | You should also change Factory.define to FactoryGirl.define, like in this example
```
FactoryGirl.define do
factory :user do
name 'John Doe'
date_of_birth { 21.years.ago }
end
end
```
from the [factory\_girl documentation](https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md) |
5,595,491 | ```
ruby-1.9.2-p180 :007 > Factory.define :user do |user|
ruby-1.9.2-p180 :008 > user.email "user@example.com"
ruby-1.9.2-p180 :009?> user.password "foobar"
ruby-1.9.2-p180 :010?> user.password_confirmation "foobar"
ruby-1.9.2-p180 :011?> end
NameError: uninitialized cons... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5595491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/435951/"
] | I also ran into this while I was doing the Hartl tutorial.
If you are using "**Spork**" to speed up your tests and it is running in the background when you add the FactoryGirl code, you will need to stop it and restart it. | You should also change Factory.define to FactoryGirl.define, like in this example
```
FactoryGirl.define do
factory :user do
name 'John Doe'
date_of_birth { 21.years.ago }
end
end
```
from the [factory\_girl documentation](https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md) |
5,410,188 | Here's what I mean:
<http://www.lesliesommer.com/wdw07/html/images/glow.png>
I need it to work with most browsers.
Could you point me to a tutorial or something?
Thanks for the answers. Can I do it without CSS3 ? | 2011/03/23 | [
"https://Stackoverflow.com/questions/5410188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/649482/"
] | css3 box shadows I'd think. These aren't implemented in IE8
```
-webkit-box-shadow: 0px 0px 15px #dddddd;
-moz-box-shadow: 0px 0px 15px #dddddd;
box-shadow: 0px 0px 15px #dddddd;
``` | <http://www.css3.info/preview/box-shadow/>
However, needs a CSS3 enabled browser.
Alternatively set a background image to get cross browser support: <http://dimox.net/cross-browser-css3-box-shadow/> |
5,410,188 | Here's what I mean:
<http://www.lesliesommer.com/wdw07/html/images/glow.png>
I need it to work with most browsers.
Could you point me to a tutorial or something?
Thanks for the answers. Can I do it without CSS3 ? | 2011/03/23 | [
"https://Stackoverflow.com/questions/5410188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/649482/"
] | To add on to Groovetrain's answer, if you use `rgba` instead of a hex value you can have the colors be rendered with transparency letting whatever is below be seen through (which may or may not be valuable depending on the application).
```
-webkit-box-shadow: 0px 0px 15px rgba(0,0,0,0.35);
-moz-box-shadow: 0px 0px 15... | <http://www.css3.info/preview/box-shadow/>
However, needs a CSS3 enabled browser.
Alternatively set a background image to get cross browser support: <http://dimox.net/cross-browser-css3-box-shadow/> |
5,410,188 | Here's what I mean:
<http://www.lesliesommer.com/wdw07/html/images/glow.png>
I need it to work with most browsers.
Could you point me to a tutorial or something?
Thanks for the answers. Can I do it without CSS3 ? | 2011/03/23 | [
"https://Stackoverflow.com/questions/5410188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/649482/"
] | There are a few techniques for this (outside of CSS3).
If the width is fixed, one way is to use two DIVS. One has the top and the sides. You need to make and image that is very tall, with the sides repeating and the bottom cut off and use it as a background on the outer DIV. Then make an image that contains the bottom... | <http://www.css3.info/preview/box-shadow/>
However, needs a CSS3 enabled browser.
Alternatively set a background image to get cross browser support: <http://dimox.net/cross-browser-css3-box-shadow/> |
5,410,188 | Here's what I mean:
<http://www.lesliesommer.com/wdw07/html/images/glow.png>
I need it to work with most browsers.
Could you point me to a tutorial or something?
Thanks for the answers. Can I do it without CSS3 ? | 2011/03/23 | [
"https://Stackoverflow.com/questions/5410188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/649482/"
] | css3 box shadows I'd think. These aren't implemented in IE8
```
-webkit-box-shadow: 0px 0px 15px #dddddd;
-moz-box-shadow: 0px 0px 15px #dddddd;
box-shadow: 0px 0px 15px #dddddd;
``` | To add on to Groovetrain's answer, if you use `rgba` instead of a hex value you can have the colors be rendered with transparency letting whatever is below be seen through (which may or may not be valuable depending on the application).
```
-webkit-box-shadow: 0px 0px 15px rgba(0,0,0,0.35);
-moz-box-shadow: 0px 0px 15... |
5,410,188 | Here's what I mean:
<http://www.lesliesommer.com/wdw07/html/images/glow.png>
I need it to work with most browsers.
Could you point me to a tutorial or something?
Thanks for the answers. Can I do it without CSS3 ? | 2011/03/23 | [
"https://Stackoverflow.com/questions/5410188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/649482/"
] | css3 box shadows I'd think. These aren't implemented in IE8
```
-webkit-box-shadow: 0px 0px 15px #dddddd;
-moz-box-shadow: 0px 0px 15px #dddddd;
box-shadow: 0px 0px 15px #dddddd;
``` | There are a few techniques for this (outside of CSS3).
If the width is fixed, one way is to use two DIVS. One has the top and the sides. You need to make and image that is very tall, with the sides repeating and the bottom cut off and use it as a background on the outer DIV. Then make an image that contains the bottom... |
7,080,479 | A [working document](http://cr.openjdk.java.net/~briangoetz/lambda/lambda-state-3.html) describing the state of [Project Lambda](http://openjdk.java.net/projects/lambda/) mentions the so-called SAM (single abstract method) types. As far as I know the current lambda proposal doesn't affect the runtime just the compiler ... | 2011/08/16 | [
"https://Stackoverflow.com/questions/7080479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/552601/"
] | @Tamás You should probably have a read of this mailing list post by Brian Goetz:
<http://mail.openjdk.java.net/pipermail/lambda-dev/2011-August/003877.html>
Basically, the lambda abstraction is currently implemented using objects. However, it has been designed to permit alternative realizations of lambdas, which woul... | There's nothing hard in converting single method classes to function pointers, but you are missing one thing: lambda expressions are not just functions, they are **closures**. The difference is that closures can capture outer variables. Consider next example in pseudo Java:
```
public Adder makeAdder(double startNumb... |
2,058 | I'm trying to make a launcher for Mechinarium, Its a flash game with a launcher that runs flash files in separate folders in its directory as far as im aware.
I've tried to make a launcher which points towards this executable which runs fine when i click on it. When i try and run it from the launcher the player comes ... | 2010/08/12 | [
"https://askubuntu.com/questions/2058",
"https://askubuntu.com",
"https://askubuntu.com/users/633/"
] | I've had a few issues like this with various things. I find the best way to fix these is to write a little shell script and stick it in `~/bin`.
Here's what I did for Nexuiz (which had some path issues):
```
#!/bin/bash
cd ~/Nexuiz
./nexuiz-linux-x86_64-sdl
```
You obviously don't want that path or that executable ... | You can create a launch script and put it into `/usr/local/bin`.
Furthermore, you can create a menu entry that points to the script to be able to launch it from your menus. In KDE you can use kmenuedit for this, Gnome has a similar menu editor too. |
66,836,532 | ```
try {
addImage(bodyPanel1, "https://sneakernews.com/wp-content/uploads/2020/10/jordan-1-black-mocha-555088-105-2.jpg");
} catch (MalformedURLException e) {
e.printStackTrace();
}
private void addImage(JPanel cp, String url) throws MalformedURLException{
cp.add(new JLabel(new ImageIcon(new URL(url))));
... | 2021/03/27 | [
"https://Stackoverflow.com/questions/66836532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15496701/"
] | First, your updateButtonUpgrades isn't set up properly.
```js
updateButtonUpgrades(...buttonUpgrades, name="new name")
```
is trying to map out the buttonUpgrades in the component's return, but you have it [spread with the ... syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread... | I suggest you to rewrite your onClick-callback-function: first create the new objects with the desired attributed, group them in an array and then update the react state with this new array.
EDIT: jharris711 gives a clean implementation of this concept, great work! |
22,198,561 | ```
<DOCTYPE! HTML>
<html>
<body>
<form action="index.php" method="post">
title: <input type="text" name="title" /><br><br>
name: <input type="text" name="name" /><br><br>
<input type="submit" />
</form>
<?php
$con = mysql_connect("... | 2014/03/05 | [
"https://Stackoverflow.com/questions/22198561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3257454/"
] | Check for submit click on page load
```
if(isset($_POST['submit']))
{
$con = mysql_connect("213.171.200.70","bjenkins","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("msg360db1", $con);
$sql="INSERT INTO members (title, name)
VALUES
('$... | You have to check, if the submit button was pressed or if it's a normal page view:
```
if(isset($_POST)) {
// Do your SQL-Stuff here
}
``` |
22,198,561 | ```
<DOCTYPE! HTML>
<html>
<body>
<form action="index.php" method="post">
title: <input type="text" name="title" /><br><br>
name: <input type="text" name="name" /><br><br>
<input type="submit" />
</form>
<?php
$con = mysql_connect("... | 2014/03/05 | [
"https://Stackoverflow.com/questions/22198561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3257454/"
] | Check for submit click on page load
```
if(isset($_POST['submit']))
{
$con = mysql_connect("213.171.200.70","bjenkins","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("msg360db1", $con);
$sql="INSERT INTO members (title, name)
VALUES
('$... | PHP Code is run on any page on every load time. As such, when you first load the page to type in your data, you are in effect adding the blank entry. Then when you submit the page, a second entry with data is added.
As such you need to check if the page has been submitted or not. Wrap your php code with a check for `$... |
22,198,561 | ```
<DOCTYPE! HTML>
<html>
<body>
<form action="index.php" method="post">
title: <input type="text" name="title" /><br><br>
name: <input type="text" name="name" /><br><br>
<input type="submit" />
</form>
<?php
$con = mysql_connect("... | 2014/03/05 | [
"https://Stackoverflow.com/questions/22198561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3257454/"
] | You must check like:
```
if(isset($_POST['title']){
$sql="INSERT INTO members (title, name)
VALUES
('$_POST[title]','$_POST[name]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
echo mysql_error();
... | Check for submit click on page load
```
if(isset($_POST['submit']))
{
$con = mysql_connect("213.171.200.70","bjenkins","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("msg360db1", $con);
$sql="INSERT INTO members (title, name)
VALUES
('$... |
22,198,561 | ```
<DOCTYPE! HTML>
<html>
<body>
<form action="index.php" method="post">
title: <input type="text" name="title" /><br><br>
name: <input type="text" name="name" /><br><br>
<input type="submit" />
</form>
<?php
$con = mysql_connect("... | 2014/03/05 | [
"https://Stackoverflow.com/questions/22198561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3257454/"
] | Check for submit click on page load
```
if(isset($_POST['submit']))
{
$con = mysql_connect("213.171.200.70","bjenkins","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("msg360db1", $con);
$sql="INSERT INTO members (title, name)
VALUES
('$... | PHP code is executed on the server before the html is rendered by the browser or even generated. In your case, by the time the form gets displayed (or submitted) the php code is already executed.
And since the variables $\_POST[title] and $\_POST[name] are blank when the php code is executed, a database row with no (... |
22,198,561 | ```
<DOCTYPE! HTML>
<html>
<body>
<form action="index.php" method="post">
title: <input type="text" name="title" /><br><br>
name: <input type="text" name="name" /><br><br>
<input type="submit" />
</form>
<?php
$con = mysql_connect("... | 2014/03/05 | [
"https://Stackoverflow.com/questions/22198561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3257454/"
] | You must check like:
```
if(isset($_POST['title']){
$sql="INSERT INTO members (title, name)
VALUES
('$_POST[title]','$_POST[name]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
echo mysql_error();
... | PHP code is executed on the server before the html is rendered by the browser or even generated. In your case, by the time the form gets displayed (or submitted) the php code is already executed.
And since the variables $\_POST[title] and $\_POST[name] are blank when the php code is executed, a database row with no (... |
22,198,561 | ```
<DOCTYPE! HTML>
<html>
<body>
<form action="index.php" method="post">
title: <input type="text" name="title" /><br><br>
name: <input type="text" name="name" /><br><br>
<input type="submit" />
</form>
<?php
$con = mysql_connect("... | 2014/03/05 | [
"https://Stackoverflow.com/questions/22198561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3257454/"
] | You must check like:
```
if(isset($_POST['title']){
$sql="INSERT INTO members (title, name)
VALUES
('$_POST[title]','$_POST[name]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
echo mysql_error();
... | Need to see the beginning of your code. You might be skip checking if $\_POST is set and write into database in case it is.
EDIT: Interesting, now I see the beginning of the code. |
22,198,561 | ```
<DOCTYPE! HTML>
<html>
<body>
<form action="index.php" method="post">
title: <input type="text" name="title" /><br><br>
name: <input type="text" name="name" /><br><br>
<input type="submit" />
</form>
<?php
$con = mysql_connect("... | 2014/03/05 | [
"https://Stackoverflow.com/questions/22198561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3257454/"
] | Check for submit click on page load
```
if(isset($_POST['submit']))
{
$con = mysql_connect("213.171.200.70","bjenkins","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("msg360db1", $con);
$sql="INSERT INTO members (title, name)
VALUES
('$... | ```
**But this code is not sanitized and is vulnerable for sql
injection. please sanitize your code.**
```
//check if both values are set.
```
if(isset($_POST['title']) && isset($_POST['name'])){
$sql="INSERT INTO members (title, name)
VALUES
('$_POST[title]','$_POST[name]')";
... |
22,198,561 | ```
<DOCTYPE! HTML>
<html>
<body>
<form action="index.php" method="post">
title: <input type="text" name="title" /><br><br>
name: <input type="text" name="name" /><br><br>
<input type="submit" />
</form>
<?php
$con = mysql_connect("... | 2014/03/05 | [
"https://Stackoverflow.com/questions/22198561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3257454/"
] | You must check like:
```
if(isset($_POST['title']){
$sql="INSERT INTO members (title, name)
VALUES
('$_POST[title]','$_POST[name]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
echo mysql_error();
... | PHP Code is run on any page on every load time. As such, when you first load the page to type in your data, you are in effect adding the blank entry. Then when you submit the page, a second entry with data is added.
As such you need to check if the page has been submitted or not. Wrap your php code with a check for `$... |
22,198,561 | ```
<DOCTYPE! HTML>
<html>
<body>
<form action="index.php" method="post">
title: <input type="text" name="title" /><br><br>
name: <input type="text" name="name" /><br><br>
<input type="submit" />
</form>
<?php
$con = mysql_connect("... | 2014/03/05 | [
"https://Stackoverflow.com/questions/22198561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3257454/"
] | Check for submit click on page load
```
if(isset($_POST['submit']))
{
$con = mysql_connect("213.171.200.70","bjenkins","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("msg360db1", $con);
$sql="INSERT INTO members (title, name)
VALUES
('$... | Need to see the beginning of your code. You might be skip checking if $\_POST is set and write into database in case it is.
EDIT: Interesting, now I see the beginning of the code. |
22,198,561 | ```
<DOCTYPE! HTML>
<html>
<body>
<form action="index.php" method="post">
title: <input type="text" name="title" /><br><br>
name: <input type="text" name="name" /><br><br>
<input type="submit" />
</form>
<?php
$con = mysql_connect("... | 2014/03/05 | [
"https://Stackoverflow.com/questions/22198561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3257454/"
] | You must check like:
```
if(isset($_POST['title']){
$sql="INSERT INTO members (title, name)
VALUES
('$_POST[title]','$_POST[name]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
echo mysql_error();
... | ```
**But this code is not sanitized and is vulnerable for sql
injection. please sanitize your code.**
```
//check if both values are set.
```
if(isset($_POST['title']) && isset($_POST['name'])){
$sql="INSERT INTO members (title, name)
VALUES
('$_POST[title]','$_POST[name]')";
... |
54,889,791 | Can I select a column based on another column's value being listed as a formula? So I have a table, something like:
```
column_name formula val
one NULL 1
two NULL 2
three one + two NULL
```
And I want to do
```
SELECT
column_name,
CASE WHEN formula IS... | 2019/02/26 | [
"https://Stackoverflow.com/questions/54889791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2495305/"
] | You keep saying column, and column name, but you're actually talking about rows, not columns.
The problem is that you (potentially) want different formulas for each row. For example, row 4 might be (two - one) = 1 or even (three + one) = 4, where you'd have to calculate row three before you could do row 4. This means... | Possible solution would be like this kind....but since you mentioned very few things so this works on your above condition, not sure for anything else.
```
GO
SELECT
t1.column_name,
CASE WHEN t1.formula IS NULL
t1.val
ELSE
(select sum(t2.val) from table as t2 where t2.formula is not null)
EN... |
2,601,529 | $\ e^{i 2\pi} = 1,$
$\ e^{0} = 1$
$\Rightarrow $
$\ e^{i 2\pi} = e^{0}$
$\Rightarrow $
$\ {i 2\pi} = 0 $
$\Rightarrow $
$\ i = 0 $ | 2018/01/11 | [
"https://math.stackexchange.com/questions/2601529",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/130551/"
] | This argument is actually an excellent proof that the laws of exponents that hold for real numbers - in particular, the law that $a^x = a^y \implies x = y$ - do not hold for complex numbers. This isn't a contradiction - there are plenty of mathematical operations that work like this.
For example, imagine that you'd ne... | The complex function $\exp:\mathbb{C}\to\mathbb{C}\backslash\{0\}$ is not injective. Therefore you cannot conclude that $\ e^{i 2\pi} = e^{0}$ implies $i 2\pi=0$.
However, with the domain $\mathbb{R}$ this function is injective. |
263 | I have come across many reactions that are zero order reactions but at one glance I'm unable to tell if they are zero order or not. Is there any criteria that can be used to identify these reactions or are they purely experimentally determined? | 2012/05/05 | [
"https://chemistry.stackexchange.com/questions/263",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/124/"
] | To your question of whether zero-order reactions can be recognized “at one glance” and from an non-experimental criterion, **the answer is clearly no**. The only theoretical way of firmly establishing the order of a reaction (if it has one) is to fully calculate its kinetic law (or *rate equation*), which can only be d... | Determining the rate of the kinetics of a reaction isn't done with only one measurement, or looking at only one graph.
What zero order kinetics means, is that the rate of the reaction is *independent* of the concentration of chemical species. To determine the kinetics of a process, you need to take a series of measure... |
263 | I have come across many reactions that are zero order reactions but at one glance I'm unable to tell if they are zero order or not. Is there any criteria that can be used to identify these reactions or are they purely experimentally determined? | 2012/05/05 | [
"https://chemistry.stackexchange.com/questions/263",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/124/"
] | Determining the rate of the kinetics of a reaction isn't done with only one measurement, or looking at only one graph.
What zero order kinetics means, is that the rate of the reaction is *independent* of the concentration of chemical species. To determine the kinetics of a process, you need to take a series of measure... | To be honest, we could only use scientific data to determine the order of an reaction , Say an example of one species determining reaction. You can only plot graphs to find out the shape of the curve and thus discovering whether it is zero first or second order reaction
If you would like , it is in a chapter called det... |
263 | I have come across many reactions that are zero order reactions but at one glance I'm unable to tell if they are zero order or not. Is there any criteria that can be used to identify these reactions or are they purely experimentally determined? | 2012/05/05 | [
"https://chemistry.stackexchange.com/questions/263",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/124/"
] | To your question of whether zero-order reactions can be recognized “at one glance” and from an non-experimental criterion, **the answer is clearly no**. The only theoretical way of firmly establishing the order of a reaction (if it has one) is to fully calculate its kinetic law (or *rate equation*), which can only be d... | To be honest, we could only use scientific data to determine the order of an reaction , Say an example of one species determining reaction. You can only plot graphs to find out the shape of the curve and thus discovering whether it is zero first or second order reaction
If you would like , it is in a chapter called det... |
9,818 | I just watched Pan's Labyrinth last night. The movie is really good, but I could not understand one thing - the fantasy part with Ofelia, is it happening for real or she is just imagining things?
I ask this because I noted two points in the movie -
1. When Vidal pulls the mandrake root out of Ofelia's mother's bed it... | 2013/02/02 | [
"https://movies.stackexchange.com/questions/9818",
"https://movies.stackexchange.com",
"https://movies.stackexchange.com/users/301/"
] | I think it's deliberately ambiguous.
If it's **real**, the inconsistencies are easily explained by Vidal's fascist belief system. These elements simply are not part of his world.
If it's **fantasy**, then of course only Ofelia can see these thing because she imagined them.
I think part of Del Toro's purpose in the f... | This is a fantasy playing out in Ofelia's mind. She is a child of war and this is her escape from the atrocities she is witnessing.
If you know Spanish the fawn speaks to Ofelia in the "vosotros" subject, translating to you (plural) in English. A nice detail on Del Toro's part. |
9,818 | I just watched Pan's Labyrinth last night. The movie is really good, but I could not understand one thing - the fantasy part with Ofelia, is it happening for real or she is just imagining things?
I ask this because I noted two points in the movie -
1. When Vidal pulls the mandrake root out of Ofelia's mother's bed it... | 2013/02/02 | [
"https://movies.stackexchange.com/questions/9818",
"https://movies.stackexchange.com",
"https://movies.stackexchange.com/users/301/"
] | I think it's deliberately ambiguous.
If it's **real**, the inconsistencies are easily explained by Vidal's fascist belief system. These elements simply are not part of his world.
If it's **fantasy**, then of course only Ofelia can see these thing because she imagined them.
I think part of Del Toro's purpose in the f... | The director Guillermo Del Toro [has stated in an interview](http://twitchfilm.com/2006/12/pans-labyrinthinterview-with-guillermo-del-toro.html#ixzz36FdF4a9M) that he provided three important clues which showed that the events actually took place and not just in Ofelia's head. In his words,
>
> There are three clues ... |
9,818 | I just watched Pan's Labyrinth last night. The movie is really good, but I could not understand one thing - the fantasy part with Ofelia, is it happening for real or she is just imagining things?
I ask this because I noted two points in the movie -
1. When Vidal pulls the mandrake root out of Ofelia's mother's bed it... | 2013/02/02 | [
"https://movies.stackexchange.com/questions/9818",
"https://movies.stackexchange.com",
"https://movies.stackexchange.com/users/301/"
] | The director Guillermo Del Toro [has stated in an interview](http://twitchfilm.com/2006/12/pans-labyrinthinterview-with-guillermo-del-toro.html#ixzz36FdF4a9M) that he provided three important clues which showed that the events actually took place and not just in Ofelia's head. In his words,
>
> There are three clues ... | This is a fantasy playing out in Ofelia's mind. She is a child of war and this is her escape from the atrocities she is witnessing.
If you know Spanish the fawn speaks to Ofelia in the "vosotros" subject, translating to you (plural) in English. A nice detail on Del Toro's part. |
13,139,085 | I have a RMA normalized data ( from the CEL files ) and would like to write it into a file that I could open in excel but have some problems.
```
library(affy)
cel <- ReadAffy()
pre<-rma(cel)
write.table(pre, file="norm.txt", sep="\t")
write.table(pre, file="norma.txt")
```
The outut is arranged row-wise in the text... | 2012/10/30 | [
"https://Stackoverflow.com/questions/13139085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1483161/"
] | You need to extract the values from the normalised probes using the `exprs` function. Something like:
```
write.csv(exprs(pre), file="output.csv", row.names=FALSE)
```
should do the trick. | I'm not totally clear about what the problem is, what do you mean by "proper format"? Excel will struggle with huge tables and doing your analysis in R with Bioconductor is likely a better way to go, you could then export a smaller results or summary table to excel.
Nevertheless, if you want the file written columnwis... |
426,606 | I was looking at Vsphere to automatically load balance my apache web servers, and mysql servers but will this actually do the job?
I know it says it does auto load balancing but not actually sure it quite means what I want to achieve.
Is there an easier way to set up a php-apache and mysql cluster within virtual mach... | 2012/09/11 | [
"https://serverfault.com/questions/426606",
"https://serverfault.com",
"https://serverfault.com/users/135656/"
] | What vSphere does:
* Clustering - DRS = running several VM's on more than one host, vSphere will automatically decide on which host to move running VM
* High Availability = running guest on more than one host in parallel - if one goes down - second one assures service availability
MySQL clustering - not easy, cannot ... | This isn't the solution you're looking for. vSphere clustering is about protecting whole VMs, not the applications on those VMs, you need a load-balancer for that sorry, something as simple as a Squid/HA proxy all the way up to Cisco ASA/F5 kit would be appropriate. |
38,556,136 | I am using the following classes, they were working fine with static data.
Here is my JSON response
```
[{"place_name":"Udon House"},{"place_name":"Casa Biance"},{"place_name":"Pizza hut"},{"place_name":"Pearl Continental "},{"place_name":"Lahore Meuseum"},{"place_name":"Shalimar Gardens"}]
```
this is my POJO clas... | 2016/07/24 | [
"https://Stackoverflow.com/questions/38556136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6301599/"
] | You have to mention the threshold **height** for the reveal-modal, after which the `overflow-y` will be considered and a scroll bar will appear.
```
.reveal-modal
{
max-height:initial; //reset any max-height set by foundation defaults
height:600px; //replace value with your desired height
overflow-y:scroll;
}
... | I was able to set the height to 60% with a top margin of 20% and 100vh when in mobile mode. I also had to change the dialog position to fixed and disable the scroll setting, which I think was a new addition after 5.2.2 which would explain why I only recently starting having this issue after updating. This is what I was... |
38,556,136 | I am using the following classes, they were working fine with static data.
Here is my JSON response
```
[{"place_name":"Udon House"},{"place_name":"Casa Biance"},{"place_name":"Pizza hut"},{"place_name":"Pearl Continental "},{"place_name":"Lahore Meuseum"},{"place_name":"Shalimar Gardens"}]
```
this is my POJO clas... | 2016/07/24 | [
"https://Stackoverflow.com/questions/38556136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6301599/"
] | You have to mention the threshold **height** for the reveal-modal, after which the `overflow-y` will be considered and a scroll bar will appear.
```
.reveal-modal
{
max-height:initial; //reset any max-height set by foundation defaults
height:600px; //replace value with your desired height
overflow-y:scroll;
}
... | Add the class "full" to "reveal-modal" and the height will be set to 100% scrollable:
```
<div id="myModal" class="reveal-modal full" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
```
In this mode, I noticed that the background overlay (shadow & border) had issues, so i added the followi... |
61,569,077 | I am trying to do a basic binary search for a value in an array using the recursion method. I used the Iterative method on this same array and got the right output. But this code is returning false (element is not in the array) regardless of whether the input is in the array or not.
```
let recursionFunction = functi... | 2020/05/03 | [
"https://Stackoverflow.com/questions/61569077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13385155/"
] | Here’s one way.
```
final int numOfGroups = 3;
List<String> names = Arrays.asList("Nielsen", "Jensen", "Hansen",
"Pedersen", "Andersen", "Christensen", "Larsen", "Sørensen");
Collections.shuffle(names);
List<List<String>> groups = IntStream.range(0, names.size())
.boxed()
... | I was able to reproduce and run your code and get the expected results.
I only needed to make a few changes:
1) In your initial for loop, you are incrementing i by 4:
```
for (int i = 0; i < studentInfo.size(); i += 4) {
```
I don't know why you would do that, causing you to skip adding students from your file to... |
3,369,871 | I don't know if I described it correctly.
I have several lists of dates in Java. Now I need to know when a list contains at least 4 dates that follow each other. e.g. "2010-06-27, 2010-06-28, 2010-06-29, 2010-06-30".
I just need an idea where to start....
Thanks! | 2010/07/30 | [
"https://Stackoverflow.com/questions/3369871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338476/"
] | Iterate over the list and compare each date with the next one until you have four matching your criteria. | Convert the date in miliseconds via date/calendar classes and then the comparation is trivial. |
3,369,871 | I don't know if I described it correctly.
I have several lists of dates in Java. Now I need to know when a list contains at least 4 dates that follow each other. e.g. "2010-06-27, 2010-06-28, 2010-06-29, 2010-06-30".
I just need an idea where to start....
Thanks! | 2010/07/30 | [
"https://Stackoverflow.com/questions/3369871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338476/"
] | Iterate over the list and compare each date with the next one until you have four matching your criteria. | Now thats my approach.
returns a list of Integers representing the length of each series of days in a row in that time period. Thanks Russel for your method. I tried compareto() of Date until i realized that its return value does not represent the days the two compared dates are seperated from each other.
```
pub... |
3,369,871 | I don't know if I described it correctly.
I have several lists of dates in Java. Now I need to know when a list contains at least 4 dates that follow each other. e.g. "2010-06-27, 2010-06-28, 2010-06-29, 2010-06-30".
I just need an idea where to start....
Thanks! | 2010/07/30 | [
"https://Stackoverflow.com/questions/3369871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338476/"
] | That's is my approach ...
```
public List<List> getList(List<List<Date>> lists, int num) {
List<List> result = new ArrayList<List>();
for (List list : lists) {
Collections.sort(list);
if (checkList(list, num)) {
result.add(list);
}
}
return result;
}
public boo... | Convert the date in miliseconds via date/calendar classes and then the comparation is trivial. |
3,369,871 | I don't know if I described it correctly.
I have several lists of dates in Java. Now I need to know when a list contains at least 4 dates that follow each other. e.g. "2010-06-27, 2010-06-28, 2010-06-29, 2010-06-30".
I just need an idea where to start....
Thanks! | 2010/07/30 | [
"https://Stackoverflow.com/questions/3369871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338476/"
] | That's is my approach ...
```
public List<List> getList(List<List<Date>> lists, int num) {
List<List> result = new ArrayList<List>();
for (List list : lists) {
Collections.sort(list);
if (checkList(list, num)) {
result.add(list);
}
}
return result;
}
public boo... | Now thats my approach.
returns a list of Integers representing the length of each series of days in a row in that time period. Thanks Russel for your method. I tried compareto() of Date until i realized that its return value does not represent the days the two compared dates are seperated from each other.
```
pub... |
3,369,871 | I don't know if I described it correctly.
I have several lists of dates in Java. Now I need to know when a list contains at least 4 dates that follow each other. e.g. "2010-06-27, 2010-06-28, 2010-06-29, 2010-06-30".
I just need an idea where to start....
Thanks! | 2010/07/30 | [
"https://Stackoverflow.com/questions/3369871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338476/"
] | What about this:
```
public static boolean checkList(List<Date> list) {
int count = 0;
for (int i = 0; i < list.size()-1; ++i) {
if (list.get(i).after(list.get(i+1))) {
count = 0;
} else {
++count;
if (count == 4) {
return true;
}
... | Convert the date in miliseconds via date/calendar classes and then the comparation is trivial. |
3,369,871 | I don't know if I described it correctly.
I have several lists of dates in Java. Now I need to know when a list contains at least 4 dates that follow each other. e.g. "2010-06-27, 2010-06-28, 2010-06-29, 2010-06-30".
I just need an idea where to start....
Thanks! | 2010/07/30 | [
"https://Stackoverflow.com/questions/3369871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338476/"
] | What about this:
```
public static boolean checkList(List<Date> list) {
int count = 0;
for (int i = 0; i < list.size()-1; ++i) {
if (list.get(i).after(list.get(i+1))) {
count = 0;
} else {
++count;
if (count == 4) {
return true;
}
... | Now thats my approach.
returns a list of Integers representing the length of each series of days in a row in that time period. Thanks Russel for your method. I tried compareto() of Date until i realized that its return value does not represent the days the two compared dates are seperated from each other.
```
pub... |
5,298,704 | I'm just a beginner in programming wpf and MVVM.
I have to make a sort of wizard to create or delete or edit something. So my first window is a menu with 3 or more buttons. When you click on one of these buttons you go to the next screen.. I was able to do this with the code behind with window.show(), but i read that i... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5298704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/658796/"
] | Not all functions are used widely enough to "deserve" a name. For example, if you're only using this function once, for this specific map, you probably don't want to assign it a name because you'll never use it again. | If I understand your question correctly you are asking why someone would come up with the abstraction of Lambda functions outside of the scope of a specific programming language, correct?
Well, Lambda functions in programming languages are derived from [Lambda calculus](http://en.wikipedia.org/wiki/Lambda_calculus), w... |
5,298,704 | I'm just a beginner in programming wpf and MVVM.
I have to make a sort of wizard to create or delete or edit something. So my first window is a menu with 3 or more buttons. When you click on one of these buttons you go to the next screen.. I was able to do this with the code behind with window.show(), but i read that i... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5298704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/658796/"
] | There's two ways to interpret this question. The first is why write `map (\x -> x * x)` when we can write
```
doubleIt x = x * x
... map doubleIt ...
```
The answer there is that you may have the following:
```
foo y zs = map (\x -> x^y) zs
```
and then there is no fully straightfoward transformation that allows ... | Not all functions are used widely enough to "deserve" a name. For example, if you're only using this function once, for this specific map, you probably don't want to assign it a name because you'll never use it again. |
5,298,704 | I'm just a beginner in programming wpf and MVVM.
I have to make a sort of wizard to create or delete or edit something. So my first window is a menu with 3 or more buttons. When you click on one of these buttons you go to the next screen.. I was able to do this with the code behind with window.show(), but i read that i... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5298704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/658796/"
] | you often face the situation, that you need a pretty specialized function. It is used in this part of your software and only there. Therefore it doesn't make any sense, to give it a concrete name. | If I understand your question correctly you are asking why someone would come up with the abstraction of Lambda functions outside of the scope of a specific programming language, correct?
Well, Lambda functions in programming languages are derived from [Lambda calculus](http://en.wikipedia.org/wiki/Lambda_calculus), w... |
5,298,704 | I'm just a beginner in programming wpf and MVVM.
I have to make a sort of wizard to create or delete or edit something. So my first window is a menu with 3 or more buttons. When you click on one of these buttons you go to the next screen.. I was able to do this with the code behind with window.show(), but i read that i... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5298704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/658796/"
] | There's two ways to interpret this question. The first is why write `map (\x -> x * x)` when we can write
```
doubleIt x = x * x
... map doubleIt ...
```
The answer there is that you may have the following:
```
foo y zs = map (\x -> x^y) zs
```
and then there is no fully straightfoward transformation that allows ... | you often face the situation, that you need a pretty specialized function. It is used in this part of your software and only there. Therefore it doesn't make any sense, to give it a concrete name. |
5,298,704 | I'm just a beginner in programming wpf and MVVM.
I have to make a sort of wizard to create or delete or edit something. So my first window is a menu with 3 or more buttons. When you click on one of these buttons you go to the next screen.. I was able to do this with the code behind with window.show(), but i read that i... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5298704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/658796/"
] | Readability; you can have ( far fetched, but to illustrate the point )
```
map (\x -> x * 2) . anotherfunction . anotheragain . itgoesonandon $
[ a lont list ]
```
vs
```
map f . anotherfunction . anotheragain . itgoesonandon $
[ a lont list ]
where f x = x * 2
```
It's matter of taste but in the first case you... | If I understand your question correctly you are asking why someone would come up with the abstraction of Lambda functions outside of the scope of a specific programming language, correct?
Well, Lambda functions in programming languages are derived from [Lambda calculus](http://en.wikipedia.org/wiki/Lambda_calculus), w... |
5,298,704 | I'm just a beginner in programming wpf and MVVM.
I have to make a sort of wizard to create or delete or edit something. So my first window is a menu with 3 or more buttons. When you click on one of these buttons you go to the next screen.. I was able to do this with the code behind with window.show(), but i read that i... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5298704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/658796/"
] | There's two ways to interpret this question. The first is why write `map (\x -> x * x)` when we can write
```
doubleIt x = x * x
... map doubleIt ...
```
The answer there is that you may have the following:
```
foo y zs = map (\x -> x^y) zs
```
and then there is no fully straightfoward transformation that allows ... | Readability; you can have ( far fetched, but to illustrate the point )
```
map (\x -> x * 2) . anotherfunction . anotheragain . itgoesonandon $
[ a lont list ]
```
vs
```
map f . anotherfunction . anotheragain . itgoesonandon $
[ a lont list ]
where f x = x * 2
```
It's matter of taste but in the first case you... |
5,298,704 | I'm just a beginner in programming wpf and MVVM.
I have to make a sort of wizard to create or delete or edit something. So my first window is a menu with 3 or more buttons. When you click on one of these buttons you go to the next screen.. I was able to do this with the code behind with window.show(), but i read that i... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5298704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/658796/"
] | There's two ways to interpret this question. The first is why write `map (\x -> x * x)` when we can write
```
doubleIt x = x * x
... map doubleIt ...
```
The answer there is that you may have the following:
```
foo y zs = map (\x -> x^y) zs
```
and then there is no fully straightfoward transformation that allows ... | If I understand your question correctly you are asking why someone would come up with the abstraction of Lambda functions outside of the scope of a specific programming language, correct?
Well, Lambda functions in programming languages are derived from [Lambda calculus](http://en.wikipedia.org/wiki/Lambda_calculus), w... |
41,001,399 | I'm working on an accordion panel group. They all open just fine, but I can't figure out how to get them to close upon opening another element.
Here is what I'm working on in terms of code:
```
<div class="container">
<div class="row">
<div id="trickslist">
<ul>
<li>
<a class="expand">
... | 2016/12/06 | [
"https://Stackoverflow.com/questions/41001399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6201534/"
] | I updated your fiddle, hope that solves your problem =)
Here is the jQuery. Check out the [Fiddle](https://jsfiddle.net/kymera28/99rgmm66/5/)
```
$(".expand").on("click", function () {
$(".right-arrow").text("+");
$(".detail:visible").slideUp();
if(!$(this).next().is(":visible")){
$(this).next().s... | From your fiddle I can't see anything's expanding right now but there is a simple trick to achieve that functionality: at click hide all and than show just that particular.
```
$(".expand").click(function(){
$(".detail").collaps();
$(this).parent().find(".detail").expand();
});
``` |
41,001,399 | I'm working on an accordion panel group. They all open just fine, but I can't figure out how to get them to close upon opening another element.
Here is what I'm working on in terms of code:
```
<div class="container">
<div class="row">
<div id="trickslist">
<ul>
<li>
<a class="expand">
... | 2016/12/06 | [
"https://Stackoverflow.com/questions/41001399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6201534/"
] | From your fiddle I can't see anything's expanding right now but there is a simple trick to achieve that functionality: at click hide all and than show just that particular.
```
$(".expand").click(function(){
$(".detail").collaps();
$(this).parent().find(".detail").expand();
});
``` | Save yourself a lot of time, grief, and maintenance by using a library that already has this functionality. Both jQuery UI and Kendo UI are tried-and-tested and have been used by developers all over the world. Someone else has already worked out the kinks. Work smart! (I don't work for either.)
<https://jqueryui.com/a... |
41,001,399 | I'm working on an accordion panel group. They all open just fine, but I can't figure out how to get them to close upon opening another element.
Here is what I'm working on in terms of code:
```
<div class="container">
<div class="row">
<div id="trickslist">
<ul>
<li>
<a class="expand">
... | 2016/12/06 | [
"https://Stackoverflow.com/questions/41001399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6201534/"
] | I updated your fiddle, hope that solves your problem =)
Here is the jQuery. Check out the [Fiddle](https://jsfiddle.net/kymera28/99rgmm66/5/)
```
$(".expand").on("click", function () {
$(".right-arrow").text("+");
$(".detail:visible").slideUp();
if(!$(this).next().is(":visible")){
$(this).next().s... | Save yourself a lot of time, grief, and maintenance by using a library that already has this functionality. Both jQuery UI and Kendo UI are tried-and-tested and have been used by developers all over the world. Someone else has already worked out the kinks. Work smart! (I don't work for either.)
<https://jqueryui.com/a... |
105,887 | When resistances connected in series then why through each resistances the different potential difference occurs? | 2014/03/31 | [
"https://physics.stackexchange.com/questions/105887",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/43553/"
] | Inside the solar system the solar wind consists of sub-atomic particles that form a plasma, one of the four states (phases) of matter along with solid liquid and gas. [Plasma](http://en.wikipedia.org/wiki/Plasma_%28physics%29) is basically a gas of charged particles--normal gas laws don't apply as moving charges create... | In a sense this could be an interpretation of gravitational waves. In this case, anything with energy or mass or momentum (relating by the stress-energy tensor in GR) could bend space-time producing gravitational waves.
hopefully I'm understanding you correctly. |
63,612,183 | I have four HTML elements:
```
<img>
<img>
<p></p>
<input>
```
Currently, they load roughly in order from bottom to top (the bottom two load first) and this creates a disturbing effect where the input and text loads near the top and the traverses down the page as the images pop in.
I'd like for each element to load... | 2020/08/27 | [
"https://Stackoverflow.com/questions/63612183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13875364/"
] | You can't drag the items across the `Canvas`, because you are using an `ItemsControl`. This control wraps each item into a container. You are currently trying to drag the content of this container, but not the container. It is the container that is actually positioned within the `Canvas`.
To reduce complexity I recomm... | BionocCode solution work right but i found another way, i change only two methods
```
private void MoveThumb_DragDelta(object sender, DragDeltaEventArgs e)
{
ContentControl designerItem = DataContext as ContentControl;
if (designerItem != null)
{
Point dragDelta = new Point(e.H... |
163,603 | I have a Java process running on a RedHat Linux instance.
The problem is it keeps reappearing after I kill it. I am not sure where to look. I've already went to crontab, but no luck.
I've looked at the PPID, but it points to init (1).
Any idea how I can find out the source? | 2014/10/22 | [
"https://unix.stackexchange.com/questions/163603",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/88790/"
] | There are a number of possibilities (some mentioned in other answers):
1. A system or user cronjob executing often,
2. In SysV init, an `/etc/inittab` entry for the service with the `respawn` directive,
3. In systemd, a unit file with the `Restart` option set to a value other than `no`,
4. In Upstart, a service config... | I believe you could use `pstree`. You could specify the command as,
```
pstree -p PID
```
The above will give you a list of all parents of the java applications. |
163,603 | I have a Java process running on a RedHat Linux instance.
The problem is it keeps reappearing after I kill it. I am not sure where to look. I've already went to crontab, but no luck.
I've looked at the PPID, but it points to init (1).
Any idea how I can find out the source? | 2014/10/22 | [
"https://unix.stackexchange.com/questions/163603",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/88790/"
] | I believe you could use `pstree`. You could specify the command as,
```
pstree -p PID
```
The above will give you a list of all parents of the java applications. | If you don't know who is the parent, you should you some system tracer like [auditd](http://linux.die.net/man/8/auditd)
you'd enable logging with:
```
auditctl -a exit,always -S execve -F path=/usr/bin/rrdtool
```
and then in `/var/log/audit/audit.log` find lines like:
```
type=SYSCALL msg=audit(1414027338.620:623... |
163,603 | I have a Java process running on a RedHat Linux instance.
The problem is it keeps reappearing after I kill it. I am not sure where to look. I've already went to crontab, but no luck.
I've looked at the PPID, but it points to init (1).
Any idea how I can find out the source? | 2014/10/22 | [
"https://unix.stackexchange.com/questions/163603",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/88790/"
] | There are a number of possibilities (some mentioned in other answers):
1. A system or user cronjob executing often,
2. In SysV init, an `/etc/inittab` entry for the service with the `respawn` directive,
3. In systemd, a unit file with the `Restart` option set to a value other than `no`,
4. In Upstart, a service config... | You could have a look at its PPID (parent process ID) :
```
$ ps -eo pid,ppid,args | grep java
```
Once you've got the PPID (second column) of your Java process, use `ps` again to find the associated process:
```
$ ps -p [PPID]
```
*Edit* : if the parent is 1 (init), then the *first* parent of your Java process d... |
163,603 | I have a Java process running on a RedHat Linux instance.
The problem is it keeps reappearing after I kill it. I am not sure where to look. I've already went to crontab, but no luck.
I've looked at the PPID, but it points to init (1).
Any idea how I can find out the source? | 2014/10/22 | [
"https://unix.stackexchange.com/questions/163603",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/88790/"
] | You could have a look at its PPID (parent process ID) :
```
$ ps -eo pid,ppid,args | grep java
```
Once you've got the PPID (second column) of your Java process, use `ps` again to find the associated process:
```
$ ps -p [PPID]
```
*Edit* : if the parent is 1 (init), then the *first* parent of your Java process d... | If you don't know who is the parent, you should you some system tracer like [auditd](http://linux.die.net/man/8/auditd)
you'd enable logging with:
```
auditctl -a exit,always -S execve -F path=/usr/bin/rrdtool
```
and then in `/var/log/audit/audit.log` find lines like:
```
type=SYSCALL msg=audit(1414027338.620:623... |
163,603 | I have a Java process running on a RedHat Linux instance.
The problem is it keeps reappearing after I kill it. I am not sure where to look. I've already went to crontab, but no luck.
I've looked at the PPID, but it points to init (1).
Any idea how I can find out the source? | 2014/10/22 | [
"https://unix.stackexchange.com/questions/163603",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/88790/"
] | There are a number of possibilities (some mentioned in other answers):
1. A system or user cronjob executing often,
2. In SysV init, an `/etc/inittab` entry for the service with the `respawn` directive,
3. In systemd, a unit file with the `Restart` option set to a value other than `no`,
4. In Upstart, a service config... | If you don't know who is the parent, you should you some system tracer like [auditd](http://linux.die.net/man/8/auditd)
you'd enable logging with:
```
auditctl -a exit,always -S execve -F path=/usr/bin/rrdtool
```
and then in `/var/log/audit/audit.log` find lines like:
```
type=SYSCALL msg=audit(1414027338.620:623... |
454 | Because Joomla uses so much third party components and such, what are some safe functions and classes to add to the php.ini for disabled\_classes and disabled\_functions?
The reason I ask this is for locking down a server more, adding more to those php.ini properties is best.
`exec()` is obvious however ones like `ba... | 2014/04/29 | [
"https://joomla.stackexchange.com/questions/454",
"https://joomla.stackexchange.com",
"https://joomla.stackexchange.com/users/75/"
] | These are some common ones that folks recommend disabling:
show\_source,
system,
shell\_exec,
passthru,
exec,
popen,
proc\_open,
Especially in Joomla environments without any problems. It's really more of a use-case thing when it comes to some functions, but ideally you don't want to leave on any of the especially sh... | A good practice is to have a system user exclusive to run your joomla. Thus you can restrict this user to access only the joomla folder.
I think you must avoid to disable these functions because some extension can need them for good and not for evil. |
454 | Because Joomla uses so much third party components and such, what are some safe functions and classes to add to the php.ini for disabled\_classes and disabled\_functions?
The reason I ask this is for locking down a server more, adding more to those php.ini properties is best.
`exec()` is obvious however ones like `ba... | 2014/04/29 | [
"https://joomla.stackexchange.com/questions/454",
"https://joomla.stackexchange.com",
"https://joomla.stackexchange.com/users/75/"
] | These are some common ones that folks recommend disabling:
show\_source,
system,
shell\_exec,
passthru,
exec,
popen,
proc\_open,
Especially in Joomla environments without any problems. It's really more of a use-case thing when it comes to some functions, but ideally you don't want to leave on any of the especially sh... | If you are relying on the php.ini settings for disabling core functions to give you more "security" then you have already failed.
Server security is about more than disabling functions. Infact a very secure server doesnt need any PHP Functions disabled in the way you refer to.
Furthermore if you implement per user ph... |
454 | Because Joomla uses so much third party components and such, what are some safe functions and classes to add to the php.ini for disabled\_classes and disabled\_functions?
The reason I ask this is for locking down a server more, adding more to those php.ini properties is best.
`exec()` is obvious however ones like `ba... | 2014/04/29 | [
"https://joomla.stackexchange.com/questions/454",
"https://joomla.stackexchange.com",
"https://joomla.stackexchange.com/users/75/"
] | If you are relying on the php.ini settings for disabling core functions to give you more "security" then you have already failed.
Server security is about more than disabling functions. Infact a very secure server doesnt need any PHP Functions disabled in the way you refer to.
Furthermore if you implement per user ph... | A good practice is to have a system user exclusive to run your joomla. Thus you can restrict this user to access only the joomla folder.
I think you must avoid to disable these functions because some extension can need them for good and not for evil. |
70,160,886 | I'm trying to edit the names of the factor levels of a predictor variable in R for an effect plot with the jtools package. I should be able to do this with the "pred.labels" argument, but the labels don't change. For example, using the mtcars data set I try to write out the predictor names ("four", "six", "eight") but ... | 2021/11/29 | [
"https://Stackoverflow.com/questions/70160886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17545393/"
] | Since `jtools` seems to use `ggplot2` you can just change the labels like you would if you were using `ggplot2`
```
label <- c("four", "six", "eight")
effect_plot(mtest, pred = cyl) + scale_x_discrete(labels= label)
```
or
```
effect_plot(mtest, pred = cyl) + scale_x_discrete(labels= c("four", "six", "eight"))
```... | Not sure how to rename the group labels in jtools but you can do it with `scale_x_discrete` in ggplot2 since the resulting object is from ggplot.
```
effect_plot(mtest, pred = cyl) +
scale_x_discrete(labels = c("four", "six", "eight"))
```
[](https://i.stack.imgur.com... |
52,499,026 | I try to run a task in a docker image, which is not uploaded to docker hub, but instead installed locally (using `docker build -t tagname/tagname` .) So it exists on the (only) worker.
```
image_resource:
type: docker-image
source: {repository: tagname/tagname}
```
However, that approach fails with the following... | 2018/09/25 | [
"https://Stackoverflow.com/questions/52499026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5495666/"
] | This is possible with the [rootfs\_uri](https://concourse-ci.org/tasks.html#task-rootfs-uri) task parameter.
You will have to find out where exactly in the worker filesystem the rootfs created by `docker build` is stored, and then reference it in the task with `rootfs_uri: file://<your_rootfs>`.
As the documentation... | From @Josh Zarrabi's answer, which I accept for its correctness I learned, not to do it. So the correct approach is to set up your own docker registry, which is very simple using the <https://hub.docker.com/_/registry/> container. |
20,404,449 | I need to read the text from a .dat file that goes as such:
```
4
Mary 13.99
Ruth 22.04
Anne 12.39
Talor 18.34
```
I used a buffered reader that looks like this:
```
public class Tester{
public static void main(String [] args){
BufferedReader reader = null;
try {
File file = new File... | 2013/12/05 | [
"https://Stackoverflow.com/questions/20404449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3070681/"
] | Don't split the first line. Do split second line onward.
```
reader.readLine(); //added this line
while ((line = reader.readLine()) != null){
}
``` | It's because the first line only has one field. Try this instead:
```
double total = 0;
while ((line = reader.readLine()) != null) {
String[] str1Array = line.split(" ");
if(str1Array.length > 1) {
System.out.println(str1Array[1]);
total += Double.parseDouble(str1Ar... |
20,404,449 | I need to read the text from a .dat file that goes as such:
```
4
Mary 13.99
Ruth 22.04
Anne 12.39
Talor 18.34
```
I used a buffered reader that looks like this:
```
public class Tester{
public static void main(String [] args){
BufferedReader reader = null;
try {
File file = new File... | 2013/12/05 | [
"https://Stackoverflow.com/questions/20404449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3070681/"
] | If your input file is *guaranteed* to be in the format you posted, you can simply do this:
```
reader.readLine();
while ((line = reader.readLine()) != null) {
...
```
This would cause your reader to consume the first line of the file and ignore it completely. That said, the file you've posted *suggests* that the... | It's because the first line only has one field. Try this instead:
```
double total = 0;
while ((line = reader.readLine()) != null) {
String[] str1Array = line.split(" ");
if(str1Array.length > 1) {
System.out.println(str1Array[1]);
total += Double.parseDouble(str1Ar... |
20,404,449 | I need to read the text from a .dat file that goes as such:
```
4
Mary 13.99
Ruth 22.04
Anne 12.39
Talor 18.34
```
I used a buffered reader that looks like this:
```
public class Tester{
public static void main(String [] args){
BufferedReader reader = null;
try {
File file = new File... | 2013/12/05 | [
"https://Stackoverflow.com/questions/20404449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3070681/"
] | Don't split the first line. Do split second line onward.
```
reader.readLine(); //added this line
while ((line = reader.readLine()) != null){
}
``` | The `String.split(String)` method discards all emtpy Strings at the end of the array as per API-Documentation. If you ned to get back fixed-size arrays use `line.split(" ",-1)` - but be prepared to handle empty Strings in the result. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.