Its said that property should not be "Set" only and it should be "Get" as well. What should i do if I need to set value to a variable from some other class?
The will keep changing so I cannot pass it through constructor.
Shall I create a function for this as shown below?
class A
{
public void SetValue()
{
b = new B();
b.SetTest(10);
}
}
class B
{
int test;
public void SetTest(int value)
{
test = value;
}
}
What are the other alternatives?
Team,
Can you please help me to understand why I m getting the following exception.
05-07 10:57:20.652: ERROR/AndroidRuntime(470): android.database.sqlite.SQLiteException: near "1": syntax error: , while compiling: SELECT Id,Name FROM act WHERE Id 1-IJUS-1
Thanks in advance,
Hey guys.
Circles are one of the basics geometric entities. Yet there is no primitives defined in openGl for this like lines or polygons. Why so? Its a little annoying to include custom headers for this all the time!
Any specific reason to omit it?
Hi,
I am creating a setup project using Visual Studio. I want to reboot the system after the installation completed successfully.
I want it one time effort. I do not want to modify the setup each time using any external tool/ utility before delivering it to client.
Can I tweak the setup project itself?
How Can I do that?
I tried to send a russian text from my web application, but when this russian text is sent to the mobile, the russian text is displayed as ?????????.
Does anyone have a solution for this?
I have 3 options to increment value of an integer by 1 in a C# application
i++
i+=1
i=i+1
The result of all three operations would be same but I would like to know which one would be the best to use if I need to use this statement in an application where the performance is critical.
In my model example Game, has a status column. But I usually set status by using symbols. Example self.status = :active
MATCH_STATUS = {
:betting_on => "Betting is on",
:home_team_won => "Home team has won",
:visiting_team_won => "Visiting team has one",
:game_tie => "Game is tied"
}.freeze
def viewable_status
MATCH_STATUS[self.status]
end
I use the above Map to switch between viewable status and viceversa.
However when the data gets saved to db, ActiveRecord appends "--- " to each status. So when I retrieve back the status is screwed.
What should be the correct approach?
I have a function:
func (struct passwd* pw)
{
struct passwd* temp;
struct passwd* save;
temp = getpwnam("someuser");
/* since getpwnam returns a pointer to a static
* data buffer, I am copying the returned struct
* to a local struct.
*/
if(temp) {
save = malloc(sizeof *save);
if (save) {
memcpy(save, temp, sizeof(struct passwd));
/* Here, I have to update passed pw* with this save struct. */
*pw = *save; /* (~ memcpy) */
}
}
}
The function which calls func(pw) is able to get the updated information.
But is it fine to use it as above.
The statement *pw = *save is not a deep copy.
I do not want to copy each and every member of structure one by one like
pw-pw_shell = strdup(save-pw_shell) etc.
Is there any better way to do it?
Thanks.
Hi,
I want to study new .NET 3.5 concepts like WPF, WCF for work as well as for interviews. I am aware of .NET 2 but do not have any detailed knowledge of .NET 3.5 and newly added features in .NET 3.5 and C#.
is there any good book/ online resource which would help me?
hi,
Can I use IsInRole with customized objects??
Like I want to do some operations only for Employee while other only for Managers.
How can I achieve this?
Hi I have post some value using HttpPost and convert response into string using
HttpEntity entity = response.getEntity();
String rrr=EntityUtils.toString(entity);
rrr contain some xml tags
<root>
<mytag>its my tag</mytag>
</root>
Now I have to extract string "its my tag"
I have try to do it with SAX Parser but it give out put null.
Plz, help me in solving this problem.
Hi,
I am using Factory pattern to create .NET objects of a class. I also need to make sure that all such objects should be disposed before application terminates.
Where and How can I dispose the objects created by factory pattern? Shall I dispose in the class in which I am getting the objects created by factory?
Hi,
I have created a user control ( custom data grid view control). I have used the code specified at MSDN [site][1]
[1]: http://support.microsoft.com/kb/316574 to set the border style .
I am able to see the selected border style in designer. Like None, FixedSingle or Fixed3D.
But when I set the border style to FixedSingle, the border does not appear at runtime. Do I need to draw it manually in the OnPaint method?
I have two VPS servers but they have drastically different amounts of memory usage and processes running. I'm still new to running linux servers so I'm having trouble figuring out what is going on and what I can do to fix it.
Both are Debian 5 32bit installs.
On one server with 128MB of ram and a single CPU core I have a full server running in only 84MB of RAM. The other server has 512MB (quad core CPU) and it has nothing running but core processes yet its still using 94MB of RAM.
Does one have a different kind of virtualization technology that requires more linux core processes or what?
I like to buy a new computer for my studies and as well as gaming.
My old pc has 1.5 GB RAM with 512MB Graphics card. And it is very old to run Adobe CS5 version and other high end animation software.
My budget will be INR 20k-25k. I have 500GB hard disk, keyboard and mouse new. So apart from this, I like to buy :
Intel or AMD is good ?
My idea is :
Corei5 or Corei7 = which is best and economy ?
Which mother board.
4 GB RAM with upto 8 GB RAM slot for future upgrade.
1 GB or 2 GB Graphic card - which one ?
If I am wrong - please suggest me
Heyguys.. This isn't exactly a programming question exactly. I just want to know what your approach would be to a common problem in Digital image processing.
Lets say you have an image of a a few trees in say jpg format. How would you go about finding the heights of each of these trees. The photo is the only input you have.
I want to know the approaches you have not code. So it doesnt matter if your answers are vague, or non DIP-ish.
Which one out of the following two should be preferred while doing && operation on two values.
if (!StartTime.Equals(DateTime.MinValue) &&
!CreationTime.Equals(DateTime.MinValue))
Or
if (!(StartTime.Equals(DateTime.MinValue) && CreationTime.Equals(DateTime.MinValue))
What is the difference between the two?
Well here's a rather stupid question. Is Visual C++ JUST an IDE?? Or is it a language on its own for win32? What exactly would be the difference between the two? This I ask because I was trying out some of my old C++ code on VC++ 2008 and it wouldn't compile.
Hi,
I have a folder named as 2010.
In this I want a folder for each month like "Jan10", "Feb10"....."Dec10"
In each month folder I want to create folder for "Todays date"
I have create a shortcut for that 2010 folder with Target as
C:\WINDOWS\explorer.exe /n, /e, /select, F:\2010
I want a functionality that will execute when I click the shortcut for f:\2010 icon.
Any pointer would be great help.
Its said that property should not be "Set" only and it should be "Get" as well. What should i do if I need to set value to a variable from some other class?
The will keep changing so I cannot pass it through constructor.
Shall I create a function for this as shown below?
class A
{
public void SetValue()
{
b = new B();
b.SetTest(10);
}
}
class B
{
int test;
public void SetTest(int value)
{
test = value;
}
}
What are the other alternatives?