How can I convert a string to JSON in javascript, is there a method that does that?
Something like:
var x = "{ id: 5, name: 'hello' }";
var y = /*something*/(x);
alert(y.id + " " + y.name);
For instance this code:
function stuff() {
this.onlyMethod = function () {
return something;
}
}
// some error is thrown
stuff().nonExistant();
Is there a way to do something like PHP's __call as a fallback from inside the object?
function stuff() {
this.onlyMethod = function () {
return something;
}
this.__call__ = function (name, params) {
alert(name + " can't be called.");
}
}
// would then raise the alert "nonExistant can't be called".
stuff().nonExistant();
I want to use mode rewrite to display the following:
mydomain.com/Florida/Tampa/ instead of mydomain.com/place.php?state=Florida&city=Tampa
I've akready done this: (since I think it might make a difference!)
mydomain.com/[name].html instead of mydomain.com/profile?user=[name]
Here is the code!
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{SCRIPT_FILENAME}! !-f
RewriteCond %{SCRIPT_FILENAME}! !-d
RewriteRule (.*).html profile.php?user=$1 [QSA.L]
I have a table with
name varchar
address varchar
country varchar
city varchar
.....
to store address of location
example:
name|address|country
HaLong hotel|156 blahblah street|Vietnam
Hotel Ha Long|156 blah blah|Vietnam
Two rows above is duplicate data.
I have a form, when user submit new location. The code need to find akin records to give a message (ex: This location already in db, use it or create new?)
How to make a query to get akin record like this?
i have a table called Cars and the primary key of the table is 'id'. I also have a field called 'name'. I would like to make sure no one enters the same name twice even though it wont break my db integrity.
what is the best way of doing this?
I have 2 text boxes one for email and one for Name. If text is entered in email I want to make Name required field. How can I do this using .net validation controls?
Thanks
I have the unicode for that char, how do I display it?
0x023D2A
textField.text = ???;
i have have the name of the character.
can I reference it by name?
I am setting an object like this
n.name = n.name.join(String.fromCharCode(255));
n.description = n.description.join(String.fromCharCode(255));
I want to be able to alert(n); but it tells me [Object]
is there a way to alert complete object?
thanks
I have a class Klass with a class attribute my_list. I have a subclass of it SubKlass, in which i want to have a class attribute my_list which is a modified version of the same attribute from parent class:
class Klass():
my_list = [1, 2, 3]
class SubKlass(Klass):
my_list = Klass.my_list + [4, 5] # this works, but i must specify parent class explicitly
#my_list = super().my_list + [4, 5] # SystemError: super(): __class__ cell not found
#my_list = my_list + [4, 5] # NameError: name 'my_list' is not defined
print(Klass.my_list)
print(SubKlass.my_list)
So, is there a way to access parent class attribute without specifying its name?
I need to transfer some data from another Database. The old database is called paw1.moviesDB and the new database is paw1. The schema of each table are the following
Awards (name of the table)(new DB)
Id [PK] Serial Award
Nominations (name of the table) (old DB)
Id [PK] Serial nominations
I want to copy the data from old DB to the new DB.
Hi Friends i am using uploadify for my project.. in that i need to pass some data to upload.php to insert it in database. i am using the below code for sending data and getting it using $_POST in that upload.php file but its not getting those values.
$("#fileupload").fileUpload({
'uploader': 'uploadify/uploader.swf',
'cancelImg': 'uploadify/cancel.png',
'script': 'uploadify/upload.php',
'scriptData' : {'name':'name','status':1}
Can anyone help me on this ..
in PHP Consider this function:
function test($name, $age) {}
I need to somehow extract the parameter names (for generating custom documentations automatically) so that I could do something like:
get_func_argNames('test');
and it would return Array['name','age'] .
Is this even possible in PHP ?
With this query, I get a result that is two short of the table because they are not included in count, and I would like get the NULL values in the result. To do this, I am pretty sure I need to use a subquery of some kind, but I am not sure how, since the attribute in question is an aggregate.
SELECT Equipment.SerialNo , Name, COUNT(Assignment.SerialNo)
FROM Equipment
INNER JOIN Assignment
ON Assignment.SerialNo = Equipment.SerialNo
GROUP BY Equipment.SerialNo, Name
I'm using pdo to do this :
update tags set cnt=cnt-1 where name in ?
delete from news_tag where news_id=? and tag_id in (select id from tags where name in ?)
But if I can get affected rows' id,the subquery is not needed.
I written code like <
phone:WebBrowser x:Name="wbLogin" LoadCompleted="wbLogin_LoadCompleted" IsScriptEnabled="True" Margin="0,0,0,34"/
I want to change this webbrowser forecolor / page color to be displayed in different color (Cyan in case). So I taken code like,<
phone:WebBrowser x:Name="wbLogin" LoadCompleted="wbLogin_LoadCompleted" IsScriptEnabled="True" Margin="0,0,0,34" Foreground="Cyan"/.
But its not working.
Please help.
Thanx in advance to all.
am doing one project using vb6.0+access+crystal report8.5
some error occur during the crystal report.
Query Name
seqquery:
SELECT segment_trans.division_name, sum(segment_trans.Total_value) AS total, division_master.Target
FROM segment_trans, division_master
GROUP BY segment_trans.division_name, division_master.Target;
crystal report percentage formula:
{(seqquery.total * 100) / seqquery.Target }
Error: This field name is not known.
note: Total_value and Target field's datatype "Text"
how to solve this ?
please help me.
Thanks
Sathik
I need some help defining the following object hierarchy/ database relationship in Hibernate
From the object sense – Agent is inherited from Person and Agency is inherited from Organization. they are inherited from Party which can have multiple Addresses associated with it
The database consists of
Agent
- ID
- Name
-PartyID (references Party.ID)
Agency
-ID
-Name
-PartyID (references Party.ID)
Address
-AddrID
-PartyID (references Party.ID)
-Street
Party.
-PartyID
I have a site . I want to follow user from my site without going twitter site.
Example-if i want to follow sushant_1112 than i just type my name password and user name.
I folloow that person without going twitter site. from my website.
Please help me.
Hi,
I am writing the SPQuery for getting the data in contact list of sharepoint site.but how to write that?
Means I want to retrieve data as :
Name:aaa
Cell No: 13123131
Address : something address here..
so on...
of given LAst Name in search text box (build by me).
how to do that? Means what query i have to write? (Syntax please).
I am trying to select the most common 100 names from a table then display the list showing the names and count. I want the user to be able to re-sort the list alphabetically rather than based on count.
I thought the following code would do it. It works for the default sort by count but fails on the sort alphabetically. The line "$count = mysql_num_rows($table);" gives an error: mysql_num_rows() expects parameter 1 to be resource, boolean given. Any help would be greatly appreciated.
// Get most popular surnames
echo '<h2>Most Common Surnames</h2>';
if ($sort == "") { // default sort by count
echo '<a href="http://mysite/names.php?id='.$id.'&sort=name">Sort by name</a><br>';
$query = "SELECT family_name, COUNT(*) as count FROM namefile
WHERE record_key = $id
GROUP BY family_name
ORDER BY count DESC LIMIT 100";
}
else { // sort alphabetically
echo '<a href="http://mysite/names.php?id='.$id.'">Sort by count</a><br>';
$query = "SELECT * FROM (
SELECT family_name, COUNT(*) as count FROM namefile
WHERE record_key = $id
GROUP BY family_name
ORDER BY count DESC LIMIT 100)
AS alpha ORDER BY family_name";
}
$table = mysql_query($query);
$count = mysql_num_rows($table);
$tot = 0;
$i = 0;
echo '<table><tr>';
while ($tot < $count2) {
$rec2 = mysql_fetch_array($table2);
echo '<td>'.$rec2[0].'</td><td>'.$rec2[1].'</td><td width="40"> </td><td>';
if ($i++ == 6) {
echo '</tr><tr>';
$i = 0;
}
$tot++;
}
echo '</tr></table><br>';
UPDATE: I needed to add "AS alpha" to give the outer select a unique name. (alpha is just a random name I made up.) It now works perfectly. Code updated for the benefit of any others who need something similar.
I would like to save a file downloaded from the internet in iPhone.
Can I use the url as the file name? If not, what transformation should I apply to the url to obtain a valid file name?
I need to find the local copy of the file later using its url.
Hi there,
I need to make a program that writes some data to an excel spreadsheet. Something basic along the lines of First name, last name, phone number, e-mail per row with each category in its own column.
I don't even know where to start. If someone could tell me which assemblies to reference and maybe point me to a website or a book that covers writing/reading data from an excel spreadsheet via a c# program that would be great.
Many thanks.
The first one below works, but, just wanted to see if there's a better way...
If I'm trying to find all records that start with 'C' with either a flag of 2 or a status of 9, do I need to incorporate the 'C' criteria twice?
i.e.,
"SELECT * FROM mytable WHERE name like 'C%' AND flag = 2 OR name like 'C%' AND status = 9"
Or, is there a way quicker way to write it so that I only need to set 'C%' once?
I have this simple form:
<form method="post" action".">
<input type="text" name="title">
<input type="submit" name"send">
</form>
I want that when a user click on submit, then will be open another window of browser with the results. Is it possible ?