In java, when you pass an object to a method as a parameter, it is actually passing a reference, or a pointer, to that object because objects in Java are references.
Inside the function, it has a pointer to that object which is a location in memory. I am wondering where this pointer lives in memory? Is a new memory location created once inside the function to hold this reference?
I have the following rewrite rule
rewrite ^/ab(.*)/(.*)$ /repo/ab$1/rtest/$2 break;
When the request file is /abname/index.php it gets rewritten to /abname/rtest/index.php
But if the request is of the form /abname/dir1/index.php it gets rewritten as /abname/dir1/rtest/index.php but I would want it to be rewritten as /abname/rtest/dir1/index.php
How do I write the rule ?
Can an attacker attach a debugger to my app after installing it to the market, or does the app have to be marked as debuggable first? How secure is this? Are there ways to get around it?
I am using Eclipse IDE for C/C++ Developers, and i am using the gcc to compile at the moment. How can i change it to compile with a Green Hills compiler? Any help will be appreciated. Thanks!
hello, can somebody please explain the order of private and public is important or no?
for example:
class Account{
public:
Account(string firstName, string lastName, int id);
void printAccount();
private:
string strLastName;
string strFirstName;
};
will be the same as:
class Account{
private:
string strLastName;
string strFirstName;
public:
Account(string firstName, string lastName, int id);
void printAccount();
};
I have the following code, but i`m having error of
Error 6 foreach statement cannot operate on variables of type 'int' because 'int' does not contain a public definition for 'GetEnumerator' C:\Dev\DEV\Code\MvcUI\Models\MappingModel.cs 100 13 MvcUI
How can I solve this?
Note:
string [] projectID;
Class Employee
{
int id {get; set;}
string Name {get;set;}
}
public IEnumerable<SelectListItem> GetStudents()
{
List<SelectListItem> result = new List<SelectListItem>();
foreach (var id in Convert.ToInt32(projectID))
{
foreach( Employee emp in Project.Load(id))
result.Add(new SelectListItem
{
Selected = false,
Text = emp.ID.ToString(),
Value = emp.Name
});
return result.AsEnumerable();
}
}
If I have an oracle query like below:
SELECT * FROM table_a where A = "1", B = "2", C = "3"
for this query to pickup one of the indexes of table_a...does the index need to be on all 3 of these columns?
What I am asking is:
What if Index is on A, B, C, D?
What if Index is on B, C?
Will the index only be picked when
it is on A, B, C?
Hi,
is it possible to use date_sub like this ?
$dt = date("Y-m-d h:i:s");
$query = "INSERT INTO `table` (`date`) VALUES ('DATE_SUB('$dt', INTERVAL 15 DAY)')";
$result = MYSQL_QUERY($query);
Thanks
Which is a better way to select ans and quest from the table?
SELECT * FROM tablename WHERE option='ans' OR option='quest'";
OR
SELECT * FROM tablename WHERE option='ans' AND option='quest'";
Thanks so much!
I'm trying to install imageMagick but i've got practically zero server knowledge,
i don't get what this means:
You can easily install Imagemagick on
a cPanel by using cPanel script.
/scripts/installimagemagick will do it
for you.
what is this /scripts business, where do i type it? do i type it? what's this all about?!!!
http://geobaby.in/installing-imagemagick-on-a-cpanel-server/
I have a DB with user accounts information.
I've scheduled a CRON job which updates the DB with every new user data it fetches from their accounts.
I was thinking that this may cause a problem since all requests are coming from the same IP address and the server may block requests from that IP address.
Is this the case?
If so, how do I avoid being banned? should I be using a proxy?
Thanks
Ok SO, I have a user table and want to define groups of users together. The best solution I have for this is to create three database tables as follows:
UserTable
user_id
user_name
UserGroupLink
group_id
member_id
GroupInfo
group_id
group_name
This method keeps the member and group information separate. This is just my way of thinking. Is there a better way to do this? Also, what is a good naming convention for tables that link two other tables?
I have this function:
void ToUpper(char * S)
{
while (*S!=0)
{
*S=(*S >= 'a' && *S <= 'z')?(*S-'a'+'A'):*S;
S++;
}
}
What does it mean for *S != 0, should it be null instead?
Hello All,
I have a following ArrayList,
[Title,Data1,Data2,Data3]
[A,2,3,4]
[B,3,5,7]
And I would like to convert this one like this,
[Title,A,B]
[Data1,2,3]
[Data2,3,5]
[Data3,4,7]
I'm bit confused with the approach. Any hint would be much appreciated.
Thanks.
I have this class:
class A {
private:
int player;
public:
A(int initPlayer = 0);
A(const A&);
A& operator=(const A&);
~A();
void foo() const;
};
and I have function which contains this row:
A *pa1 = new A(a2);
can somebody please explain what exactly is going on, when I call A(a2) compiler calls copy constructor or constructor, thanks in advance
So I have 3 classes.
Abstract class A
Class B extends class A
independent Class C
In class D that contains the main method, I create a list of instances of class B
List<B> b = method-call();` // the method returns a list of instances of class B
Now in class C I have one method that is common to both A and B, and hence I don't want to duplicate it. I want to have one method that takes as input an instance of class A, as follows:
public void some-method(LIst<A> a)
However, when I do:
C c = new C().
c. some-method(b)
I get an error that some-method is not applicable for the argument List, instead it's expecting to get List.
Is there a good way to fix this problem?
Many thanks!
New to c++, and am having a problem with delete and destructor (I am sure i am making a stupid mistake here, but haven't been able to figure it out as of yet).
When i step through into the destructor, and attepmt to call delete on a pointer, the message shows up "Cannot access memory at address some address."
The relevant code is:
/*
* Removes the front item of the linked list and returns the value stored
* in that node.
*
* TODO - Throws an exception if the list is empty
*/
std::string LinkedList::RemoveFront()
{
LinkedListNode *n = pHead->GetNext(); // the node we are removing
std::string rtnData = n->GetData(); // the data to return
// un-hook the node from the linked list
pHead->SetNext(n->GetNext());
n->GetNext()->SetPrev(pHead);
// delete the node
delete n;
n=0;
size--;
return rtnData;
}
and
/*
* Destructor for a linked node.
*
* Deletes all the dynamically allocated memory, and sets those pointers to 0.
*/
LinkedListNode::~LinkedListNode()
{
delete pNext; // This is where the error pops up
delete pPrev;
pNext=0;
pPrev=0;
}
Its been a long time since i've done C++ and I'm running into some trouble with classes referencing eachother.
right now I have something like:
a.h
class a
{
public:
a();
bool skeletonfunc(b temp);
}
====================
b.h
class b
{
public:
b();
bool skeletonfunc(a temp);
}
since each one needs a reference to the other i've found I cant do a #include of eachother at the top or i end up in a weird loop of sorts with the includes.
So how can I make it so that a can use b and vice versa with out making a cyclical #include problem.
thanks!
in c or c++
function comlen is defined such
int comlen(char *p,char *q){
int i=0;
while *p && (*p++==*q++)
i++;
return i;
is this code equivalent of this function
int comlen(String s,String m){
int i=0;
while (i<s.length() && s.charAt(i)==m.charAt(i)){
i++;
}
return i;
?
please help
I had inherited this SQL Server where we put data in a table (Call TableA) on a database (DB-A). I can see the tableA in another database on the same server ( DB-B) gets the same data right away.
Any ideas how this is implemented? I am trying to see the trace but so far no luck. Any one has an idea?
At this stage I am not sure if its replication. This is a guess