Wednesday, November 20, 2013

Install Microsoft SDK on Win7

Tonight is a both difficult and "teaching" night. I am very excited to record what I learned, thanks to those obstacles and questions.

Goal: Install Microsoft SDK 7.1 to work with MATLAB.

I have got three types of SDK but didn't know which to install. They are GRMSDK_EN_DVD.iso, GRMSDKX_EN_DVD.iso and GRMSDKIAI_EN_DVD.iso. So here came my first question - what's the difference? Googling my question, it turned out that GRMSDK_EN_DVD is for x86, adding an X to GRMSDK for x64, and adding IAI for Itanium. OK, I chose the "X" one to cooperate with my MATLAB which is x64 version.

When installing the SDK, "return code 5100" baffled me a lot. Answer is in stackoverflow. I uninstalled Visual C++ 2010 Redistribute, but there were Visual C++ 2010 Designtime, Visual C++ 2010 Runtime and Visual C++ 2010 Redistribute. Again what's the difference? Stackoverflow is amazing, right? It tells me the difference is like difference between debug and release. Fine, continue installation.

Great! Successfully installed!




Monday, November 11, 2013

Alternately Store Elements of Two Char Arrays

Recently I was asked a question, i.e. how to output two char arrays alternately. It is easy to work out, so the main point here may be to practice my writing skills and to increase the number of my blogs. By the way, record my solution. I chose to store them first and then you could do anything as you like. Maybe output it. Maybe pass it. Whatever.

#include <stdio.h>
#include <string.h>

int main()
{
    char a[512]={0}, b[512]={0}, buf[1024]={0};
    int i=0, length_a=0, length_b=0, minlength=0;
 
    scanf("%s", a);
    scanf("%s", b);

    length_a = strlen(a);
    length_b = strlen(b);
    minlength = length_a > length_b ? length_b : length_a;
    for(i=0; i<minlength; ++i)
    {
        buf[i*2] = a[i];
        buf[i*2+1] = b[i];
    }

    while (i < length_a)
    {
        buf[i+length_b] = a[i++];
    }

    while (i < length_b)
    {
        buf[i+length_a] = b[i++];
    }

    printf("%s", buf);

    return 0;
}





Thursday, October 31, 2013

Sieve of Eratosthenes C++

I think Wikipedia has introduced it very clearly, and I implemented it on my machine with Code::Block. It works quite well.

#include <stdio.h>
#include <math.h>

#define MAX 1000001

int main()
{
    int i=0, j=0, m=0;
    bool prime[MAX]={0};

    for(i=2; i<MAX; ++i) prime[i] = (i & 1);

    m = sqrt(MAX);
    for(i=3; i<=m; i+=2)
    {
        if (prime[i])
        {
            for(j=i*i; j<MAX; j+=i) prime[j] = false;
        }
    }

    scanf("%d", &m);
    for(i=2; i<m; ++i)
    {
        if (prime[i]) printf("%d ",i);
    }

    return 0;
}




Monday, October 28, 2013

Get Qt Installed in Visual Studio 2010

It's a little weird for me to use Qt in Visual Studio 2010. The first time I programmed with Qt is about May in 2013 and the IDE was Qt Creator in Ubuntu. With a book borrowed from library, I began my Qt tour. Since then I get accustomed to Qt Creator. Today I have to try something new in VS2010, although I have threw away VS for a long time and replaced it with code::block or others. OK, let's do some stuff now.

1. Download Qt-4.7.4-VS2008 (I chose this version) from its official site 
2. Download Qt-VS-AddIn 
3. Install them and try to build a new project in VS2010


You can choose what you need from here whatever Qt Creator, Qt libraries or others .


Sunday, October 27, 2013

Install MSDN for Visual Studio 2010

Recently I was back to Visual Studio to program and I uninstalled my code::block and installed VS2010. Given the poor network efficiency, installing local MSDN helps a lot. The whole process is recorded as below:

1. Open Visual Studio 2010
2. Press "Ctrl" + "F1" to check installing method for current version
3. Open "Help Library Manager"
4. Do some basic setting
5. Choose installing from local files
6. Add what you like

OK, that's all. So easy, huh?

Sunday, October 6, 2013

HTML5 & CSS3 FOR THE REAL WORLD

I'm a beginner in front-end web development. Many of my classmates don't care about their website because they think it is the work of those who have a talent in aesthetic and are good at designing. However, they don't even intend to know how to write those codes like html, css and js. In my opinion, though we may be not as great as people who have an artistic talent or get professional training, it's necessary for us to understand and write front-end codes. So today I just borrowed a book from library, that is "HTML5 & CSS3 FOR THE REAL WORLD".

I read through the first, second and third chapters very fast for their difficulties in understanding for such a beginner as me. In other words, the fourth chapter is my first chapter. Let me keep track of my reading in the following way, and I think it is clear and efficient :-)


<label for="name">My name is: </label>
<input type="text" id="name" name="name" required aria-required="true">


<label for="name">My name is: </label>
<input type="text" id="name" name="name" placeholder="Scrooge Santa">


<label for="password">Set my password as:</label>
<p>(at least six characters, no space)</p>
<input type="password" id="password" name="password" required aria-required="true" pattern="\S{6,20}">


<label for="about">article title</label>
<input type="text" name="about" id="about" 
placeholder="First time reading" readonly>


<label for="favcolor">Favorite Color</label>
<input type="text" list="colors" id="favcolor" name="favcolor">
<datalist id="colors">
<option value="Blue">
<option value="Green">
<option value="Pink">
<option value="Purple">
</datalist>


<form id="search" method="get">
<input type="search" id="s" name="s">
<input type="submit" value="Search">
</form>


<label for="address">My email address is:</label>
<input type="email" id="address" name="address" required aria-required="true">


<label for="url">My website is:</label>
<input type="url" id="url" name="url">


<label for="rating">On a scale of 1 to 10, my knowledge is :</label>
<input type="range" min="1" max="10" id="rating" name="rating">


<label for="startdate">Start my subscription on:</label>
<input type="date" min="2000-01-01" max="2099-12-31" id="startdate" name="startdate" placeholder="2013-9-2">










Wednesday, September 4, 2013

#1 - A BUG HUNTER'S DIARY

It's a little difficult for me to do the experiment but I made it finally. Thanks to the author for I could download all resources I need according to the annotations. Let me tell what happened this morning.