From 4aa3f3aa097a785ccb18bebc30af440a826e0a3e Mon Sep 17 00:00:00 2001 From: qi-zhang Date: Wed, 11 Sep 2013 22:45:57 -0700 Subject: [PATCH 1/3] For 1st week. --- 2013-09-07.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/2013-09-07.md b/2013-09-07.md index e69de29..e18a077 100644 --- a/2013-09-07.md +++ b/2013-09-07.md @@ -0,0 +1,11 @@ +Reflection for the week 9/1 to 9/7. + +It was pretty challenging to get ssh access to the Ubuntu server running on my Virtual box. + +By default there is only one network adaptor, known as “Adaptor 1” and it was attached to “NAT”. Such kind of configuration makes it impossible to access the box with its IP address, not to mention establishing ssh access. + +I tried to re-configure the network adaptor to attach to “bridged adaptor” and I’m able to establish ssh access to it. Soon I found that was not a good idea since the IP address of the box keep changing every time I restarted it. + +Finally I configured the “Adaptor 1” back to attached to “NAT” and enabled “Adaptor 2” and let it attached to “Host-Only Adapter”. With help from server guide I found on Ubuntu’s website (https://help.ubuntu.com/13.04/serverguide/network-configuration.html), I finally get the box to support “Adaptor 2” and now I can establish ssh access to the box. + +It was pretty challenging for me since this is the first time I learn some terms in networking. But I’m so glad I did it. From aba31eeafe43e1c3662b191234c42b4d2ea79fb5 Mon Sep 17 00:00:00 2001 From: qi-zhang Date: Wed, 11 Sep 2013 22:49:58 -0700 Subject: [PATCH 2/3] Update 2013-09-07.md --- 2013-09-07.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/2013-09-07.md b/2013-09-07.md index e18a077..831a521 100644 --- a/2013-09-07.md +++ b/2013-09-07.md @@ -1,11 +1 @@ -Reflection for the week 9/1 to 9/7. - -It was pretty challenging to get ssh access to the Ubuntu server running on my Virtual box. - -By default there is only one network adaptor, known as “Adaptor 1” and it was attached to “NAT”. Such kind of configuration makes it impossible to access the box with its IP address, not to mention establishing ssh access. - -I tried to re-configure the network adaptor to attach to “bridged adaptor” and I’m able to establish ssh access to it. Soon I found that was not a good idea since the IP address of the box keep changing every time I restarted it. - -Finally I configured the “Adaptor 1” back to attached to “NAT” and enabled “Adaptor 2” and let it attached to “Host-Only Adapter”. With help from server guide I found on Ubuntu’s website (https://help.ubuntu.com/13.04/serverguide/network-configuration.html), I finally get the box to support “Adaptor 2” and now I can establish ssh access to the box. - -It was pretty challenging for me since this is the first time I learn some terms in networking. But I’m so glad I did it. +Empty Template From 691b6a128ee89ac7dbfd0ce120cb66d64b38fe32 Mon Sep 17 00:00:00 2001 From: qi-zhang Date: Sat, 12 Oct 2013 17:11:10 -0700 Subject: [PATCH 3/3] Update 2013-09-07.md --- 2013-09-07.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/2013-09-07.md b/2013-09-07.md index 831a521..2c7a033 100644 --- a/2013-09-07.md +++ b/2013-09-07.md @@ -1 +1,11 @@ -Empty Template +

Weekly Reflections for the week 10/6-10/12

+ +

Regular Expression in Python

+ +From time to time, people try to find some detail from enormous raw informaiton. Find these information by human is not productive or not feasible, not to mention possiblity of reproduce. Regular expression is a powerful tool for such scenarios and widely supported by most popular scripting languages. You can find any strings that matches pre-specified pattern with regular expression and this pattern is pretty flexible. + +Python also supports regular expression as one of its extension modules. To take advantage of regular expression in Python, it is necessary to import "re" first. + +For the first project, I found re.findall() is extreamly helpful in my data cleanup. It takes two arguments, pattern and the raw data. It returns a list of matched strings if there is at least one match, or an empty list otherwise. + +For example, the learning style information in the questionnaire are encoded in the form of keyword-delimiter-value. The delimiter could be '-' or ':' plus one ore more spaces while the value consist of one or more consecutive digits. So at first the pattern I used was "Keyword.*[0-9]+" which meant to match a string started with Keyword and ended with at least one digit. I thought the keyword should be pretty straight-forward but it turned out that there was one exception. The keyword for read and write for most records are "Read/Write" but in one record I found "Reading/Writing" which cannot be matched by "Read/Write". It reminds me that how important it is to make the pattern flexible yet precise in regluar expression applications. This is what I think is the most valueable thing I've learned in the past week.