Saturday, October 13, 2012

Knitting Alpaca (horse/sheep/camel)

    First, I want to say "Thanks" for all the people who follow and visited my blog, which gave me great encouragement to continue to create beautiful and useful things. Sorry didn't update my blog for 3 months. It is really hard to have much spare time to create new things, not only because of the busy work, but also there are so many things I want to do. 

    
Alpaca - front

    I expected to finish this knitting work at the end of 2012, but I made it earlier. Anyway, it will definitely be the last knitting work for this year. It might look familiar if you have seen my previous work "Knitting poodle dog". It is true, I used the same knitting woolen,similar size and posture. But they are completely different kind of animal, just have fur with similar color.
  
 
    So it is necessary to introduce a little bit about this creature - Alpaca, though I have to admit the Alpaca I knitted is not so look like the real Alpaca. My co-worker even thought it is a teddy bear. If you are Chinese, I don't want to explain, but in case you misunderstand me, I would like to say I am absolutely a good person. The reason I chose it is that this creature has a cute look.





    The most difficult part is the shape of the body, I believe I redo it for more than 10 times and try to make a long neck, but failed. I guess next time, I should combine the crochet skill and needle skill.
  
Alpaca - side





    I use this paragraph talk a little bit about my current life. My new career life is great, I am doing a job I like very much, I can develop all my hobbies during my spare time. There are so many excellent people around so that I can learn from them not only the technical skills, but their way of life. I wish I can find more like-minded friends to discuss the meaning of life,talk about the past and present, talk about art and literature, etc. Then, it will be perfect!

    I plan to continue my "Technique animation". Probably a flash game and some topics related to music. Please feel free to email me cxychenxueyan@gmail.com tell me which "computer programming" animation you expect to watch.



Monday, July 9, 2012

Technique: Merge Sort Animation

    Step by step animation. For the programming beginners to get a better understanding of merge sort.
    It is not easy to illustrate recursive using animation. The entire code flow in the animation is following its actual execution in the compiler, which might be a little different from the logic we usually mentioned in merge sort. I strongly recommend you test the code in your compiler to figure out how the recursive works.
    By clicking the snail, the animation starts, and by clicking it again, it goes back to the beginning.By clicking ">>" fast forward button, it can skip some stops. Probably, I will add a scroll bar later. The steps are kind of subtle, if there is any suggestion, please leave message to me and I will improve it.
 


 Cost: O(nlogn)
 Worst case: O(nlogn)
 Best case: O(nlogn) 
 Space cost: 2 * size of the element array
 Advantages: stable cost

Merge sort code in C++:

void Merge(int left, int mid, int right, int a[])
{
     int temp[50];                   
     int i = left;
     int j = mid+1;
     int index = 0;                                
     //merges the left part and the right part elements into a sorted list
     while (i <=mid && j <= right) {
              if (a[i] <= a[j]) {
                   temp[index] = a[i];
                   i++;
              }
              else {
                   temp[index] = a[j];
                   j++;
              }
              index++;
     }
     //copy the rest elements into temp array
     while (i <= mid) {
         temp[index] = a[i];
         i++;
         index++;
     }
     while (j <= right) {
         temp[index] = a[j];
         j++;
         index++;
     }
     //copy the sorted list back to original array
     for (int k = 0; k < index; k++) {
         a[k + left] = temp[k];
     }
}

void MergeSort(int left, int right, int a[])
{
     int mid;
     if(left<right)
     {
          mid = ((left + right) / 2);
          MergeSort(left, mid, a);
          MergeSort(mid+1, right, a);
          Merge(left, mid, right, a);
     }
}
 int main()
{
int a[]={25,49,8,25,21,16,32};
MergeSort(0,6,a);
}

More technique animations:

Quick Sort
Binary Search
Heap Sort 
Bubble Sort 
Selection Sort 

Monday, July 2, 2012

Knitting Toy Totoro

      

    When asked what is the favorate character in Hayao Miyazaki's animation movie, many people will say Totoro. Not only because it is cute, but it represents lucky and blessing. I had this characters in mind four months ago, and it took me one and half month to finish. I thought it should be easy because it was the first time I knit an existing cartoon character, but it wasn't. I changed the color of yarn for three times. Teared down, and did it over again for more than five times just can not find the best shape and proportion, which always made me crazy. It is still not perfect, the belly is smaller than it should be, so let's just call it Tororo in Sherry's version.
    Every work of mine is unique and has its own meanings. Totoro brings people the best wishes, and this knitting work turns out to be the gift for my best friend.

