原创 hadoop單機版運行
hadoop在單機模式下,不需要配置core-site.xml, mapred-site.xml, hdfs-site.xml。1 建立hadoop-2.6.0-test文件夾。2 在其中建立test_grep_dir文件夾。3 在其中建立
原创 從源碼構建hadoop
Hadoop的可執行版本可以從網上下載,比如,hadoop-2.6.0.tar.gz;同時,也可以下載hadoop的源碼,比如,hadoop-2.6.0-src.tar.gz;現在介紹如何從源碼構建hadoop-2.6.0.首先,解決代碼依
原创 hadoop的unknownhostexception
hadoop在遇到unknownhostexception時,按如下解決方案:1. $hostnamesample_host2. go to /etc/hostsadd sample_host behind 127.0.0.1沒問題了。
原创 python的tkinter使用
__author__ = 'Python' import tkinter as tk class Application(tk.Frame): def __init__(self, master=None): t
原创 Ansible 安裝和配置
We start with installing Ansible using root.step 1 - run "yum install ansible" to install it on one machine with CenOS 7
原创 幾種並行模型比較
廣義上講,並行可以分爲幾類,1. 共享內存並行(明確的線程,比如Pthreads和Java threads);2.共享內存並行(任務/數據的並行,比如OpenMP); 2. 分佈式並行(明確的通信,比如MPI, SHMEM, 和Global
原创 c++解惑之讀取文件getline
std有個函數叫做getline,它的作用是從輸入文件中讀取每一行,並且將該行存入一個字符串中,每一行用換行符(\n)識別。它的原型是,istream& getline (istream& is, string& str);如果想遍歷某個輸
原创 Ansible Playbook Tutorial
Today we introduce how to use Ansible Playbook to install nginx.First, create a test file called test_playbook and type
原创 How to clone a repository from Github
Assume we are on a server, and we would like to clone a repsitory from Github.Once we hit git clone [email protected]: repo
原创 gdb使用: 標準輸入,查看變量,加入調試信息
使用gdb進行程序調試時,如何將標準輸入傳給可執行程序?假設數據在input.txt當中, 可執行文件名爲myprogram。$ cat input.txtthis is a test.$ gdb myprogram // 啓動調試(gdb
原创 Configure webserver with nginx
Today we study an example of using Ansible to configure nginx.We create an Ansible playbook named web-notls.yml.Type the
原创 錯誤: expected ';',',' or ')' before '&' token
Today met another error:expected ';',',' or ')' before '&' token.This error was raised because I use reference (&) to pa
原创 previous definition was here
今天寫了一個重載的C函數。結果報錯:note: previous definition of 'something' was hereerror: conflicting types for 'something'百思不得其解。在網上搜了半
原创 pthread統計文本次數
該程序使用pthread來統計某一文本中每個單詞出現次數。每一個thread處理一行字符串。使用一個map<string, size_t> word_count作爲全局變量。kernel function 中,使用pthread_mutex
原创 c++的this指針
在寫程序的時候發現,在一個類/結構體中定義一個變量並且初始化,如果變量名和參數名一樣,則需要用this指針指出變量名,否則,需要將變量定義一個新名字。變量名和參數名相同的後果是邏輯錯誤。在結構體中定義一個大小爲10的向量vector<str