paan's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
11 (0.02 per day)
Joined:
25-November 12
Profile Views:
125
Last Active:
User is offline Dec 01 2012 02:17 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   paan has not set their status

Posts I've Made

  1. In Topic: How to Insert value in array

    Posted 1 Dec 2012

    thank you very much. but, i already find the solution by itself and it worked as i plan it..this is a simple code that fulfill my requirement.

                int index = 0;
                foreach (string v in l)
                {
                    MessageBox.Show(v.Length.ToString(), "v");
                    double[] terms = new double[v.Length];
                    string a = v.Replace("\r\n", " ");
                    
                    foreach (var s in a)
                    {
                        qq = s.ToString();
                        MessageBox.Show(qq, "q");
                        //qq = match with dictionary(dic_FrequentItemsL1) single set...if 1 get  5 , meanwhile 2 get 3...
                        sqq = dic_FrequentItemsL1[qq];
                        terms[index] = sqq;
                        index++;
                    }
                    MessageBox.Show(terms[0].ToString(),"terms[0]");
                    MessageBox.Show(terms[1].ToString(), "terms[1]");
                    getMaxValue(terms);
                }
    
    


    Simple enough right. Anyway, I'm appreciate your kindness when want help me solve this problem. I already get what i want... :bananaman:
  2. In Topic: How to Insert value in array

    Posted 30 Nov 2012

    i have ilustration that want give to you guys...



    Get some value from foreach loop. Let’s say, the value is 5 and 3. Then I want these values insert in arrays named terms as below. For details, I want value 5 insert in terms 0. Then, for the second loop, value 3 insert in terms 1. See illustrations below…My purposes to do that because, I want compare the value in array later to find maximum value…the number of loop depends with number of value get from foreach loop. Let’s say, value from foreach loop is, 5,3, and 2. So, that’s mean, the program must do three times of loop. And the result is, terms[0] = 5, terms[1] = 3, terms[2] = 2.

    terms[0] [___5___] [___5___] [_______]
    terms[1] [_______] [___3___] [_______]
    terms[2] [_______] [_______] [_______]
    terms[3] [_______] [_______] [_______]
    terms[4] [_______] [_______] [_______]
    [terms] [terms] [terms]
    First-loop second-loop third-loop

    owh, it's just small misunderstanding. Actually that's not 2-dimensional array. i'm just assigned the first column as first-loop. Then, for second column, is second-loop, and so on. it's actually one single array only. i just make two and three for show you guys what happen for the next loop. the value will insert into next index in array..get it??
  3. In Topic: How to Insert value in array

    Posted 30 Nov 2012

    Get some value from foreach loop. Let’s say, the value is 5 and 3. Then I want these values insert in arrays named terms as below. For details, I want value 5 insert in terms 0. Then, for the second loop, value 3 insert in terms 1. See illustrations below…My purposes to do that because, I want compare the value in array later to find maximum value…the number of loop depends with number of value get from foreach loop. Let’s say, value from foreach loop is, 5,3, and 2. So, that’s mean, the program must do three times of loop. And the result is, terms[0] = 5, terms[1] = 3, terms[2] = 2.

    terms[0] [___5___] [___5___] [_______]
    terms[1] [_______] [___3___] [_______]
    terms[2] [_______] [_______] [_______]
    terms[3] [_______] [_______] [_______]
    terms[4] [_______] [_______] [_______]
    [terms] [terms] [terms]
    First-loop second-loop third-loop
  4. In Topic: How to Insert value in array

    Posted 30 Nov 2012

    here sample code that i be done but i cant find a best way

    foreach (string v in l)
                {
                    MessageBox.Show(v.Length.ToString(), "v");
                    double[] terms = new double[v.Length];
                    string a = v.Replace("\r\n", " ");
                    foreach (var s in a)
                    {
                        qq = s.ToString();
                        MessageBox.Show(qq, "q");
                        //qq = match with dictionary(dic_FrequentItemsL1) single set...example if 1 then 5 , meanwhile 2 then 3...
                        sqq = dic_FrequentItemsL1[qq];
                        
    
                        for (int index = 0; index < v.Length; index++)
                        {
                            terms[index] = sqq; // just to give it a unique value you can see
                            MessageBox.Show(terms[0].ToString(), "terms[0]");
                            MessageBox.Show(terms[1].ToString(), "terms[1]");
                           
                        }
    
                    }
                    getMaxValue(terms);
                }
    
    


    :gunsmilie:
  5. In Topic: How to Insert value in array

    Posted 26 Nov 2012

    what i just said before, i want value from foreach loop insert automatically in array...so, that i can call it by array[0] = firstElement, array[1] = secondElement, array[2] = thirdElement, array[3] = fourthElement and so forth...

    this is dummy situation i can tell you...if you all doesn't catch up what i told you, i didn't know how to describe you guys....let's say, during foreach loop, i can get two value for example which is 5 and 3....from this phase, these two value, i want it automatically insert into array that names terms[]....simple enough to understand right....my purpose it insert into array because i want do comparison between that value to find a maximum value....about value i get from foreach loop just now, i extract from external source which is string[] l = strGeneratedCandidate.Split (' ');....

    this strGeneratedCandidate value is 12...after passing process splittng, the value bacome 1 and 2...are you clear right now....then these value, i use in another method to find maximum value...

    see code below for better understanding
     private Dictionary<string, double> GenerateCandidates(Dictionary<string, double> dic_FrequentItems, Dictionary<string, double> dic_FrequentItemsL1)
            {
                List<clssRules> lstSingleElementReturn = new List<clssRules>();
                
                Dictionary<string, double> dic_CandidatesReturn = new Dictionary<string, double>();
    
                for (int i = 0; i < dic_FrequentItems.Count - 1; i++)
                {
                    string strFirstItem = Alphabetize(dic_FrequentItems.Keys.ElementAt(i));
                    for (int j = i + 1; j < dic_FrequentItems.Count; j++)
                    {
                        string strSecondItem = Alphabetize(dic_FrequentItems.Keys.ElementAt(j));
                        string strGeneratedCandidate = GetCandidate(strFirstItem, strSecondItem);
                        string[] l = strGeneratedCandidate.Split(' '); //1,2 --> 1 and 2
                       
                        GetSingleElement(l, dic_FrequentItemsL1, strGeneratedCandidate);
                       
                    }
                }
                return dic_CandidatesReturn;
            }
    
    


     double sqq;
            private Dictionary<string,string> GetSingleElement(string[] l, Dictionary<string, double> dic_FrequentItemsL1, string strGeneratedCandidate) 
            {
                Dictionary<string, double> value = new Dictionary<string, double>();
                Dictionary<string, string> dic_MaxReturn = new Dictionary<string, string>();
                //string firstItem = l[0]; //12,13,14,15............foreach
               // string[] q = l; // <-- here problem...
                string qq = "";
                string[] terms = new string[l.Length];
    
                //int[] terms = new int[10];
                foreach (string v in l)
                {
                    string a = v.Replace("\r\n", " ");
                    foreach (var s in a)
                    {
                        qq = s.ToString();
                        MessageBox.Show(qq, "q");
                        //qq = match with dictionary(dic_FrequentItemsL1) single set...example if 1 the outcome is 5 , meanwhile if 2 its comes out with 3...
                        sqq = dic_FrequentItemsL1[qq];
                        MessageBox.Show(sqq.ToString());
    
                        for (int index = 0; index < l.Length; index++)
                        {
                            terms[index] = sqq.ToString(); // just to give it a unique value you can see
                            MessageBox.Show(terms[index], "terms[index]");
                        }
                    }
                   
                    
                }
                MessageBox.Show(terms[0].ToString(), "arrays[0]");
                MessageBox.Show(terms[1].ToString(), "arrays[1]");
                getMaxValue(terms);
                dic_MaxReturn.Add(strGeneratedCandidate, getMaxValue(terms));
                 return dic_MaxReturn;
            }
    
    
    


    public static string getMaxValue(string[] numbers)
            {
                string maxValue = numbers[0];
                MessageBox.Show(maxValue, "maxValue");
                for (int i = 1; i < numbers.Length; i++)
                {
                    if (numbers[i] > maxValue)
                    {
                        maxValue = numbers[i];
                    }
                }
                return maxValue;
            } 
    
    


    are you guys clear right now, what i want to do???

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

paan hasn't added any friends yet.

Comments

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