How do I do this?
My code is something like this:
var number = null;
function playSong(artist,title,song,id)
{
alert('old number was: '+[number]+'');
var number = '10';
alert(''+[number]+'');
}
The first alert always returns 'old number was: ' and not 10. Shouldn't it return 10 on both alerts on the second function ca...
Hi,
I have a code snippet that goes like this:
$('#content').css('padding-top', heightTwo + 44 + 'px');
heightTwo is always changing. When it has the value 200 for example, the padding top gets the value 20044. I want it to be 244 but don't know how to write it. What is the correct syntax?
Thanks
...
I have a loop spitting out values and are put into a string:
$all_values = "";
while loop {
$value = "...";
$all_values .= $value . ",";
}
Output: 1,3,8,2,10...
What's the simplest way to output the same thing but numbers in reverse so the above example would come out like ...10,2,8,3,1
...
as it stands i have to maintain a variable in my application.(cfm|cfc) to set the environment, which the application currently runs under. the environment being (development|test|production).
i'd like to set and environment variable on the server itself, so that i can read its value in the application.cfm.
is that possible?
...
I need the path specified in $_SERVER['DOCUMENT_ROOT'] to be accessible in .htaccess file.
Is there a way to access it there?
I basically need to point to a file kept at the root and need the actual file system path and not the URL path. So instead of using a hard coded value, I'd like to be able to use a variable.
Thanks.
...
Is it good practice to initialize a global variable in PHP? The snippet of code seems to work fine, but is it better to initialize (in a larger project, say for performance sake) the variable outside of a function, like in the second scratch of code?
if(isset($_POST["Return"]))Validate();
function Validate(){
(!empty($_POST["From"])...
What I would like to do is something like the following:
#!/bin/sh
EMAIL="-e 's/SOMETHING//g'"
somecommand | sed "$EMAIL"
But I get the following:
sed: -e expression #1, char 2: unknown command: `''
I've tried many variations. I know it just a matter of getting the string quoting right. The reason I'd like to do this is to break...
Okay, what I'm trying to do is take the results from a stored procedure and put them into a temp table...
Looks like this:
DECLARE @Table TABLE(
[ID] int,
[CostA] real,
[CostB] real,
[CostC] real
)
INSERT INTO @Table
EXECUTE [dbo].[CostProcedure]
@RootId = 123
@Rate = 20
--THEN:
SELECT * FROM @Table -- Gives Me...
Hello, all SO users!
I have a bit of PHP code (for the module feature of my CMS (not drupal) which allows people to view pages, comments, forum posts, blog posts, etc...):
if(isset($_GET["m"]))
{
//Does the module exist and activated, and has it a function called view?
if(isset($module_exists[$_GET["m"]]) && method_exists($_GET...
So in a nutshell on "page1.php" I have a calculator that consists of an html form, and then the php code totals the input and displays the total price. Below the price, it also displays a link to "page2.php" which contains an html form where they can enter their contact information and upon submitting the form the selections they made on...
I have a reasonably large number of variables encoded in the form:
foo=bar&spam[eggs]=delicious&...
These are all in a single string (eg, $data = "foo=bar&spam[eggs]=delicious&..."). The variables are arbitrarily deeply nested -- easily four or five levels deep ("spam[eggs][bloody][vikings]=loud").
Is there an easy, reliable way to ...
Hi
I would like to put the input of a multi-valued string parameter in SSRS into a table, so I can join onto it, instead of using an in (@variable).
I know how to do it in a proc, but I want to do it in SSRS itself, as sending it through to a proc limits it to 8000 characters.
Thanks
...
How to grab the string that a function echoes to a variable?
I've go a function similar to this:
function echoer() {
echo 'foo';
}
I cannot change it's source. What I would like to do is to store 'foo' in a variable instead of letting it go to the standard output. How is it done in PHP?
...
Is there any differences between doing
Field field = something.getSomethingElse().getField();
if (field == 0) {
//do something
}
somelist.add(field);
versus
if (something.getSomethingElse().getField() == 0) {
//do something
}
somelist.add(something.getSomethingElse().getField());
Do references to the field through getters i...
Hi, I'm doing a little experiment trying to randomly place images inside a div using a javascript loop. I've been having some trouble with it.
Here's what I have (simplified):
for(var i = 0; i < 10; i++)
{
var top = random(-20, 20);
var left = random(-20, 20);
document.write(
<div class="one" style="\"left:" + left + ";\"">
<img...
Pretty straightforward, I've got a JS script that's included on many different sites and needs to have parameters passed to it.
It would be useful if those could be passed via the URL, eg:
<script type="text/javascript"
src="http://path.to/script.js?var1=something&var2=somethingelse"></script>
Yes, you can still pre...
Hello. Is is possible to print to stderr the value of a preprocessor variable in C? For example, what I have right now is:
#define PP_VAR (10)
#if (PP_VAR > 10)
#warning PP_VAR is greater than 10
#endif
But what I'd like to do is:
#define PP_VAR (10)
#if (PP_VAR > 10)
#warning PP_VAR=%PP_VAR%
#endif
Is something like this...
i now have experience working on both asp.net and php.
asp scores on the integration and rich set of outofbox features and the power of C#. However after using php for some time, i came across a nifty feature in it which i desire to be there in asp.net
in php we can use the variables like this
$bar = "My name is $bar and my pet's name...
Hello,
I have a scenario where a user creates a workbook, then this workbook (let's call it A) is assigned a variable. Later on down the line, the user creates a second workbook (let's call it B), which is assigned another variable. The names of these workbooks are not fixed, thus they are always variables.
Now I want to do a VLOOKUP...
Hi all, I am really new to online web application. I am using php, I got this code:
if(isset($_GET['return']) && !empty($_GET['return'])){
return = $_GET['return'];
header("Location: ./index.php?" . $return);
} else {
header("Location: ./index.php");
}
the $return variable is URL variable which can be easily changed by hacker.
E...