原创 阿里雲ECS服務器解決8080和3306端口不能訪問

出於安全考慮,實例默認只爲外界開放了22和3389兩個TCP端口,因此,想使用其它端口訪問,需要進行一些配置。不然,就會造成在Server上用localhost可以訪問mysql和tomcat,但是公網ip不可以。 設置方法也很簡單,按照

原创 C++中static_cast, const_cast, reinterpret_cast, dynamic_cast的區別

C++中存在顯示轉換和隱式轉換,所謂隱式轉換即是比如int和float相加時,int會自動轉換成float,此外還有顯示轉換,共有四種轉換方法, static_cast, const_cast, dynamic_cast, reinter

原创 Linux file, nm, strip命令的作用

file命令可以查看文件的bit,是不是可執行文件以及該文件的架構,有沒有strip等等。 nm命令可以列出.o,.a,.so中的符號信息,包括諸如符號的值,符號的類型以及符號名稱等等。所謂符號,通常是指定義出來的函數和全局變量等等。“-

原创 C++ 拷貝構造函數淺析

什麼是拷貝構造函數: 拷貝構造函數,顧名思義,就是在拷貝的時候調用的構造函數。 幾個原則: C++ primer p406 :拷貝構造函數是一種特殊的構造函數,具有單個形參,該形參(常用const修飾)是對該類類型的引用。當定義一個新對象

原创 堆與棧,深拷貝與淺拷貝的區別

內存區域結構:                                                         Memory                             ------------------  

原创 Ubuntu18 安裝和配置 mysql

在命令行上輸入命令: sudo apt-get install mysql-server mysql-client   安裝過程中如果沒有提示輸入密碼,參考這個鏈接: https://blog.csdn.net/gulang03/art

原创 LeetCode15-3Sum(C++)

Description Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all

原创 LeetCode1-Two Sum(C++)

Description Given an array of integers, return indices of the two numbers such that they add up to a specific targe

原创 LeetCode7-Reverse Integer(C++)

Description Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example

原创 LeetCode12-Integer to Roman(C++)

Description Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I     

原创 LeetCode13-Roman to Integer(C++)

Description Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I     

原创 C++爲什麼要儘可能地使用const(Effective C++)

當const遇見指針(常量指針與指針常量) 國內的很多教材、教程裏常常提到常量指針和指針常量,很多公司面試的時候也會問到區別。乍一看好像很繞,其實也不難,下面的例子將具體的講解一下。 char greeting[] = "Hell

原创 C++爲什麼要用傳引用常量替換傳值

優勢1 效率高 假設現在有一個Person類作爲基類,還有一個Student類繼承自Person,如下: class Person { public: Person(); virtual ~Person();

原创 LeetCode3-Longest Substring Without Repeating Characters(C++)

Description Given a string, find the length of the longest substring without repeating characters. Example 1: Input

原创 LeetCode5 - Longest Palindromic Substring(C++)

Description: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length