Totoro under sunshine with leaf hat

Totoro front without leaf hat


   Totoro side photos

    I hope I can make another character by the end of this year, but not sure. Always feel time is not enough to do all the things I want. Hope you like this one :-)


Friday, May 18, 2012

Technique: Build Heap and Heap Sort Animation

   Step by step animation. For the programming beginners to get a better understanding of heap and heap sort.
   In the animation, the heap in tree structure just let you know how it works. The entire coding is using array rather than binary tree. (Click snail button to start animation and click it again to go back to the first page)
   For an element with index i in the array 
   Its parent index is:  (i-1)/2
   Its left child index is: 2*i+1
   Its right child index is: 2*i+2





 Cost: O(nlogn)
 Worst case: O(nlogn)
 Best case: O(nlogn)

Heap sort code in C++:

void swap(int i, int j,int a[])
  {
         int temp;
         temp=a[i];
         a[i]=a[j];
         a[j]=temp;
  }
void heapify(int i,int a[],int heapSize)
{
       int temp=i;
       while(i*2+1<=heapSize-1)
       {
           if(i*2+2<=heapSize-1&&a[i*2+2]>a[i*2+1])
           {
               i=i*2+2;
           }
           else i=i*2+1;
           if(a[i]>a[temp])
           {
              swap(i,temp,a);
              temp=i;
           }
           else break;
       }
}
void BuildMaxHeap(int a[],int heapSize)
{
         int i=(heapSize-1)/2;
        while(i>=0)
        {    
          heapify(i,a,heapSize);
          i--;
        }
}
void heapSort(int a[],int heapSize)
{
     for(int i=heapSize;i>0;i--)
     {
         swap(0,heapSize-1,a);
         heapSize--;
         heapify(0,a,heapSize);
     }
}
int main()
{
int heapSize=7;
int a[]={25,49,8,25,21,16,32};
BuildMaxHeap(a,heapSize);
heapSort(a,heapSize);
}


More technique animations:

Quick Sort
Binary Search 
Merge Sort 
Bubble Sort 
Selection Sort

Virtuoso play "Castle in the sky"


    Today's topic is a little different, no animation, no knitting works, no programming techniques, but music. It is true that I learned piano for 5 years during my childhood, but I forgot all of them after I stopped taking courses, which is one of the regrets in my life. So I dare not to say I can play piano. I played with Virtuoso app in iPad just for fun, and this music is to commemorate my graduation, and May in 2012.
    18 years of school life finally ended. After long period of busy life, the sudden leisure makes me feel uncomfortable and sad. I always believe as long as you work hard, you can finally reach your goals and get the things you want. This belief supports me even though I have experienced many frustrations. But recently, I realized you can never get the things that not belong to you. I don't know why, once I find something I want, I just can not see other choices.
    Happiness is so powerful beyond my imagination. I always believe life is pain and happiness is just decoration. Thanks for all the people who gave me happiness even if it only lasts one second.
   
    Hayao Miyazaki's animation movies are amazing. The theme song of "Castle in the sky" is one of my favorite song, which can bring the peace to my heart. I used Virtuoso 2nd version. Since the keyboard is too short, I cut the part I slid it off when making the video. Though there are several breaking points in between, hope you enjoy it.

Sunday, March 11, 2012

Knitting cartoon snail

    I designed this character 4 years ago for a multimedia work competition, and it becomes the logo of my works since then. Now I made it an entity in real world. I would like to say Flash animation and knitting works connect the 2D and 3D world in my mind. 


    I am a perfectionist to my works, and have to say it did not fully reached my expectation.I tried to add yellow stripes on its shell but not looks good.


     Some of my friends misunderstood me after saw my works. They said "hey Sherry, you are a handy girl, and you definitely will become a good wife." I have to say it is so NOT true. I do know how to knit scarves,wool hat or even sweater, but they are not my interests. I am not a fashion designer and 0% possibility to be a housewife. I only knit toys which are not for the practical use, but bring people visual enjoyment. In my eyes it is Art. A good design is more important than technical skills.


    Each of my work is unique and has its own meanings.I hope one day, I can have a shelf or even a room to store all my works, and I can sit there and watch them when I get old.


    Went to purchase new wool yarns today. Every time I stand in front of that shelf, I want to purchase all of them. The next character is already in my mind, will finish within 2 months.


    Little snail: Please work harder, harder and harder!!!

   

