原创 php奇葩錯誤:htmlspecialchars處理中文丟失

$value = "中文中文"; $res = htmlspecialchars($value); 經過這個函數處理之後,$res就直接變成了空的字符串。   奇葩錯誤啊!後來發現要這樣才能成功,以前都沒遇到過呢,奇怪! htmls

原创 使用線程實現視圖平滑滾動

最近一直想做下拉刷新的效果,琢磨了好久,才走到通過onTouch方法把整個視圖往下拉的步驟,接下來就是能拉下來,鬆開手要能滑回去啊。網上看了好久,沒有找到詳細的下拉刷新的例子,只有自己慢慢琢磨了。昨天和今天,研究了兩天,下拉之後回滾回去的

原创 linux自啓動、定時啓動腳本

linux開機自啓動 想讓一個程序、腳本開機自啓動,可以在/etc/rc.d目錄下面找到rc.local文件,編輯該文件,在尾部加上需要運行的命令即可。 如: #cd /etc/rc.d #sudo vim rc.local 我需要讓

原创 一些常用的算法操作,方法與技巧

1.找列表的中點 可以使用快慢指針,一個指針步進1,另一個指針步進2。可用於數組或者鏈表。 對於數組 [1, 2, 3, 4] i1 = 0; // 每次步進1 i2 = 0; // 每次步進2 // 第一次 i1 = 1; i

原创 46. Permutations

TAG: 回溯 原題 Given a collection of distinct integers, return all possible permutations. Example: Input: [1,2,3] Outpu

原创 581. Shortest Unsorted Continuous Subarray

TAG: 數組 原題 Given an integer array, you need to find one continuous subarray that if you only sort this subarray in

原创 406. Queue Reconstruction by Height

TAG: 貪婪 原題 Suppose you have a random list of people standing in a queue. Each person is described by a pair of inte

原创 448. Find All Numbers Disappeared in an Array

Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear onc

原创 線程有哪些狀態?每個狀態是什麼意思?又是如何切換的?

先聲明一下水印問題,一開始公衆號是叫午茶電影,後面我又改了個名字,但是在寫這篇文章的時候,還是原來那個名字,這絕對不是轉載的,因爲你搜wuchastory公衆號,就能搜到我這個。 線程大家都有在使用,但是有時候也僅僅是使用,對它的

原创 746. Min Cost Climbing Stairs

題目 On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you

原创 303. Range Sum Query - Immutable

題目 Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Giv

原创 198. House Robber

題目 You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stas

原创 1038. Binary Search Tree to Greater Sum Tree

題目 https://leetcode.com/problems/binary-search-tree-to-greater-sum-tree/ 這是一道關於二叉樹,二叉搜索樹的題目。 Given the root of a bina

原创 坑!人民幣符號¥爲什麼有時候一根橫線,有時候兩根橫線?

在開發過程中遇到了這個問題,界面上需要顯示一個人民幣符號¥,但別的同事開發的界面,總是顯示兩根橫線,而我開發的界面,有些機器上是兩根,有些機器上是一根。 emmmm… 然後我仔細觀察了一下,發現,同事和我用的是兩個不一樣的字符。 ¥

原创 1008. Construct Binary Search Tree from Preorder Traversal

題目 Return the root node of a binary search tree that matches the given preorder traversal. (Recall that a binary sear