I need some PHP code to convert some PHP into JS.
functionality - I'm using common PHP functions from php.js
syntax - ???
The issue is converting the syntax. I don't need full PHP syntax, mind you; no need for supporting class definitions/declarations. Here's a small checklist of what needs conversion:
"." should be "+" (string con...
Here's what I am trying to accomplish:
function foo($args) {
switch($args['type']) {
case 'bar':
bar($args['data']); // do something
break;
}
}
// or something like that
Which is basically a way of using named parameters in PHP.
Now, in order to build this $args array, I am forced to write ugly syntax like:
$builtArgs = a...
This has been driving me crazy! It must be something simple.
Here is my code:
Select
logid,
row_date,
sum(acdcalls) as 'total calls',
sum(ti_stafftime) as 'total time staffed',
sum(acdtime) as 'time on the phone',
Case acdtime
When acdtime > 0 Then
sum(ti_stafftime/acdtime)
Else '0'
End as MyPercent,
RepLName+', '+RepFName AS Agent,
S...
Hi SO, I'm thinking of developing a more efficient version of the Rich Text format but I need to know a little about Syntax Highlighting and Syntax Extraction.
Like when reading the file, read all the {Property Boxes} and use them in a RichTextBox.
Ex:
{C=0000FF}Hello world!{/C}
Prints "Hello world!" in red.
This would also be good to ...
I'm trying to use this code:
UPDATE media_items SET content_url = replace(content_url,’cd%20images’,'my%20music’);
And I know that the percent signs are mucking it up, and I have to use some sort of escape to get them to read properly, but I've done a bunch of searching, and anything I find doesn't seem to work. What is the proper sy...
I noticed recently that there are two ways to print multiple statements in PHP.
echo $a.$b; // Echo's $a and $b conjoined, and
echo $a,$b; // Echo's $a and echo's $b.
Is there any point in time where the difference between these two syntaxes matters?
...
I have several one-line binding already written and I'd like to keep it that way if possible and if it still is humanly readable.
Is there any way to rewrite this
<TextBox.Text>
<Binding Path="SomePath" NotifyOnValidationError="True" >
<Binding.ValidationRules>
<local:ValidationRule1></local:ValidationRule1>
...
I am new to .net completely and I just need to know the syntax, or possible functions to put in my if statement to check if <% If Model.contacts Is Null Then%> which isn't correct.
Where Model.contacts comes from my ClientViewModel, and Model.contacts is of type System.Linq.IQueryable(Of Contact)
Here is the code for addresses...
<% ...
Today I saw a javascript syntax (when invoking a function) that is unfamiliar to me. It was like:
def('Person') ({
init: function(name) {this.name=name;}
,speak: function(text) {alert(text || 'Hi, my name is ' + this.name);}
});
, and
def('Ninja') << Person ({
kick: function() {this.speak('I kick u!');}
});
1: What happens ...
This doesn't compile with Scala 2.7.7.final or 2.8.0.final for me:
new FileInputStream("test.txt") getChannel transferTo(
0, Long.MaxValue, new FileOutputStream("test-copy.txt") getChannel)
This does compile with Scala 2.7.7.final and 2.8.0.final for me:
new FileInputStream("test.txt") getChannel() transferTo(
0, Long.MaxValu...
Just out of curiously, what is d:IsOptimized in Expressions Blend?
While I know that d: is a namespace for design-time attributes, does anyone know what d:IsOptimized actually does? Is there anywhere that these Blend-specific attributes are documented?
It's not in the design-time attributes supported (and documented) by Visual Studio:...
java -Ddata=args -Dcommit=no -jar post.jar
In the above script,how are data and commit accessed in java?
...
I have been looking at some C# code:
List<Employee> Employees = new List<Employee>{
new Employee{firstname="Aamir",lastname="Hasan",age=20},
new Employee{firstname="awais",lastname="Hasan",age=50},
new Employee{firstname="Bill",lastname="Hasan",age=70},
new Employee{firstname="sobia",lastname="khan",age=80},
};
N...
The following declaration in C:
int* a, b;
will declare a as type int* and b as type int. I'm well aware of this trap, but what I want to know is why it works this way. Why doesn't it also declare b as int*, as most people would intuitively expect? In other words, why does * apply to the variable name, rather than the type?
Sure you ...
I was curious to know how exactly typedef works.
typedef struct example identifier;
identifier x;
In above statement is 'identifier' just replaced (somethings like string replacement) with 'struct example' in code? If no, what does typedef do here?
please enlighten!
...
Suppose we have following two classes:
class Temp{
public:
char a;
char b;
};
class Final{
private:
int a;
char b;
char c;
public:
Final(Temp in):b(in.a),c(in.b){}
//rest of implementation
};
can we initialize an object of the Final class with following syntax in upcoming c++0x standard:
Final obj(Temp{'a','b'});
...
i have a simple clojure syntax problem (bc i am new to the language). for both examples i have a list lst of (1 2 3 4):
in Lisp i can write:
=>`(first of list is ,(first lst))
(first of list is 1)
in Clojure, if i write the same thing (with the language translation of , to ~ as i THOUGHT i read somewhere) i get:
=>'(first of...
I have
class P {
function fun() {
echo "P";
}
}
class Ch {
function fun() {
echo "Ch";
}
}
$x = new Ch();
How to call parent function fun from $x? Is it possible to do it directly or I have to write:
function callParent {
parent::fun();
}
...
Could anybody help me figure out the syntax of the code below?
"AddonInfo"
{
"name" "Addon name"
"version" "Current Version"
"up_date" "Date of update"
"author_name" "Addon's Author"
"author_email" ""
"info" "Addon's Info"
"o...
I am working on a game in OBJ C that has a ball view and a stage view. The stage view has 4 subviews. All views are UIImageViews. I have a method for collision detection that is working. I would like to expand it to more than 4 subviews without simply creating more lines of code. Looking at the code below, is there a way to simplify this...