Framework7,其特色的HTML框架,可以创建精美的iOS应用;  她有自己的 DOM7- 一个集成了大部分常用DOM操作的高性能库。你不需要学习任何新的东西,因为她的用法和大名鼎鼎的jQuery几乎是一样的,包括大部分常用的方法和jquery风格的链式调用。去查看了一下dom7.js的源码,发现非常适合学习;

源码如下:

  1. /*===========================
  2. Dom7 Library
  3. ===========================*/
  4. var Dom7 = (function () {
  5. var Dom7 = function (arr) {
  6. var _this = this, i = 0;
  7. // Create array-like object
  8. for (i = 0; i < arr.length; i++) {
  9. _this[i] = arr[i];
  10. }
  11. _this.length = arr.length;
  12. // Return collection with methods
  13. return this;
  14. };
  15. var $ = function (selector, context) {
  16. var arr = [], i = 0;
  17. if (selector && !context) {
  18. if (selector instanceof Dom7) {
  19. return selector;
  20. }
  21. }
  22. if (selector) {
  23. // String
  24. if (typeof selector === 'string') {
  25. var els, tempParent, html = selector.trim();
  26. if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
  27. var toCreate = 'div';
  28. if (html.indexOf('<li') === 0) toCreate = 'ul';
  29. if (html.indexOf('<tr') === 0) toCreate = 'tbody';
  30. if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
  31. if (html.indexOf('<tbody') === 0) toCreate = 'table';
  32. if (html.indexOf('<option') === 0) toCreate = 'select';
  33. tempParent = document.createElement(toCreate);
  34. tempParent.innerHTML = selector;
  35. for (i = 0; i < tempParent.childNodes.length; i++) {
  36. arr.push(tempParent.childNodes[i]);
  37. }
  38. }
  39. else {
  40. if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) {
  41. // Pure ID selector
  42. els = [document.getElementById(selector.split('#')[1])];
  43. }
  44. else {
  45. // Other selectors
  46. els = (context || document).querySelectorAll(selector);
  47. }
  48. for (i = 0; i < els.length; i++) {
  49. if (els[i]) arr.push(els[i]);
  50. }
  51. }
  52. }
  53. // Node/element
  54. else if (selector.nodeType || selector === window || selector === document) {
  55. arr.push(selector);
  56. }
  57. //Array of elements or instance of Dom
  58. else if (selector.length > 0 && selector[0].nodeType) {
  59. for (i = 0; i < selector.length; i++) {
  60. arr.push(selector[i]);
  61. }
  62. }
  63. }
  64. return new Dom7(arr);
  65. };
  66. Dom7.prototype = {
  67. // Classes and attriutes
  68. addClass: function (className) {
  69. if (typeof className === 'undefined') {
  70. return this;
  71. }
  72. var classes = className.split(' ');
  73. for (var i = 0; i < classes.length; i++) {
  74. for (var j = 0; j < this.length; j++) {
  75. this[j].classList.add(classes[i]);
  76. }
  77. }
  78. return this;
  79. },
  80. removeClass: function (className) {
  81. var classes = className.split(' ');
  82. for (var i = 0; i < classes.length; i++) {
  83. for (var j = 0; j < this.length; j++) {
  84. this[j].classList.remove(classes[i]);
  85. }
  86. }
  87. return this;
  88. },
  89. hasClass: function (className) {
  90. if (!this[0]) return false;
  91. else return this[0].classList.contains(className);
  92. },
  93. toggleClass: function (className) {
  94. var classes = className.split(' ');
  95. for (var i = 0; i < classes.length; i++) {
  96. for (var j = 0; j < this.length; j++) {
  97. this[j].classList.toggle(classes[i]);
  98. }
  99. }
  100. return this;
  101. },
  102. attr: function (attrs, value) {
  103. if (arguments.length === 1 && typeof attrs === 'string') {
  104. // Get attr
  105. if (this[0]) return this[0].getAttribute(attrs);
  106. else return undefined;
  107. }
  108. else {
  109. // Set attrs
  110. for (var i = 0; i < this.length; i++) {
  111. if (arguments.length === 2) {
  112. // String
  113. this[i].setAttribute(attrs, value);
  114. }
  115. else {
  116. // Object
  117. for (var attrName in attrs) {
  118. this[i][attrName] = attrs[attrName];
  119. this[i].setAttribute(attrName, attrs[attrName]);
  120. }
  121. }
  122. }
  123. return this;
  124. }
  125. },
  126. removeAttr: function (attr) {
  127. for (var i = 0; i < this.length; i++) {
  128. this[i].removeAttribute(attr);
  129. }
  130. return this;
  131. },
  132. data: function (key, value) {
  133. if (typeof value === 'undefined') {
  134. // Get value
  135. if (this[0]) {
  136. var dataKey = this[0].getAttribute('data-' + key);
  137. if (dataKey) return dataKey;
  138. else if (this[0].dom7ElementDataStorage && (key in this[0].dom7ElementDataStorage)) return this[0].dom7ElementDataStorage[key];
  139. else return undefined;
  140. }
  141. else return undefined;
  142. }
  143. else {
  144. // Set value
  145. for (var i = 0; i < this.length; i++) {
  146. var el = this[i];
  147. if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};
  148. el.dom7ElementDataStorage[key] = value;
  149. }
  150. return this;
  151. }
  152. },
  153. // Transforms
  154. transform : function (transform) {
  155. for (var i = 0; i < this.length; i++) {
  156. var elStyle = this[i].style;
  157. elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;
  158. }
  159. return this;
  160. },
  161. transition: function (duration) {
  162. if (typeof duration !== 'string') {
  163. duration = duration + 'ms';
  164. }
  165. for (var i = 0; i < this.length; i++) {
  166. var elStyle = this[i].style;
  167. elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;
  168. }
  169. return this;
  170. },
  171. //Events
  172. on: function (eventName, targetSelector, listener, capture) {
  173. function handleLiveEvent(e) {
  174. var target = e.target;
  175. if ($(target).is(targetSelector)) listener.call(target, e);
  176. else {
  177. var parents = $(target).parents();
  178. for (var k = 0; k < parents.length; k++) {
  179. if ($(parents[k]).is(targetSelector)) listener.call(parents[k], e);
  180. }
  181. }
  182. }
  183. var events = eventName.split(' ');
  184. var i, j;
  185. for (i = 0; i < this.length; i++) {
  186. if (typeof targetSelector === 'function' || targetSelector === false) {
  187. // Usual events
  188. if (typeof targetSelector === 'function') {
  189. listener = arguments[1];
  190. capture = arguments[2] || false;
  191. }
  192. for (j = 0; j < events.length; j++) {
  193. this[i].addEventListener(events[j], listener, capture);
  194. }
  195. }
  196. else {
  197. //Live events
  198. for (j = 0; j < events.length; j++) {
  199. if (!this[i].dom7LiveListeners) this[i].dom7LiveListeners = [];
  200. this[i].dom7LiveListeners.push({listener: listener, liveListener: handleLiveEvent});
  201. this[i].addEventListener(events[j], handleLiveEvent, capture);
  202. }
  203. }
  204. }
  205.  
  206. return this;
  207. },
  208. off: function (eventName, targetSelector, listener, capture) {
  209. var events = eventName.split(' ');
  210. for (var i = 0; i < events.length; i++) {
  211. for (var j = 0; j < this.length; j++) {
  212. if (typeof targetSelector === 'function' || targetSelector === false) {
  213. // Usual events
  214. if (typeof targetSelector === 'function') {
  215. listener = arguments[1];
  216. capture = arguments[2] || false;
  217. }
  218. this[j].removeEventListener(events[i], listener, capture);
  219. }
  220. else {
  221. // Live event
  222. if (this[j].dom7LiveListeners) {
  223. for (var k = 0; k < this[j].dom7LiveListeners.length; k++) {
  224. if (this[j].dom7LiveListeners[k].listener === listener) {
  225. this[j].removeEventListener(events[i], this[j].dom7LiveListeners[k].liveListener, capture);
  226. }
  227. }
  228. }
  229. }
  230. }
  231. }
  232. return this;
  233. },
  234. once: function (eventName, targetSelector, listener, capture) {
  235. var dom = this;
  236. if (typeof targetSelector === 'function') {
  237. targetSelector = false;
  238. listener = arguments[1];
  239. capture = arguments[2];
  240. }
  241. function proxy(e) {
  242. listener(e);
  243. dom.off(eventName, targetSelector, proxy, capture);
  244. }
  245. dom.on(eventName, targetSelector, proxy, capture);
  246. },
  247. trigger: function (eventName, eventData) {
  248. for (var i = 0; i < this.length; i++) {
  249. var evt;
  250. try {
  251. evt = new window.CustomEvent(eventName, {detail: eventData, bubbles: true, cancelable: true});
  252. }
  253. catch (e) {
  254. evt = document.createEvent('Event');
  255. evt.initEvent(eventName, true, true);
  256. evt.detail = eventData;
  257. }
  258. this[i].dispatchEvent(evt);
  259. }
  260. return this;
  261. },
  262. transitionEnd: function (callback) {
  263. var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
  264. i, j, dom = this;
  265. function fireCallBack(e) {
  266. /*jshint validthis:true */
  267. if (e.target !== this) return;
  268. callback.call(this, e);
  269. for (i = 0; i < events.length; i++) {
  270. dom.off(events[i], fireCallBack);
  271. }
  272. }
  273. if (callback) {
  274. for (i = 0; i < events.length; i++) {
  275. dom.on(events[i], fireCallBack);
  276. }
  277. }
  278. return this;
  279. },
  280. // Sizing/Styles
  281. width: function () {
  282. if (this[0] === window) {
  283. return window.innerWidth;
  284. }
  285. else {
  286. if (this.length > 0) {
  287. return parseFloat(this.css('width'));
  288. }
  289. else {
  290. return null;
  291. }
  292. }
  293. },
  294. outerWidth: function (includeMargins) {
  295. if (this.length > 0) {
  296. if (includeMargins)
  297. return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));
  298. else
  299. return this[0].offsetWidth;
  300. }
  301. else return null;
  302. },
  303. height: function () {
  304. if (this[0] === window) {
  305. return window.innerHeight;
  306. }
  307. else {
  308. if (this.length > 0) {
  309. return parseFloat(this.css('height'));
  310. }
  311. else {
  312. return null;
  313. }
  314. }
  315. },
  316. outerHeight: function (includeMargins) {
  317. if (this.length > 0) {
  318. if (includeMargins)
  319. return this[0].offsetHeight + parseFloat(this.css('margin-top')) + parseFloat(this.css('margin-bottom'));
  320. else
  321. return this[0].offsetHeight;
  322. }
  323. else return null;
  324. },
  325. offset: function () {
  326. if (this.length > 0) {
  327. var el = this[0];
  328. var box = el.getBoundingClientRect();
  329. var body = document.body;
  330. var clientTop = el.clientTop || body.clientTop || 0;
  331. var clientLeft = el.clientLeft || body.clientLeft || 0;
  332. var scrollTop = window.pageYOffset || el.scrollTop;
  333. var scrollLeft = window.pageXOffset || el.scrollLeft;
  334. return {
  335. top: box.top + scrollTop - clientTop,
  336. left: box.left + scrollLeft - clientLeft
  337. };
  338. }
  339. else {
  340. return null;
  341. }
  342. },
  343. css: function (props, value) {
  344. var i;
  345. if (arguments.length === 1) {
  346. if (typeof props === 'string') {
  347. if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
  348. }
  349. else {
  350. for (i = 0; i < this.length; i++) {
  351. for (var prop in props) {
  352. this[i].style[prop] = props[prop];
  353. }
  354. }
  355. return this;
  356. }
  357. }
  358. if (arguments.length === 2 && typeof props === 'string') {
  359. for (i = 0; i < this.length; i++) {
  360. this[i].style[props] = value;
  361. }
  362. return this;
  363. }
  364. return this;
  365. },
  366.  
  367. //Dom manipulation
  368. each: function (callback) {
  369. for (var i = 0; i < this.length; i++) {
  370. callback.call(this[i], i, this[i]);
  371. }
  372. return this;
  373. },
  374. html: function (html) {
  375. if (typeof html === 'undefined') {
  376. return this[0] ? this[0].innerHTML : undefined;
  377. }
  378. else {
  379. for (var i = 0; i < this.length; i++) {
  380. this[i].innerHTML = html;
  381. }
  382. return this;
  383. }
  384. },
  385. is: function (selector) {
  386. if (!this[0]) return false;
  387. var compareWith, i;
  388. if (typeof selector === 'string') {
  389. var el = this[0];
  390. if (el === document) return selector === document;
  391. if (el === window) return selector === window;
  392.  
  393. if (el.matches) return el.matches(selector);
  394. else if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
  395. else if (el.mozMatchesSelector) return el.mozMatchesSelector(selector);
  396. else if (el.msMatchesSelector) return el.msMatchesSelector(selector);
  397. else {
  398. compareWith = $(selector);
  399. for (i = 0; i < compareWith.length; i++) {
  400. if (compareWith[i] === this[0]) return true;
  401. }
  402. return false;
  403. }
  404. }
  405. else if (selector === document) return this[0] === document;
  406. else if (selector === window) return this[0] === window;
  407. else {
  408. if (selector.nodeType || selector instanceof Dom7) {
  409. compareWith = selector.nodeType ? [selector] : selector;
  410. for (i = 0; i < compareWith.length; i++) {
  411. if (compareWith[i] === this[0]) return true;
  412. }
  413. return false;
  414. }
  415. return false;
  416. }
  417.  
  418. },
  419. index: function () {
  420. if (this[0]) {
  421. var child = this[0];
  422. var i = 0;
  423. while ((child = child.previousSibling) !== null) {
  424. if (child.nodeType === 1) i++;
  425. }
  426. return i;
  427. }
  428. else return undefined;
  429. },
  430. eq: function (index) {
  431. if (typeof index === 'undefined') return this;
  432. var length = this.length;
  433. var returnIndex;
  434. if (index > length - 1) {
  435. return new Dom7([]);
  436. }
  437. if (index < 0) {
  438. returnIndex = length + index;
  439. if (returnIndex < 0) return new Dom7([]);
  440. else return new Dom7([this[returnIndex]]);
  441. }
  442. return new Dom7([this[index]]);
  443. },
  444. append: function (newChild) {
  445. var i, j;
  446. for (i = 0; i < this.length; i++) {
  447. if (typeof newChild === 'string') {
  448. var tempDiv = document.createElement('div');
  449. tempDiv.innerHTML = newChild;
  450. while (tempDiv.firstChild) {
  451. this[i].appendChild(tempDiv.firstChild);
  452. }
  453. }
  454. else if (newChild instanceof Dom7) {
  455. for (j = 0; j < newChild.length; j++) {
  456. this[i].appendChild(newChild[j]);
  457. }
  458. }
  459. else {
  460. this[i].appendChild(newChild);
  461. }
  462. }
  463. return this;
  464. },
  465. prepend: function (newChild) {
  466. var i, j;
  467. for (i = 0; i < this.length; i++) {
  468. if (typeof newChild === 'string') {
  469. var tempDiv = document.createElement('div');
  470. tempDiv.innerHTML = newChild;
  471. for (j = tempDiv.childNodes.length - 1; j >= 0; j--) {
  472. this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
  473. }
  474. // this[i].insertAdjacentHTML('afterbegin', newChild);
  475. }
  476. else if (newChild instanceof Dom7) {
  477. for (j = 0; j < newChild.length; j++) {
  478. this[i].insertBefore(newChild[j], this[i].childNodes[0]);
  479. }
  480. }
  481. else {
  482. this[i].insertBefore(newChild, this[i].childNodes[0]);
  483. }
  484. }
  485. return this;
  486. },
  487. insertBefore: function (selector) {
  488. var before = $(selector);
  489. for (var i = 0; i < this.length; i++) {
  490. if (before.length === 1) {
  491. before[0].parentNode.insertBefore(this[i], before[0]);
  492. }
  493. else if (before.length > 1) {
  494. for (var j = 0; j < before.length; j++) {
  495. before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
  496. }
  497. }
  498. }
  499. },
  500. insertAfter: function (selector) {
  501. var after = $(selector);
  502. for (var i = 0; i < this.length; i++) {
  503. if (after.length === 1) {
  504. after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
  505. }
  506. else if (after.length > 1) {
  507. for (var j = 0; j < after.length; j++) {
  508. after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
  509. }
  510. }
  511. }
  512. },
  513. next: function (selector) {
  514. if (this.length > 0) {
  515. if (selector) {
  516. if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) return new Dom7([this[0].nextElementSibling]);
  517. else return new Dom7([]);
  518. }
  519. else {
  520. if (this[0].nextElementSibling) return new Dom7([this[0].nextElementSibling]);
  521. else return new Dom7([]);
  522. }
  523. }
  524. else return new Dom7([]);
  525. },
  526. nextAll: function (selector) {
  527. var nextEls = [];
  528. var el = this[0];
  529. if (!el) return new Dom7([]);
  530. while (el.nextElementSibling) {
  531. var next = el.nextElementSibling;
  532. if (selector) {
  533. if($(next).is(selector)) nextEls.push(next);
  534. }
  535. else nextEls.push(next);
  536. el = next;
  537. }
  538. return new Dom7(nextEls);
  539. },
  540. prev: function (selector) {
  541. if (this.length > 0) {
  542. if (selector) {
  543. if (this[0].previousElementSibling && $(this[0].previousElementSibling).is(selector)) return new Dom7([this[0].previousElementSibling]);
  544. else return new Dom7([]);
  545. }
  546. else {
  547. if (this[0].previousElementSibling) return new Dom7([this[0].previousElementSibling]);
  548. else return new Dom7([]);
  549. }
  550. }
  551. else return new Dom7([]);
  552. },
  553. prevAll: function (selector) {
  554. var prevEls = [];
  555. var el = this[0];
  556. if (!el) return new Dom7([]);
  557. while (el.previousElementSibling) {
  558. var prev = el.previousElementSibling;
  559. if (selector) {
  560. if($(prev).is(selector)) prevEls.push(prev);
  561. }
  562. else prevEls.push(prev);
  563. el = prev;
  564. }
  565. return new Dom7(prevEls);
  566. },
  567. parent: function (selector) {
  568. var parents = [];
  569. for (var i = 0; i < this.length; i++) {
  570. if (selector) {
  571. if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
  572. }
  573. else {
  574. parents.push(this[i].parentNode);
  575. }
  576. }
  577. return $($.unique(parents));
  578. },
  579. parents: function (selector) {
  580. var parents = [];
  581. for (var i = 0; i < this.length; i++) {
  582. var parent = this[i].parentNode;
  583. while (parent) {
  584. if (selector) {
  585. if ($(parent).is(selector)) parents.push(parent);
  586. }
  587. else {
  588. parents.push(parent);
  589. }
  590. parent = parent.parentNode;
  591. }
  592. }
  593. return $($.unique(parents));
  594. },
  595. find : function (selector) {
  596. var foundElements = [];
  597. for (var i = 0; i < this.length; i++) {
  598. var found = this[i].querySelectorAll(selector);
  599. for (var j = 0; j < found.length; j++) {
  600. foundElements.push(found[j]);
  601. }
  602. }
  603. return new Dom7(foundElements);
  604. },
  605. children: function (selector) {
  606. var children = [];
  607. for (var i = 0; i < this.length; i++) {
  608. var childNodes = this[i].childNodes;
  609.  
  610. for (var j = 0; j < childNodes.length; j++) {
  611. if (!selector) {
  612. if (childNodes[j].nodeType === 1) children.push(childNodes[j]);
  613. }
  614. else {
  615. if (childNodes[j].nodeType === 1 && $(childNodes[j]).is(selector)) children.push(childNodes[j]);
  616. }
  617. }
  618. }
  619. return new Dom7($.unique(children));
  620. },
  621. remove: function () {
  622. for (var i = 0; i < this.length; i++) {
  623. if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
  624. }
  625. return this;
  626. },
  627. add: function () {
  628. var dom = this;
  629. var i, j;
  630. for (i = 0; i < arguments.length; i++) {
  631. var toAdd = $(arguments[i]);
  632. for (j = 0; j < toAdd.length; j++) {
  633. dom[dom.length] = toAdd[j];
  634. dom.length++;
  635. }
  636. }
  637. return dom;
  638. }
  639. };
  640. $.fn = Dom7.prototype;
  641. $.unique = function (arr) {
  642. var unique = [];
  643. for (var i = 0; i < arr.length; i++) {
  644. if (unique.indexOf(arr[i]) === -1) unique.push(arr[i]);
  645. }
  646. return unique;
  647. };
  648.  
  649. return $;
  650. })();

