|
Member 11718830 wrote: I already considered it, but wouldn't that require a local SQL server? No, SQLite doesn't; I'd recommend Sql Server if you have a team working on a set of data, or if it would be used for reporting a lot. Since you talked about a file, I assumed a local file-based database format would be more appropriate.
Member 11718830 wrote: And if so, is it possible to include it in the installation already configured? Yup. That goes for Sql Server as well as SQLite.
Member 11718830 wrote: Then again I guess it's fine if I have to install and configure it manually,
would still be better if I don't have to though Hehe, YOU will have to; but your users will not have to. You'd still need to explain to the setup procedure how to install the thing, and with wich options.
For SQLite that is rather simple - it's just two libraries extra to copy to the applications' directory.
Alternatively, you could look into XML; it would be a structured way to keep data in a text-based-file.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I'll look into it, thank you!
|
|
|
|
|
You're welcome
|
|
|
|
|
Window 8.1 Universal app- How we create a Grid app?
|
|
|
|
|
|
I am asking about Windows 8.1 universal app.
For universal app grid app project type is not available.
|
|
|
|
|
hi all!
can someone explain to me the difference between the two equations:
1)v = (u(M1-M2)+(2M2*u))/(M1+M2) (elastic collisions)
2)v= vA + j/MA*n (impulse method)
In physics, are they the same?
thanks!
|
|
|
|
|
Isawyouoo wrote: In physics, are they the same? Ask a physics grad. These forums are for programming issues.
|
|
|
|
|
Equations may look like code, but in practice they are very different.
You need to ask a physicist, not a developer.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Hi,
I have a string that may contains several hashtags starting with # like this example:
"Hello, I am #Hashtag1 and #Hashtag2"
I want to save those hashtags, as many as they are, in an array.
Can anyone help me how to do it.
Thank you in advance.
|
|
|
|
|
Use a regex to identify them:
\#\w*
You can then use the Regex.Matches to convert them to a collection with Linq methods:
string[] hashtags = Regex.Matches(myDate, @"\#\w*").Cast<Match>().Select(m => m.Value).ToArray();
[edit]Matches, not Match, Griff [/edit]
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
modified 2-Jul-15 15:20pm.
|
|
|
|
|
That should be Regex.Matches , not Regex.Match .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Clearly, I read what I meant to type...
Thanks!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
thank you so much, it worked perfectly
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I have written a 3 by 3 matrix program where I assume that the matrix represents the circle. It is able to tell the coordinates of the axes as well as the origin.
For example a 3 by 3 matrix, it will display these results which are what I want. The program will find the origin automatically by taking the 3 minus by 1 then divide by 2.
Index=[0,0](x,y)=(-38,38)
Index=[0,1](x,y)=(0,38)
Index=[0,2](x,y)=(38,38)
Index=[1,0](x,y)=(-38,0)
Index=[1,1](x,y)=(0,0)
Index=[1,2](x,y)=(38,0)
Index=[2,0](x,y)=(-38,-38)
Index=[2,1](x,y)=(0,-38)
Index=[2,2](x,y)=(-38,-38)
However, when I want to do a 4 by 4 matrix and so on, the result of the coordinates does not match with my calculation. Is there any formula for this?
1 unit=38
4 by 4 matrix would be
Index=[0,0] (x,y)=(-76,76)
Index=[0,1] (x,y)=(-38,76))
Index=[0,2] (x,y)=(0,76)
Index=[0,3](x,y)=(38,76)
Index=[1,0] (x,y)=(-76,38)
Index=[1,1] (x,y)=(-38,38)
Index=[1,2] (x,y)=(0,38)
Index=[1,3] (x,y)=(38,38)
Index=[2,0] (x,y)=(-76,0)
Index=[2,1] (x,y)=(-38,0)
Index=[2,2] (x,y)=(0,0)
Index=[2,3] (x,y)=(38,0)
Index=[3,0] (x,y)=(-76,-38)
Index=[3,1] (x,y)=(-38,-38)
Index=[3,2] (x,y)=(0,-38)
Index=[3,3] (x,y)=(38,38)
Tomorrow, I will post my code because my file is broken and I can only retrieve from my workplace. Please help me.
|
|
|
|
|
Explain your problem properly.
"I have written a 3 by 3 matrix program where I assume that the matrix represents the circle"
What circle? How does a Matrix represent a circle?
"It is able to tell the coordinates of the axes as well as the origin."
Who is able to tell the coordinate of what?
"The program will find the origin automatically by taking the 3 minus by 1 then divide by 2."
3 what? 1 what?
|
|
|
|
|
|
public class User{
public int UserID {get;set;}
public string Username {get;set;}
publict override bool Equals(object obj)
{
if(!(obj is User)) return false;
return (obj as User).UserID == UserID;
}
public override int GetHashCode()
{
return UserID;
}
public override ToString()
{
return Username;
}
}
base on the code above, when i create to object from the database, comparing them will return false even they are the same.
example:
User u1 = new User(){UserID = 1, Username = "FirstUser"};
User u2 = new User(){UserID = 1, Username = "FirstUser"};
var b = u1 == u2;
variable b is false;
I thought they will be the same,
is there i missing there?
I will appreciate for any advice will be given
Thank you.
|
|
|
|
|
You need to override the == and != operators.
public static bool operator ==(User lhs, User rhs)
{
if(lhs == null && rhs == null) return true;
if(lhs == null && rhs != null) return false;
if(lhs != null && rhs == null) return false;
return lhs.UserID == rhs.UserID;
}
public static bool operator !=(User lhs, User rhs)
{
return !(lhs == rhs);
}
Just insert these into the class and you will be able to use == and != to check for equality and inequality.
Note that if you override one, C# forces you to override the other.
There are several other operators you can override. You can get all the nitty gritty details on MSDN[^].
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
thank you for the quick reply.
I thought overriding equals will be enough,
By the way, one more question base on the code above, which is most efficient using the "Equals" method or the equals operator?
Thank you
|
|
|
|
|
|
As you're dealing with a class , not a struct , you can simplify the operator to:
public static bool operator ==(User lhs, User rhs)
{
return Equals(lhs, rhs);
}
public static bool operator !=(User lhs, User rhs)
{
return !Equals(lhs, rhs);
}
The static Equals method[^] will perform the null checks for you, and then call the instance Equals method on the first parameter:
public static bool Equals(Object objA, Object objB)
{
if (objA==objB) {
return true;
}
if (objA==null || objB==null) {
return false;
}
return objA.Equals(objB);
}
At first glance, it might look like the first line of that method would cause a stack overflow, since your == operator is calling a method that calls the == operator. However, within the Equals method, it's calling the == operator on the Object type, which just tests for reference equality.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you, for all the hint, i finally got it now
|
|
|
|
|
You might also want to check for null being passed in to the Equals method.
i.e. insert the following line into the beginning of the method:
if(other == null) return false;
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|