DaveAmour 160 Mmmmmm beer Featured Poster

I see. I don't have any such buttons.

Mine looks like this...

CashOut.png

DaveAmour 160 Mmmmmm beer Featured Poster

Ok cool, glad to help.

DaveAmour 160 Mmmmmm beer Featured Poster

Hi Suzie

Does this help?

using System;

namespace DaniWebDates
{
    class Program
    {
        static void Main(string[] args)
        {
            string d1 = "2015-04-04 00:06";

            Console.WriteLine(ConvertDate(d1));

            Console.ReadKey();

        }

        static DateTime ConvertDate(string s)
        {
            return Convert.ToInt32(s.Substring(11, 2)) < 5 ? DateTime.Parse(s).AddDays(-1) : DateTime.Parse(s);
        }
    }
}
DaveAmour 160 Mmmmmm beer Featured Poster

Sorry I don't understand how I can try PayPal? I click on the following page:

https://www.daniweb.com/rewards/earnings

It then says I now have over 2000 reward points. But then it also says I cannot cash out as you need at least 500 points.

Where does PayPal come into it?

Thanks

DaveAmour 160 Mmmmmm beer Featured Poster

What error do you get?

DaveAmour 160 Mmmmmm beer Featured Poster

You have suspicious looking spaces in ' 8req' WHERE id = '3 '

DaveAmour 160 Mmmmmm beer Featured Poster

Ok I see now you wanted to get the decimal portion!

DaveAmour 160 Mmmmmm beer Featured Poster

Ok I see.

Well first of all I am not a C++ programmer so cannot give you C++ code. I can give you pseudo code though.

Generate a random number between 1 and 9

Store this in a string

Generate another number between 1 and 9 and if this isn't already in the string, store it otherwise repeat. Use a loop for this.

Repeat the above x times or in this case 3 times in total. Wrap the above in a for statement.

Return the string cast to a number

Does that help? This is just one way of coding this off the top of my head.

DaveAmour 160 Mmmmmm beer Featured Poster

Hi - give me an example of how this output would look?

DaveAmour 160 Mmmmmm beer Featured Poster

I don't think you need to pass in any arguments to generateRandomNo

DaveAmour 160 Mmmmmm beer Featured Poster

You really need to be a bit more specific with your question. It is far too general and doesn't make much sense or read well.

DaveAmour 160 Mmmmmm beer Featured Poster

Ok nice one, glad to help.

DaveAmour 160 Mmmmmm beer Featured Poster

I first learned MVC from some excellent videos by David Finley on http://www.learnvisualstudio.net/

They were really good and easy to follow.

Plural Sign is also really good - http://www.pluralsight.com

Both of these are not free thouhg so depends on your budget. I think PluralSight have a few free ones thouhg.

DaveAmour 160 Mmmmmm beer Featured Poster

@wojciech1 - please don't hijack my posts as my problems don't get answered as the thread becomes all about you and people forget about my actual question - eg the CV thread for example.

Thank you.

DaveAmour 160 Mmmmmm beer Featured Poster

I'm not sure I understand your question as I think it could be worded slighly better but possibly you need loopback enabled.

Check out http://opensimulator.org/wiki/NAT_Loopback_Routers

DaveAmour 160 Mmmmmm beer Featured Poster

I havec1799 reward points but cannot cash out any.

Any ideas?

DaveAmour 160 Mmmmmm beer Featured Poster

Youre welcome.

DaveAmour 160 Mmmmmm beer Featured Poster

I will struggle with this as I remember vagueley from Maths classes what a Matrix is but my domain knowledge in this area is not good so over to you other guys!

DaveAmour 160 Mmmmmm beer Featured Poster

Is this what you want?

using System;
using System.Data.SqlClient;

namespace DaniWeb.Inheritance
{
    class Program
    {
        static void Main(string[] args)
        {
            IntegerFactory integerFactory = new IntegerFactory();
            StringFactory stringFactory = new StringFactory();
            SqlCommandFactory sqlCommandFactory = new SqlCommandFactory();

            var anInteger = integerFactory.BaseMethod();
            var aString = sqlCommandFactory.BaseMethod();
            var aCommand = sqlCommandFactory.BaseMethod();

            Console.WriteLine("anInteger is type {0} and T is {1}", anInteger.GetType(), anInteger.GenericType);
            Console.WriteLine("aString is type {0} and T is {1}", aString.GetType(), aString.GenericType);
            Console.WriteLine("aCommand is type {0} and T is {1}", aCommand.GetType(), aCommand.GenericType);

            Console.ReadKey();
        }
    }

