原创 Python 一步一步學網絡編程

就像當初用C++寫網絡程序一樣,Python的第一個網絡程序肯定是最簡單的阻塞的那種,即服務器綁定監聽,等待客戶端的連接,如果有客戶端連接,則建立連接進行通信,服 務器是阻塞的沒有多線程。 服務端: #/usr/bin/python #

原创 [LeetCode] Path Sum 求二叉樹中滿足要求的路徑

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along

原创 TCP/IP中那些令人豁然開朗的說明

1、ACK報文段永遠不需要被確認。 我不知道大家有沒有這麼想過:在TCP通過三次握手建立連接的時候,最後一次握手是客戶端對服務器的ACK報文,那麼客戶端怎麼知道這個ACM報文確實被服務器收到了呢?照這麼來說,服務器是不是有需要給客戶端返回

原创 [LeetCode] Two Sum

Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum s

原创 [LeetCode] Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).

原创 [LeetCode] Symmetric Tree 判斷二叉樹是否爲對稱二叉樹

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this bi

原创 [LeetCode] Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2

原创 [LeetCode] 判斷兩個鏈表是否有公共節點並返回第一個公共節點

Write a program to find the node at which the intersection of two singly linked lists begins. For example, the follow

原创 剛裝完CentOS後連不上網

1、剛安裝好centos後連不上網: 解決辦法:切換到root目錄: cd /etc/sysconfig/network-scripts/vi ifcfg-eth0     DEVICE=eth0     BOOTPROTO=dhcp  

原创 CentOS刪除多餘的啓動項

    更新內核後,舊的內核還在,而且啓動項上也有,看起來不好看,所以想辦法去掉多餘的啓動項,這兒介紹兩種方法,一種方法是直接刪除內核,另一種是修改啓動項,只是 讓它不顯示,這裏介紹第二種,只修改啓動配置文件。切換到root.

原创 Python調用DLL

C語言中的函數默認是__cdecl調用,C++中可用__stdcall來顯示聲明調用,但也可以用extern “C” 用python調用dll時需要根據不同的調用約定而使用不同的函數。但是不管什麼調用,最後都必須用extern “C”來防

原创 總結:和鏈表有關面試題

面試中被問鏈表的題目我就不再多說,直接總結題目。 1、將鏈表逆序 這個問題很早就研究過,但後來一次面試的時候我突然緊張忘了,沒答上來。 我不知道大家的解法是什麼,我的解法是遍歷鏈表是用前插發插入節點,最後的鏈表就是逆序的。 class

原创 Python:Tkinter之Radiobutton

最近纔剛開始學pythonGUI,雖然用Python做GUI肯定不是明智之舉,但爲了學習,還是瞭解瞭解,今天先來看看 Radiobutton,沒什麼可說的,直接貼代碼。 from Tkinter import * def sel(

原创 ConsoleFW

#/usr/bin/python #encoding=utf-8 import os import Tkinter import tkMessageBox def handleListboxClicked(event, listBo

原创 install google-chrome on CentOS 7

After I install CentOS, I would like install google-chrome, but as we all know, we can't visit google as normal. So aft