DaveAmour 160 Mmmmmm beer Featured Poster

Really? What happens? Which country are you in?

DaveAmour 160 Mmmmmm beer Featured Poster

There are many ways to do this but a good way of seeing one in action is to create an out of the box MVC app in Visual Studio. It will create a templated app with logins all setup and done so you can look at that and see how that works.

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

I know how.

Depends how you want to architect/tier this though - any thoughts?

Also what database are you using and do you want to use stored procedures?

Finally what is your level of programming skill and which language do you want this in?

DaveAmour 160 Mmmmmm beer Featured Poster

Hi

Sorry I'm a bit late coming to this thread now but pretty much agree with everything that has been said.

Do use self describing names for variables and methods though. So Iterate is maybe not the best method name - I would rethink that one.

Also naming conventions for things like variable names and method names etc are not set in stone and there are many standards out there. For me though and for most programmers I work with we tend to stick to the same standards as the framework code. Since our code is interspersed with framework code this makes sense. It is also I find a pretty well used standard across the industry. How do I know this? I've had about 40 jobs in IT as I'm a contractor so its based on experience.

So for:

MMatrix MA = new MMatrix(r, c);

I would use lower case for ma and also would use a whole, self describing word.

If you have time the video below is full of fantasic advice from a talented programmer and teacher and is also very funny too. He does also include a section on naming variables, methods etc.

https://www.youtube.com/watch?v=_Zqhs1IhGx4

ddanbe commented: Thanks for the advise. +15
DaveAmour 160 Mmmmmm beer Featured Poster

I understand what duplicates are, but what I don't understand is what your data entry form and insertion code looks like.

Show me your EF code for inserting data please.

DaveAmour 160 Mmmmmm beer Featured Poster

Sure you can have a for loop. Which particular kind of for loop though and for which part of the logic?

DaveAmour 160 Mmmmmm beer Featured Poster

Can you elaborate please?

What kind of data is this?
Where is it coming from?
Are you using Entity Framework or plain Ado.net?

Thanks

DaveAmour 160 Mmmmmm beer Featured Poster

insteadof echo $b, append a$ to C$ with a comma each time you go through your foreach. You will need a little finesse to make sure you don't end up with a comma at the very end.

DaveAmour 160 Mmmmmm beer Featured Poster

There are many ways you can do this. Perhaps the simplest is just to restructure your html slightly with:

        <div id="units">
            My Company Name
            <p>
                My company Address<br />
                <span>My Company Contact Numbers</span>
            </p>
        </div>

With CSS there are probably a dozen ways of doing it but the above seems least effort. PS You spelled Company wrong too!

DaveAmour 160 Mmmmmm beer Featured Poster

Can you post an HTML snippet too?

DaveAmour 160 Mmmmmm beer Featured Poster

Writer (Author of books etc) or programmer?

DaveAmour 160 Mmmmmm beer Featured Poster

Youre welcome.

DaveAmour 160 Mmmmmm beer Featured Poster

Some additional info. When you select someting in jquery, you are using the same selectors used in CSS.

If you do this $("p").append("XXXXXXXXXXXXXXXXXXXXXX")

then this will append to all paragraph tags. If there was just one p tag then it would just do the one. In your page you may only have one form? You need to be more specific in your selector - ie <p id="32">Test</p> to select just this paragraph use $("#32") - # means id.

You can easily experiment with jquery to test things in any page whch uses jquery.

Daniweb does so if you are using IE then hit F12. Then click on the console tab. Then at the bottom type in $("p").append("XXXXXXXXXXXXXXXXXXXXXX") and hit return or maybe type in $("p").hide().

This is a great way to experiment with jquery.

So tip - to improve your jquery skills, study CSS!

DaveAmour 160 Mmmmmm beer Featured Poster

Change }).appendTo('form'); to instead of 'form' to be something more specific

Eg #formid if the other form has an id.

Does the other form already exist or are you creating it on the fly?

DaveAmour 160 Mmmmmm beer Featured Poster

A loop is nothing more than an automatic repetition of code eg:

While (i < 10)
{
    Print i

    i = i + 1
}
End

By the way the above is just pseudo code - ie a made up language to show an idea rather than being a specific language.

In your code you already have a loop.

This is setInterval

setInterval will repeat or loop the same bit of code over and over again at a predefined interval which you have supplied as 3 seconds via pauseTime.

Does that make sense?

DaveAmour 160 Mmmmmm beer Featured Poster

Actualy just noticed in your first bit of code you have this:

double food [monkeytot][Wdays];

But then in your second bit you have this:

double food[monkeys][Wdays];

Try changing that.

DaveAmour 160 Mmmmmm beer Featured Poster

I was bored so took your/my code and made a slideshow on my site - this is without scrollbars so view the source to see how it works.

http://www.paxium.co.uk

DaveAmour 160 Mmmmmm beer Featured Poster

If you like what I have done, I can get rid of the scrollbar too if you like?

DaveAmour 160 Mmmmmm beer Featured Poster

I think if you change slideShowItem = '.slides li' to slideShowItem = $('.slides li') then you will get a collection of items.

I had a play with your code and changed a few things just for a bit of fun. Its far from perfect but if it gives you any ideas that would be good.

http://www.paxium.co.uk/content/daniweb/slideshow.html

Just view the souce to see the code.

I would be interested to see your CSS which you did not originally post.

DaveAmour 160 Mmmmmm beer Featured Poster

Switching ascending to descending should be easy.

Can you show us your ascending code?

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

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
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

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

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

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

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

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?

DaveAmour 160 Mmmmmm beer Featured Poster

$("#firsttearesult").val(diffHour + " " + diffMins);

DaveAmour 160 Mmmmmm beer Featured Poster

You say that "I am displaying images from db dynamically"

As I said the next step is to instead of that, display your categories from your database.

Are you able to do that - can you show me your existing code for displaying images from db dynamically?

DaveAmour 160 Mmmmmm beer Featured Poster

Well you are currently displaying images from your database.

Instead of that, display your categories from your database.

Display these as a collection of links.

Wach link can have a querystring on the end eg:

<a hre="http://www.mysite.com/mypage.aspx?cat=1">Category 1</a>
<a hre="http://www.mysite.com/mypage.aspx?cat=2">Category 2</a>
<a hre="http://www.mysite.com/mypage.aspx?cat=3">Category 3</a>

Then when users click on the link, in mypage you read in the category id from the querystring and use this to construct your sql statement to only select images in that category and then display those as you are doing now.

I have no idea what technologies or langues you are using by the way as you just posted this in Web Development.

DaveAmour 160 Mmmmmm beer Featured Poster

What is folder type?

DaveAmour 160 Mmmmmm beer Featured Poster

You need:

if ($a == "Employed, Locally" or $a == "Employed, Abroad")

DaveAmour 160 Mmmmmm beer Featured Poster

Hi

You are setting words1 to the length, change it to:

var words1 = str1.split(' ');

Then change your if statement to:

if (words1.length > 60)

Also you should probably initialise newstr with:

var newstr = "";

Also a note on style. Don't use variable names like words1 and newstr - make variable names describe what they are for. It will make it easier for other people and yourself to understand and work with.

Hopefully that makes sense?

DaveAmour 160 Mmmmmm beer Featured Poster

Ok cool.

DaveAmour 160 Mmmmmm beer Featured Poster

Is cmd.parameters.addwithvalue (":0",receiptID) right - I may be wrong but I thought you used @ rather than : for parameters?