    public class GenericFactory<T>
    {
        public virtual string Name { get { return "Base"; } }
        public virtual Type GenericType { get { return typeof(T); } }

        public virtual GenericFactory<T> BaseMethod()
        {
            return new GenericFactory<T>();
        }
    }

    public class IntegerFactory : GenericFactory<int>
    {
        public override string Name { get { return "IntegerFactory"; } }

        public override GenericFactory<int> BaseMethod()
        {
            return this;
        }
    }

    public class StringFactory : GenericFactory<string>
    {
        public override string Name { get { return "StringFactory"; } }

        public override GenericFactory<string> BaseMethod()
        {
            return this;
        }
    }

    public class SqlCommandFactory : GenericFactory<SqlCommand>
    {
        public override string Name { get { return "SqlCommandFactory"; } }

        public override GenericFactory<SqlCommand> BaseMethod()
        {
            return this;
        }
    }
}
DaveAmour 160 Mmmmmm beer Featured Poster

Where in my code do you want the "return this" to go?

DaveAmour 160 Mmmmmm beer Featured Poster

Just realied I have a typo

Console.WriteLine("watsit is type {0} and T is {1}",

Shoule be

Console.WriteLine("aString is type {0} and T is {1}",

DaveAmour 160 Mmmmmm beer Featured Poster

Yes I know that's what you want but its my pc not yours - what if I want to check my email while I am using your application. What gives you the right to dictate how I can use my pc?

DaveAmour 160 Mmmmmm beer Featured Poster
DaveAmour 160 Mmmmmm beer Featured Poster

Hi

Ok I'm really not clear on what you are asking here.

So I took your code and got it to compile - a few typos etc but got something working. I then renamed things and played around with it to give it more context - I find things easier to understand that way otherwise it all gets a bit abstract and dificult to follow!

I don't know if how I have renamed things and played around with them conveys your intentions or not but it does at least give us a working code baseline from which to start further discussions.

Hope what I have done helps, if not fire away.

using System;

namespace DaniWeb.Inheritance
{
    class Program
    {
        static void Main(string[] args)
        {
            IntegerFactory integerFactory = new IntegerFactory();
            StringFactory stringFactory = new StringFactory();

            var anInteger = integerFactory.BaseMethod();

            var aString = stringFactory.BaseMethod();

            Console.WriteLine("anInteger is type {0} and T is {1}", anInteger.GetType(), anInteger.GenericType);
            Console.WriteLine("watsit is type {0} and T is {1}", aString.GetType(), aString.GenericType);

            Console.ReadKey();
        }
    }

    public class GenericFactory<T>
    {
        public virtual string Name { get { return "Base"; } }
        public virtual Type GenericType { get { return typeof(T); } }

        public virtual GenericFactory<T> BaseMethod()
        {
            return new GenericFactory<T>();
        }
    }

    public class IntegerFactory : GenericFactory<int>
    {
        public override string Name { get { return "IntegerFactory"; } }

        public override GenericFactory<int> BaseMethod()
        {
            return new IntegerFactory();
        }
    }

    public class StringFactory : GenericFactory<string>
    {
        public override string Name { get { return "StringFactory"; } }

        public override GenericFactory<string> BaseMethod() …
ddanbe commented: Thanks for the "factory" code. +15
DaveAmour 160 Mmmmmm beer Featured Poster

I can't help you any more. I'm not a python developer and have never written a python program. I am a professional software engineer though and was able to help with your basic issues initially but you now need someone with more python knowledge than me.

Also its good practice once an item has been resolved to mark it solved and if you have any other questions then post them as new threads.

DaveAmour 160 Mmmmmm beer Featured Poster

If you don't know why then whey have you marked this as solved?

DaveAmour 160 Mmmmmm beer Featured Poster

Youre welcome.

DaveAmour 160 Mmmmmm beer Featured Poster

Why would you want to do that? What gives you the right to take over someone's pc!?

DaveAmour 160 Mmmmmm beer Featured Poster

Yep Suzie is spot on. I assume by shared place you mean a network share? If so the app doesn't run there, that's just where the file is. The app runs in memory on the users pc.

DaveAmour 160 Mmmmmm beer Featured Poster

What data type is ID in your database?

Can you debug your code, copy and paste the SQL statement and execute it directly against the database - in SQL Management Studio for example - and see what happens. This will give you a much clearer idea of what may be wrong.

DaveAmour 160 Mmmmmm beer Featured Poster

You already have the 4. Can you reword your quetion, it doesn't make sense.

DaveAmour 160 Mmmmmm beer Featured Poster

So is the code stepping into line 15 then?

DaveAmour 160 Mmmmmm beer Featured Poster

Sure, you need to look at loops https://wiki.python.org/moin/WhileLoop

DaveAmour 160 Mmmmmm beer Featured Poster

To make it not case sensitive just lower case your search term and your search text. I don't mean lower your seach text in your document but in code.

DaveAmour 160 Mmmmmm beer Featured Poster

Do you need a semi colon?

if x == "yes":

DaveAmour 160 Mmmmmm beer Featured Poster

I think you need speechmarks aroynd yes

Eg if x == "yes"

DaveAmour 160 Mmmmmm beer Featured Poster

Hmm thats not what I mean by inconsistency. Does it always behave the same for the same search text. If it does not that would be inconsistent and would be very worrying.

DaveAmour 160 Mmmmmm beer Featured Poster

I don't think this is doing anything inconsistent - the behaviour is always the same right?

DaveAmour 160 Mmmmmm beer Featured Poster

Looks good.

I have some suggestions which are sincerely intended as to be encouraging.

Firstly I would always use the using statement rather than manually calling Dispose eg:

            using (SqlDataReader reader = cmd.ExecuteReader())
            {
                //Somde code here
            }

For a few reasons - firstly you won't forget to call Dispose. Secondly it gives nicely structered indentation making it easier on the eye to see what is happening and thirdly because it is the way most developers do it so its a kind of unwritten standard.

I would also be mindful of the S in SOLID. That is single responsibility principle. This method does a lot. I would split it up a bit more. In Visual Studio a great thing to play with is highlighting a block of code that looks like it could be a seperate method or class and then right click and Refactor - try extracting to method - VS will figure out the parameters and does all the work for you.

Smaller, more cohesive methods are easier to maintain, test and debug.

And finanlly in C# we say methods not functions - sorry if that one is too picky!

DaveAmour 160 Mmmmmm beer Featured Poster

Sure - either as a string or as a complex xml type

DaveAmour 160 Mmmmmm beer Featured Poster

Change to this and then run it

        #faq EM
        {
            /*display: none;*/
        }

You can see what it is doing then - I'm just not clear on its intended behaviour.

DaveAmour 160 Mmmmmm beer Featured Poster

Are you learning through books or videos?

DaveAmour 160 Mmmmmm beer Featured Poster

Your tags are malformed - put the close div at the end.

DaveAmour 160 Mmmmmm beer Featured Poster

Dude that's not even a proper sentenace. We cannot help if you cannot express your question in an understandable fashion!

DaveAmour 160 Mmmmmm beer Featured Poster

Cables are so much better and you can even go IP over power.

DaveAmour 160 Mmmmmm beer Featured Poster

<img src="/arrowimage.gif" />

DaveAmour 160 Mmmmmm beer Featured Poster

Use a loop and just add the digit on each time.

This is pretty basic stuff, may I ask if you are able to program at all in php?

DaveAmour 160 Mmmmmm beer Featured Poster
DaveAmour 160 Mmmmmm beer Featured Poster

You don't have to use var, you can use this instead:

int[] nonZeroData = intScoreTotalsArray.Where(v => v > 0).ToArray();

"I notice that before it was always showing 20 zeros in the msgbox since I have the array size declared for 20. The problem was that it is not recognizing the number of elements that the user actually inputs and to only display those."

I've fixed this though right or am I missing something?

"delete the class variable for score total." I never saw this variable I don't think so can't comment on that.

To do the statistics you could add the two lines below. Put them in your button click event handler.

txtAverage.Text = intScoreTotalsArray.Where(v => v > 0).Average(v => v).ToString();
txtScoreTotal.Text = intScoreTotalsArray.Where(v => v > 0).Sum(v => v).ToString();
DaveAmour 160 Mmmmmm beer Featured Poster

Can you not just hard code this:

Dim x As Decimal = 0

x += Convert.ToDecimal(Table1DataGridView.Rows(0).Cells(1).Value)
x += Convert.ToDecimal(Table1DataGridView.Rows(1).Cells(1).Value)
x += Convert.ToDecimal(Table1DataGridView.Rows(3).Cells(1).Value)

Where Cells(1) is the appropriate column?