Thursday, February 23, 2012

Technique: Binary search animation (recursive)

    Step by step animation. For the programming beginners to get a better understanding of binary search.(Click snail button to start animation and click it again to go back to the first page)
    Search a keyword, if found, return the index of the item in the array, if not found, return the index where the element should be inserted.(4 example keywords)





Cost: O(logn)

Binary search code in C++:

int binsearch( vector<string> words, int low, int high, string word )
{
     if ( high < low ) return -low ;//position to insert
     int mid = (low+high) / 2;
     if(words[mid]==word)
     {
         return mid;
     }
     else if ( word < words[mid] )
     {
         return binsearch( words, low, mid-1, word );
     }
     else
     {
         return binsearch( words, mid+1, high, word );
     }

}


More technique animations:

Quick Sort
Heap Sort
Merge Sort 
Bubble Sort 
Selection Sort 

Technique: Quick sort animation

    First round quick sort step by step animation, for the programming beginners to get a better understanding of quick sort algorithm.(Click snail button to start animation and click it again to go back to the first page)



Cost: O(nlogn)
Worst case: O(n^2)
Best case: O(nlogn)

Quick sort code in C++:

void quickSort(int arr[], int left, int right) {
      int i = left, j = right;
      int temp;
      int pivot = arr[(left + right) / 2];

      /* partition */
      while (i <= j) {
            while (arr[i] < pivot)
                  i++;
            while (arr[j] > pivot)
                  j--;
            if (i <= j) {
                  temp = arr[i];
                  arr[i] = arr[j];
                  arr[j] = temp;
                  i++;
                  j--;
            }
      };

      /* recursion */
      if (left < j)
            quickSort(arr, left, j);
      if (i < right)
            quickSort(arr, i, right);
}



More technique animations:

Heap Sort
Binary Search
Merge Sort 
Bubble Sort 
Selection Sort 

Friday, February 10, 2012

Jiangnan 江南

    I thought I loved traveling before I arrived here. Later, I suddently found a place, without history, without culture, only beautiful views is meaningless for me. I started to read Chinese history again. A history book writer said history is not a story,but is real,which gives me a new angle to view it. People in history spent every single seconds in their lives just as what you are doing now.Thousands of years, technology was improved, environment was changed, but people are still there. They repeatedly did the same thing and considered about the same questions.
 
    For long time, a huge question always confused me: what my life will be?  I tried to find the answer by searching the people with similar personality, background and experiences in history. I know it is silly because I will finally figure it out at the end of my life. I believe that people can control their destiny somehow. But I also believe everyone follows a certain path, not designed by any supernatural being, but by the historical rules. We can find it if we do a huge data analysis of all the people in history,but it is a secret of life.

    Back to today's topic. Jiangnan is the general name of several provinces located in the middle south of China, near the east coast.Many cities have more than 5000 years of history and 2000 years of culture. It is not my hometown, but I was deeply impressed. In history, the richest people, literati and poets all lived there. Not like the north, where the wars, disasters and famine often happened; Not like the further south, where the land was uncivilized; Jiangnan is a place represented peace, harmony and richness.



    This Flash is not a picture gallery, if you want, you can find many photos online.(http://allold.blogspot.com/2012/02/old-garden-chinese-garden-art.html) I just want to show what Jiangnan looks like and why it is special. My favorite picture is the right lower corner one. Imagine in the early summer, you sit in the pavilion. In front of you is a large lake with several boats on it. You can see a stone bridge and several willow trees shaking its branches slightly. Outside is the soft and misty rain dropped on the lake. It is the only sound you can hear. You can think anything or nothing, just like the people thousands years ago. I can not find a second place, without religion, but can purify your heart.

    The top one and left lower corner one are not part of Jiangnan. The top one is  an old north city. The left one is an old town where minority lives. (Click the dolphin to open the poem, and click the poem to hide it.)