|
Hello
I'm a student and currently working as an intern on my own to build a small software using WPF. Just a bit of context: The program needs to receive user inputs to schedule upcoming task. I wanted people opinion on how to store those tasks in WPF (likely externaly) in a way that makes it easy to modify / delete said tasks.
Obviously I'm thinking a plain text file with separator(unless someone has a better idea), but how exactly would I proceed? The twist is that the tasks can be called several times each week, but always at the same hour.
So when a user enter a task to repeat itself monday and friday every week, should I create two entries on my file (Monday and Friday) or only one that could look like "Task04;Mo,Fr;..."?
First time posting btw, I'd like to thank the community for all the ressources at our disposal that really helped me
|
|
|
|
|
I would recommending using a database and SQL; something like SQLite would be nice, clean and simple. That way you don't have to worry about how you keep your data consistent, there's provisions in the database for that.
Working with text-files is complicated for larger datasets. Having the data in a well-known format would allow you to look at/manipulate the data with an existing tool (which in turn is usefull if you are hunting down a bug)
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks for your answer.
I already considered it, but wouldn't that require a local SQL server? And if so, is it possible to include it in the installation already configured? Because if that's the case that would avoid many compromises in my design ^^.
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
EDIT: It seems SQLite doesn't require a server (unless I'm wrong) so I'll go with that! Thank you for your help
modified 3-Jul-15 9:31am.
|
|
|
|
|
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
|
|
|
|
|
|