Ketsuekiame 860 Master Poster Featured Poster

I can't reproduce your first (screenshot) issue, but I agree with the second one. Does the same for me too. The URI Id is different by 1 between each post.

Ketsuekiame 860 Master Poster Featured Poster

Depends what you mean by interactive!

Technically an accounting program is interactive, but often that's not what people mean :)

But a simple yet fun project...How about creating a multiplayer (keyboard sharing) game of Battleship?

The rules are simple, it's sufficiently easy to design and implement, yet complex enough to stretch some of your initial skill set. I also presents room for modification later as your skills improve (such as networked multiplayer or increased number of players etc)

Ketsuekiame 860 Master Poster Featured Poster

An error like that could mean something blew up in the Window constructor for your WPF Form. (Could be a method or child method or child constructor, there's a lot of possibilities)

I would do a debug step through so you can see exactly where in your code it leaves for the framework and then collapses. That's probably the best place to start.

Ketsuekiame 860 Master Poster Featured Poster

You can use WPF with the inbuilt designer to put the controls on there. LINQ to SQL you can use by defining your entities in C# and then creating a DataContext to your database. You would then query it using LINQ.

I suggest you read Here

Ketsuekiame 860 Master Poster Featured Poster

In PHP;

$currentDate = getdate();
echo $currentDate[year];

In ASP.NET

ViewBag.CurrentYear = DateTime.Now.Year;
Ketsuekiame 860 Master Poster Featured Poster

Personally I would go with;

© {First Registration}-{Current Year} DaniWeb® LLC

So;

© 2013-2014 DaniWeb® LLC

Like I say, in the UK you register yourself with an agency which maintains your copyright. I don't know 100% how it works in the US and so I may be wrong ^.^

Ketsuekiame 860 Master Poster Featured Poster

The site won't let me edit so I'm double posting...

I've just read up in the US copyright and it seems less strict that the process in the UK/EU. It seems that the simple method already being used by Dani should be sufficient. :)

Ketsuekiame 860 Master Poster Featured Poster

You should probably copyright from the first registered date to the current date, especially as Dani has made changes to both the UI and the API this year.

I'm not sure how it works in the US but in the UK and EU typically you would include the start and end date of something as dynamic as a web system, to ensure that you protect your future iterations. Your registration would cover a number of years (typically 5) before you needed to re-register your copyrighted works.

Ketsuekiame 860 Master Poster Featured Poster

Lists aren't pre-defined. You have to add and remove from them (unless you give themn an initial size).

So if you do;

List<int> myList = new List<int>();
myList[3] = 12;

This will fail. Having an empty list is a bit like having an array of 0 length.

To actually have index 3 set to 12, you would need to do

// this inserts three entries into the list
List<int> myList = new List<int>() {0, 0, 0, 12};

When you initialise an array to a particular size, you're actually pre-filling it with the default for that object.

Doing;

int[] myInts = new int[4]();

Could be considered equivalent to;

// The 4 in the constructor tells C# my initial list size will be 4 objects. It isn't necessary.
List<int> myInts = new List<int>(4) { default(int), default(int), default(int), default(int) };

To answer your original question; a List<List<T>> will do what you want. But remember that you can't set arbitrary locations. If you want to do that, you may need ArrayList or to redefine your arrays and copy the data across.

A better design, in my opinion. Would be to use proper objects.

public class MyDataColumn
{
    public int Index
    {get;set;}

    public string ShortName
    {get;set;}

    pubic Type DataType
    {get;set;}
}

...

public class MyDataItem
{
    public int RowNumber
    {get;set;}

    public MyDataColumn AssociatedColumn
    {get;set;}

    public object Data
    {get;set;}
}

...

List<MyDataItem> dataItems;

etc.

It's harder to set up the databinding and there's a bit more …

ddanbe commented: Great knowledge! +15
Ketsuekiame 860 Master Poster Featured Poster

Because people don't want to pay for anything.

You go on a mobile store, want to find a game. Oh this costs 20p??? I'm not paying for it! People will download a game for free, get drawn in and then need to spend money on it. This is the driving motivation. "I'm not paying for a game" yet "I need to pay to complete this level. PLX TAKE ALL MY MONEY!"

I find it incredibly annoying. But, the common user has driven the market this way...

Ketsuekiame 860 Master Poster Featured Poster

Well first, you can't declare a List<List<string>> as a List<List<double>> as the types aren't implicitly compatible :)

List initialisation by constructor is different to arrays. You have to remember that when declaring a List you're using a generic type; List<T>()

