IrishCoder's Profile User Rating: -----

Reputation: 2 Apprentice
Group:
Members
Active Posts:
37 (0.02 per day)
Joined:
07-April 10
Profile Views:
2,381
Last Active:
User is offline Aug 05 2013 08:11 AM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Toyota
Dream Kudos:
0
Icon   IrishCoder has not set their status

Posts I've Made

  1. In Topic: Details Page with two id's being passed.

    Posted 5 Aug 2013

    View Postandrewsw, on 05 August 2013 - 07:25 AM, said:

    "AND SalesLT.
    

    You have no space between the word AND and the previous id.

    Doesn't it give you any errors? I don't use ASP but I would assume there should be an error-log somewhere, even if it's just in the Output window.


    Thanks I just corrected that, however that doesn't seem to fix the problem. When hovering mouse over the Details link I can see it is picking up the 2 id's necessary so that is all fine. However the error I am getting is the following :

    The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[AW_Internet.Models.ProdList]', but this dictionary requires a model item of type 'AW_Internet.Models.ProdList'.
  2. In Topic: Populating table with JSON data

    Posted 12 Jul 2013

    View PostDormilich, on 12 July 2013 - 06:38 AM, said:

    please define "is not working".


    When i click the button nothing happens.. It's supposed to display the data from the JSON file.

    I have even tried rewriting the code this way :
    <html>
    <head>
    <title>Json Loader</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
    </head>
    <body>
    
    <table id="results">
    	<tr>
    		<th>Key</th>
    		<th>Full name</th>
    		<th>ID No</th>
    	</tr>
    </table>
    </body>
    <script>
    
    var insert = '';
    
    $.each('JsonDataList.json', function (index, item) {
        insert += '<tr><td>' + item.key + '</td><td>' + item.fullname + '</td><td>' + item.idno + '</td></tr>';
    });
    $('#results').append(insert);
    
    </script>
    </html>
    


    And nothing loads into the table... every column just states "Undefined".
    However when I manually make a result set JSON string and parse that into the $.each method it works.
  3. In Topic: Need some advice

    Posted 30 Jun 2013

    View PostSkydiver, on 29 June 2013 - 08:13 PM, said:

    A few things:
    - Busy waits are usually a bad idea (you have two of them on lines 16 and 18). Why aren't you using events or semaphores instead?
    - In your inner loop on line 18, do you realize that the body will be run at least 750000 if not more?
    - Why are you calling join on lines 19 and 20?


    Hi Skydiver, I appreciate the feedback. I have adjusted the loops accordingly to run the correct amount of times (overlooked that) and the two Joins have been taken out. Could you provide a short example or show me how i could make this code more efficient using the semaphore/event technique? I have done some reading up on msdn on semaphores and am trying to incorporate this into the program but battling a little bit.
  4. In Topic: Need some advice

    Posted 29 Jun 2013

    View PostMichael26, on 28 June 2013 - 04:52 AM, said:

    The assignment says you need 3 threads but you're only using 1 read the tutorial i linked on MSDN in #4


    Alright so I have come up with this so far. Am I on the right track?

    namespace ConsoleApplication1
    {
        public class Program
        {
            public static List<int> GL = new List<int>();
            public static int len = 100;
    
            public static void Main(string[] args)
            {
               Thread first = new Thread(GenPrime);
               Thread second = new Thread(PickRanEven);
               Thread third = new Thread(PickRanOdd);
               first.Start();
               second.Start();
               
               while (GL.Count < 1000000)
                {
                    while (GL.Count >= 250000)
                    {
                        first.Join();
                        second.Join();
                        third.Start();
                    }
                }
               first.Abort();
               second.Abort();
               third.Abort();
               DisplayArray();
            }
    
            public static void GenPrime()
            {
                bool current = false;
                int j;
                Random r = new Random();
                for (int i = 2; i <= len; i++)
                {
                    for (j = 2; j < i; j++)
                    {
                        if (i % j == 0)
                        {
                            current = true;
                            break;
                        }
                    }
                    if (current == false)
                    {
                        GL.Add(j * (-1));
                        int x = r.Next(1, 100);
                        if (x % 2 != 0)
                        {
                            if (!GL.Contains(x))
                                GL.Add(x);
                        }
                    }
                    else
                        current = false;                  
                }
            }
    
            public static void PickRanOdd()
            {
                Random r = new Random();
                int i = r.Next();
                if (i % 2 != 0)
                {
                    if (!GL.Contains(i))
                        GL.Add(i);
                }  
            }
    
            public static void PickRanEven()
            {
                Random r = new Random();
                int i = r.Next();
                if (i % 2 == 0)
                {
                    if (!GL.Contains(i))
                        GL.Add(i);
                }
            }
    
            public static void DisplayArray()
            {
                for (int x = 0; x < GL.Count; x++)
                {
                    GL.Sort();
                    GL.ForEach(Console.WriteLine);
                    Console.ReadLine();
                }
            }
        }
    }
    
  5. In Topic: Need some advice

    Posted 28 Jun 2013

    Thank you both for your input. Could either of you suggest any ways coding wise of tackling this problem easier?

My Information

Member Title:
New D.I.C Head
Age:
24 years old
Birthday:
February 26, 1990
Gender:
Location:
Belfast, Ireland

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

IrishCoder has no profile comments yet. Why not say hello?