Dom7.js 源码阅读备份的更多相关文章

  1. flipsnap.js 源码阅读备份

    这是官网:http://hokaccha.github.io/js-flipsnap/ 1.引入全局命名空间 类似jQuery插件写法   传入window, document,提高内部访问速度: ; ...

  2. Three.js源码阅读笔记-5

    Core::Ray 该类用来表示空间中的“射线”,主要用来进行碰撞检测. THREE.Ray = function ( origin, direction ) { this.origin = ( or ...

  3. underscore.js 源码阅读 准备

    本次阅读是初次阅读源码,参考了以下几篇文章: https://github.com/hanzichi?language=javascript&page=5&tab=stars http ...

  4. fastclick 源码阅读备份

    ;(function () { 'use strict'; //构造函数 function FastClick(layer, options) { var oldOnClick; options = ...

  5. zepto.js 源码注释备份

    /* Zepto v1.0-1-ga3cab6c - polyfill zepto detect event ajax form fx - zeptojs.com/license */ ;(funct ...

  6. jquery.unobtrusive-ajax.js源码阅读

    /*! ** Unobtrusive Ajax support library for jQuery ** Copyright (C) Microsoft Corporation. All right ...

  7. underscore.js,jquery.js源码阅读

    (function() { // Baseline setup // -------------- // Establish the root object, `window` in the brow ...

  8. underscore.js 源码阅读 一 整体结构

    // 整个underscore的实现包在一个立即执行函数中,避免污染全局对象 // 通过call(this)来入全局变量 (function() { // 缓存this var root = this ...

  9. 【 js 基础 】【 源码学习 】backbone 源码阅读(一)

    最近看完了 backbone.js 的源码,这里对于源码的细节就不再赘述了,大家可以 star 我的源码阅读项目(https://github.com/JiayiLi/source-code-stud ...

随机推荐

  1. hadoop ,传智播客目录

    一.Hadoop入门,了解什么是Hadoop 1.Hadoop产生背景 2.Hadoop在大数据.云计算中的位置和关系 3.国内外Hadoop应用案例介绍 4.国内Hadoop的就业情况分析及课程大纲 ...

  2. C# 通信学习笔记

    C# 通信学习笔记 DNS 是域名系统 (Domain Name System) 的缩写,是因特网的一项核心服务,它作为可以将域名和IP地址相互映射的一个分布式数据库,能够使人更方便的访问互联网,而不 ...

  3. Windows phone 8 学习笔记(5) 图块与通知

    原文:Windows phone 8 学习笔记(5) 图块与通知 基于metro风格的Windows phone 8 应用提到了图块的概念,它就是指启动菜单中的快速启动图标.一般一个应用必须有一个默认 ...

  4. hdu 动态规划(46道题目)倾情奉献~ 【只提供思路与状态转移方程】(转)

    HDU 动态规划(46道题目)倾情奉献~ [只提供思路与状态转移方程] Robberies http://acm.hdu.edu.cn/showproblem.php?pid=2955      背包 ...

  5. Python3.2官方文档-日志和弱引用

    8.5 日志 Logging模块提供了一些功能全面和灵活的日志系统.最简单的形式就是把日志信息发送到一个文件或sys.stderr; import logging logging.debug('Deb ...

  6. ListView IllegalStateException

    贴出源代码: android.widget.ListView ... if(mItemCount == 0){ resetList(); invokeOnItemScrollListener(); r ...

  7. (hdu step 7.1.3)Lifting the Stone(求凸多边形的重心)

    题目: Lifting the Stone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...

  8. 初识google多语言通信框架gRPC系列(一)概述

    gRPC概述 3/26/2016 9:16:08 AM 目录 一.概述 二.编译gRPC 三.C#中使用gRPC 四.C++中使用gRPC 一直在寻找多平台多语言的通信框架,微软的WCF框架很强大和灵 ...

  9. Swift基础--使用TableViewController自己定义列表

    首先建立一个swift项目,把storyboard的内容删掉,加入一个Navigation Controller.然后设置storyboard相应界面的class,在Navigation Contro ...

  10. ubuntu中KDE与GNOME安装切换

    转载:http://apps.hi.baidu.com/share/detail/18919303 1.在Ubuntu中安装KDE桌面命令 sudo apt-get install kUbuntu-d ...