In this case your T is List<string> a declared type (not an instance). So you're simply saying "This list will contain lists of strings"

As you're using Lists, there's no real need to declare an initial size unless you want to reserve a large amount of memory. Additionally, you will need to declare the size of each subsequent List<string> you instantiate. (As currently the container list is empty)

Now when you say your data table will shring/grow, do you mean by row or by column? A list of lists might not be what you need.

ie

[0]{
    [0]{ "Hello" }
    [1]{ "Goodbye" }
    ...
    }
[1]{
    [0]{ "Are" }
    [1]{ "You" }
    [2]{ "Well" }
    ...
    }
Ketsuekiame 860 Master Poster Featured Poster

3a4cfdad26601b03d45a25637a401a3a

  1. Click on the attached image.
  2. Press the keyboard key combination CONTROL P at the same time.
  3. Click OK.
  4. ????
  5. Profit (and/or admire your square).
Ketsuekiame 860 Master Poster Featured Poster

If you don't add it to source control it will still exist on disk. Part of the build process, though, will be to copy your localdb to the correct location.

If you add your local db as a file in your project, then set it as "Copy to Output path" it should copy it to your Debug/Release folder when you build.

If you're using VS Online, do you have Azure? Set up a small SQL Web server and use that during development. Once you've finished development, you can copy the schma, seed your localdb and deploy as normal.

Ketsuekiame 860 Master Poster Featured Poster

Glad you found it :)

Ketsuekiame 860 Master Poster Featured Poster

Hi tinstaafl. That's not a requirement for his assignment, but might score him extra marks :)

Given that he OP is struggling with the basics, might be wiser to get the core going before defining the extra rules.

If you're interested, here is the Translation of the assignment I was going by:

It starts with to lay to all players who will be involved by entering their name

If you write the name Computer will he become a player whose throw randomly instead of writing them

Players roll sequentially. When it's a player's turn to throw the star his name on the screen

The player throws three darts that can give 0-60 points per arrow (180p per round) each caste are laid manually enter the computer except if the computer plays

Since then it's the next player's turn.

The player whose total sum on any roll is over 501 points first wins. (We do not care about that you have to go still out)

When one player has to be handy name appears on the screen after which all his darts printed for the way he threw. Varke series of three darts to appear so we can understand how each omgang was thrown.

The other father does not play clearly. But when you press ENTER, the program quits

Not brilliant, but it's enough to work out the general gist of it :)

Ketsuekiame 860 Master Poster Featured Poster

Hello,

I got a message this morning from a mod that had deleted a duplicate post. Which is all fair enough....Except I never saw the duplicate post in question. When I went to check the thread this morning, sure enough my original post was still there so sat bemused that I'd managed to double post without actually realising.

When I got back to the parent screen (C#) I noticed that the thread said it had 0 replies. Thinking it was a caching issue, I refreshed. Still 0. Went into the thread and my post was still there. Refreshed again. Post still there.

I have now cleared my browser cache and the post and 0 reply count still remains. Do you want to take a look at it?

The thread in question: http://www.daniweb.com/software-development/csharp/threads/472065/multicast-using-tcp-port-in-c-sharp

Ketsuekiame 860 Master Poster Featured Poster
  1. Instantiate a Player object per player.
  2. On each player's turn. Use a random number generator between 0 -> 60 (there's an example of an RNG call in the picture)
  3. Save each indidual score as an arrow in the Arrows class (You have three; arrowOne, arrowTwo, arrowThree)
  4. Save the "Arrows" object into the list of arrows for that player.

The rest is easy :)

Ketsuekiame 860 Master Poster Featured Poster

IIS tends to ignore those settings. Why? Who knows... However, it will pull them from the AppConfig if you set them.

<add key="loginUrl" value="~/login/" />
<add key="defaultUrl" value="~/unauthorized/" />

If you add those into your config, it should work.

Ketsuekiame 860 Master Poster Featured Poster

Do you really mean multicast? Multicast is to send a single packet to multiple destinations in a single transmit.

If this is really what you want, try something like NORM

Ketsuekiame 860 Master Poster Featured Poster

UserControls don't contain a definition for CloseModalPanel, this method is contained within the MetroAppForm class.

Also, for anyone wondering, this is DotNetPanel for WindowsForms by DevComponents. This isn't built into Visual Studio.

Ketsuekiame 860 Master Poster Featured Poster

select * from YOURTABLE where YOURDATECOLUMN like '%/07/____'

I'd suggest including the year too though...

Ketsuekiame 860 Master Poster Featured Poster

Use the MessageDialog object.

Ketsuekiame 860 Master Poster Featured Poster

While you're in the code, any chance you could spell Organisation the right way? ;)

Ketsuekiame 860 Master Poster Featured Poster

It depends how you use the data. If you want to do index and searching, the database is going to be far better at it. This comes at the expense that your data is (marginally) harder to read and edit.

If your objects are going to be loaded and cached, XML is going to be better as it's easier to read and edit. This comes at the expense of poorer performance as you will need to parse the XML. Also, if you're going to cache it all, I hope the target system has enough RAM :)

Personally, I wouldn't use XML for anything other than basic configuration and data serialisation for transmission (on small objects of a couple of Mb max, otherwise custom Binary serialisation)

Ketsuekiame 860 Master Poster Featured Poster

Put some effort in of your own first. The problem itself is very simple. You can work this out with some basic logic.

Ketsuekiame 860 Master Poster Featured Poster

You actually used a delegate in your second code section:

bw.DoWork += new DoWorkEventHandler(
---> delegate(object o, DoWorkEventArgs args) <----
{

Delegates are (at a basic level) method pointers. They allow you to pass methods around as arguments.

To use delegates properly, you should define them first. So to define the delegate above:

public delegate void BackgroundWorkerDelegate(object o, DoWorkEventArgs args);

Now in your class definitions if you declare a method with the same parameters, you can refer to it using your delegate definition (just like an object)

public void CalculatePathsBackground(object stateObject, DoWorkEventArgs eventArgs)
{
    /* I've renamed the variables to highlight that they onkly have to be the same types, not the same names */
    // Do work here
}

So now in your main class you could:

public void DoingStuff()
{
    BackgroundWorkerDelegate getPathsWorker = this.CalculatePathsBackground;

    BackgroundWorker bw = new BackgroundWorker();
    bw.DoWork += new DoWorkEventHandler(getPathsWorker);

    bw.RunWorkerAsync();
}

That's pretty much a crash course in delegates. There are better ways to design this and there are several considerations you should take into account. Personally, if you can use .NET 4/4.5 I'd start using the Task library.

If you want to learn a bit more about async, see my post here I've written a small tutorial and example.

Also, whilst you might say you're not a developer, you've done pretty well so far. The fact that you've got this far makes you a developer. :P

Ketsuekiame 860 Master Poster Featured Poster

The error you have means that the XAML is missing a closing tag somewhere.

Unfortunately, I couldn't compile your application because it couldn't find any of your resources.

Your delegate command seems ok.

Ketsuekiame 860 Master Poster Featured Poster

Essentially yes, break down your code into tasks that you can run in a method. You can give the background worker a method to execute (that's all a delegate is) and run it that way.

Be careful about altering UI components. That has to be done on the Main thread and you can easily lock your UI up that way.

A better suggestion might be to look at the Task namespace and the async keyword.

I'd also look at your design and split code into Data Load/Data Process/Date Presentation rather than having a single method do all the work.

ddanbe commented: Excellent advise +15
Ketsuekiame 860 Master Poster Featured Poster

Dani's JSON makes more sense in my opinion. Not everyone who is qualified has a degree. However, based on that, it's the UI that's incorrect ;)

Ketsuekiame 860 Master Poster Featured Poster

The XAML seems valid and my IDE is happy enough with it. It may be one of your supporting resource libraries that's invalid.

Where are you storing your style resources?

Ketsuekiame 860 Master Poster Featured Poster

Can you post the entire XAML? I think you're missing a </resources> tag somewhere.

Ketsuekiame 860 Master Poster Featured Poster

As a DW user I'll discount my usual contracting rate to £400/day. If this is acceptable for you then we can talk on the Business Exchange forum :)

Thanks.

Ketsuekiame 860 Master Poster Featured Poster

Did you try cleaning the solution and doing a full rebuild? This might be an issue with cached build objects.

Ketsuekiame 860 Master Poster Featured Poster

Yes and yes. Although you'll need two different front ends. One in ASP.NET (website) and one in Winforms (Desktop) but the back end for both should be C#

Ketsuekiame 860 Master Poster Featured Poster

As a note, you should also wrap the command in a using statement too ;)

Mike Askew commented: Not my code :D +7
Ketsuekiame 860 Master Poster Featured Poster

At the moment C# is probably the easiest language to write in for both desktop and web applications simultaneously.

Ketsuekiame 860 Master Poster Featured Poster

Well it's exactly what it says. You're trying to open a connection that's already open. Remove line 48 and you'll be fine.

Ketsuekiame 860 Master Poster Featured Poster

If EnumerateDirectories ends after trying to access a directory it cannot then you're going to need to create your own search function.

EnumerateDirectories will give you all the directory names for the folder it is currently searching. With the AllDirectories flag it will search all sub directories as well. Your exception will be raised when it tries to enter a sub-directory it doesn't have permission to do so, in this case, you're going to have to re-implement this behaviour yourself.

Retrieve a list of the directories at the current level, then one by one enter the sub-directories. When you hit one you can't enter, just skip it and move to the next.

Ketsuekiame 860 Master Poster Featured Poster

Ketsuekiame:
It seems that you dont understand what the thread starter is asking.

What he wants is when selectedvalue does not exist in the list of items he want the selectedindex = 0 or selectedvalue is "-- Select --".

So the best way to do that is:

Before fetching a data from the database do this:

ComboBox1.Items.Add("-- Select --");
Fetch the data from the database.
No data from database then, ComboBox1.SelectedIndex = 0;
Simple,am I right?

I understood perfectly what he said; unfortunately your solution isn't viable as the OP is using databinding. You cannot modify the list after it is bound. So, the only way would be to insert it into the data items before the control gets bound.

The other problem with your method is that you're treating a valid selection as in in-valid one. An index of 0 is a perfectly valid selection. If you're trying to deselect an item, you must set the SelectedIndex to -1.

From the MSDN:

To deselect the currently selected item, set the SelectedIndex to -1.

This unsets the selected item and invalidates the control. The fact that the control is no longer valid is important is ASP.NET validation.

Unfortunately, my way doesn't work either. As the list is databound, you cannot set the Text property of the ComboBox. It is unset (reset) and made read-only.

The only way to get what the OP wants, is to dirty the actual data, or simply pre-process …

Mike Askew commented: This +7
Ketsuekiame 860 Master Poster Featured Poster

No it is a bug. This Hotfix should work

Unfortunately, it means that you need to include this hotfix with your application redist.

Edit: Reading the bug report there is a workaround - Add the style as a dynamic resource reference or add it as a static resource to the xaml resource dictionary.

ddanbe commented: Whish I had this WPF knowledge +15
Ketsuekiame 860 Master Poster Featured Poster

If you interfaced it out, you could easily check the permissions of screens below the parent. Alternatively you could go action based and link your roles to actions rather than screens. This would probably require more maintenance but give you more flexibility.

Ketsuekiame 860 Master Poster Featured Poster

In that case no, your only real option is to match the Ids of your screens to the roles required, in your DB.

Ketsuekiame 860 Master Poster Featured Poster

Are you thinking about storing the screen class name mapped against one or more roles?

Or use attributes. But the attributes would have to match your DB permissoin names and any changes would have to be retrospective too...

Ketsuekiame 860 Master Poster Featured Poster

A general, generic system would have you define a table to store your groups, a table to store what permissions that group has and a table to assign users to groups.
I would then translate that into C# and assign roles to your screens.
The other option is to be more database driven and record the permissions for each screen as a table. Personally, if you're doing simple CRUD permissions I would use interfaces and mark your screens.

ie. MyScreen : IRequiresWrite, IRequiresRead

Otherwise if you need to make it more complicated;

MyScreen : IRequiresPermissions

And then load the permissions required from the DB

You would need to write your own middleware for the permissions authentication. I'm not sure of anything out of the box.

Ketsuekiame 860 Master Poster Featured Poster

Firstly, although MyClass inherits IComparable the compiler doesn't know that it can be converted (sometimes the compiler is dumb). If you change your original definition from MyClass[] mine = new MyClass[5] to IComparible[] mine = new MyClass[5] that will be fine.

Finally, you can only pass an assignable value with the explicit ref keyword. new MyClass(8) isn't assignable, you would need to put this into a variable first and then pass it through.

Strictly speaking, however, you can drop the ref keyword. Your object is being passed by reference anyway.

For Completeness:

When you pass an array into a method, you're passing the pointer to it by value. What this means is that any changes to the contents of the array will be reflected in the original object, however, re-assigning the array will not. That's why you needed the ref keyword. You don't need the ref keyword on the second parameter as it is already passed by reference.

Ketsuekiame 860 Master Poster Featured Poster

Death doesn't have a point. Things just wear out.

Evolution doesn't have a point. Evolution is just a process that occurs (mostly) as a result of random mutations.

Life doesn't have a point. It just is.
You might as well ask what is the point of gravity or what is the point of time. However, Bill Cosby has been able to answer the question "why is there air" (to blow up basketballs).

What is the meaning of life? It's whatever you decide for yourself.

An interesting counter-argument looking from the opposite end of the spectrum. One that, given your argument, I can agree with actually.

No. The fact that you are conscious means that it did happen, not that it had to. Does the existence of the play, Hamlet, mean that it was impossible for it not to have existed?

This is the problem I have with infinites. If you consider infinites; before the play existed the probability of it coming into existence is both definitely certain and definitely impossible. But only if you allow infinite time. Like the often touted "monkeys and the typewriters" argument, given an infinite amount of time, eventually they will come out with the entire works of shakespear.

Whatever it is that makes up your conscious thought, if it is actually anything at all (meta-physically speaking, not insulting ;P ) would by this argument be both guaranteed to exist and not exist at the same time. All that happened was …

Ketsuekiame 860 Master Poster Featured Poster

Here's something for you deceptikon. Relating to evolution, life and consciousness.

What is the purpose of death? Is it an evolutionary trait? If so, why? What is the point of evolution (which is supposed to keep the species alive), the struggle of life, if it ends with death?
Life tries to live. It tries to stay alive. Breeding helps keep the species alive, but for what purpose? Why does life try to beget life when all it does is die? Seems pretty pointless if you ask me... (Not trying to be depressive here)

So, what if life as a whole is simply trying to exist? What if individuality as we understand it is simply wrong and all these processes of evolution and the struggle to procreate are simply to keep "life" in existence, regardless of what it is that's alive.
The problem I have is that I fail to understand what the goal of this cycle is. To merely keep going? If so, keep what going? I guess this is the question "What is the meaning of life?"

On another level, things get really freaky when you consider looking at whether or not it was possible to have not existed.
My reasoning here is that the fact that you are conscious was impossible to have not happened. Unfortunately it means dealing with infinites, so mathematics won't help. However, if we consider logic, given that when unconcious there is no perception of time. If nothing is concious, abstractly, …

Reverend Jim commented: Interesting discussion. +0
Ketsuekiame 860 Master Poster Featured Poster

I would question the fact your design requires you to call two different methods with, or without, a parameter.

Essentially in this case, you could keep your second definition and just handle the case for when obj == null

If you need to call two different methods (with different names) then that's simply a separate command. If you need to put two commands onto a single use case, then you need to go back to your design and see what's going on. If I ended up in that scenario, I would assume my design to be incorrect.

If you really want to go in your direction, then use a pattern whereby the delegate is merely a proxy to the method you really want to call.

(object obj) =>
{
    if(obj == null)
    {
        MakeCall();
        return null;
    }

    return MakeCall(obj);
}

Or you could try generic delegates (slightly clearner imo):

public delegate T CommandDelegate<T>(T inParam);

However, I'm going to question the design on this one. I really don't think something like this should be necessary.

I realise I'm criticising you, but I don't mean it in a nasty way.

Ketsuekiame 860 Master Poster Featured Poster

Set your combobox Text property to the default value you want to display.

If the selected index doesn't exist in the DB, set your SelectedIndex on the combo box to -1. This will revert it to your default text.

Ketsuekiame 860 Master Poster Featured Poster

Speaking of quantum theory, there is a conciousness hypothesis that consciousness is the result of a collapsing quantum waveform. shrugs not sure I could prescribe to this... <--- Edit: I can't even find the article anymore, my Google fu is weak today. It was published as a scientific paper for peer review though. It probably got blasted down :)

Another is that it's simply the result of efficient simultaneous processing of information in the brain. When you start to muddy the signals, "consciousness" collapses. Here is an article about the study: http://newsroom.ucla.edu/portal/ucla/ucla-psychologists-report-new-248299.aspx

My personal belief is that consciousness is simply an illusion of higher intelligence. We have the ability to make decisions and override instinct. We are self-aware so far as, whatever I am has the ability to recognise itself and its place within its perceptive ability of time and space. this gives rise to the belief that we somehow control everything from a point of self-existance and ego.
Going into details, I think that we're no more than finite state-machines. Our personalities are built from a ground framework of genetics. Our experiences help shape how we behave. The way we make decisions is based on this process. As such, once you "know" a person, it's fairly easy to predict behaviour (otherwise we wouldn't have profilers for criminal cases)

We receive input and in most cases perform output. We are machines. Very complex ones, but nonetheless, machines.

Of course, this is my belief. I'm not saying it …