2013年4月13日

规则9 减少DNS查找

摘要: 1. DNS DNS就是URL和实际宿主服务器之间的一个间接层,将主机名映射到IP地址上。 如果一个服务器被另外一个具有不同IP地址的服务器替代了,DNS允许用户用同样的主机名来连接到新的服务器。可以将多个IP地址关联到一个主机名,为网站提供高冗余度。2. DNS和TTL a. DNS可以被DNS服务器(ISP或局域网的一台特殊的缓存服务器)、操作系统、浏览器缓存; b. 只要浏览器在其缓存中保留了DNS记录,就无需请求操作系统。浏览器丢弃该记录时,就会向操作系统询问IP地址,操作系统或者通过其DNS缓存响应,或者将请求发送给远程DNS服务器; c. 考虑到IP地址变化以及缓存会消耗... 阅读全文

posted @ 2013-04-13 15:06 BigPalm 阅读(419) 评论(0) 推荐(0) 编辑

Newton method

摘要: 1. Guide Let'snow talk about a different algorithm for minimizing l(θ).2.Newton method To get us started, lets consider Newton’s method for finding a zero of afunction. Specifically, suppose we have some function f : R → R, and wewish to find a value of θ so that f(θ) = 0. Here, θ ∈ R is a real 阅读全文

posted @ 2013-04-13 12:14 BigPalm 阅读(269) 评论(0) 推荐(0) 编辑

The perceptron learning algorithm

摘要: 1. Guide Consider modifying the logistic regression method to “force” it tooutput values that are either 0 or 1 or exactly. To do so, it seems natural tochange the definition of g to be the threshold function: If we then let h(x) = g(θT x) as before but using this modified definition ofg,... 阅读全文

posted @ 2013-04-13 11:46 BigPalm 阅读(265) 评论(0) 推荐(0) 编辑

Classification and logistic regression

摘要: 1. Guide Classification:This is just like the regressionproblem, except that the values y we now want to predict take on onlya small number of discrete values. For now, we will focus on the binaryclassification problem in which y can take on only two values, 0 and 1.0 is also called the negative c.. 阅读全文

posted @ 2013-04-13 11:32 BigPalm 阅读(377) 评论(0) 推荐(0) 编辑

Locally weighted linear regression

摘要: 1. Guide The leftmost figure shows the result of fitting ay = θ0 + θ1x1 to a dataset.We see that the datadoesn’t really lie on straight line, and so the fit is not very good. This is called underfitting.---there is only one feature, it's too few. So, we add an extra feature x12, and fity =... 阅读全文

posted @ 2013-04-13 10:39 BigPalm 阅读(519) 评论(0) 推荐(0) 编辑

Probabilisic interpretaion

摘要: 1. Guide When faced with a regression problem, why might linear regression, andspecifically why might the least-squares cost function J, be a reasonablechoice? In this section, we will give a set of probabilistic assumptions, underwhich least-squares regression is derived as a very natural algorith. 阅读全文

posted @ 2013-04-13 09:44 BigPalm 阅读(186) 评论(0) 推荐(0) 编辑

2013年4月12日

规则8 使用外部JavaScript和CSS

摘要: 1. 内联 VS 外置 a. 纯粹而言,内联快点,因为内联的组件http请求少,虽然合一并行下载组件,但总之外置要慢; b. 然而由于JavaScript和CSS外部文件可以被缓存,HTML文档的大小减小,而且不会增加HTTP请求的数量; c. 比较依赖于页面查看(一次会话查看次数和查看周期)、空缓存VS完整缓存、组件重用。2. 组件重用---JavaScript和CSS作为外部文件可以被组件重用 a. 为每个页面提供一组分离的外部文件---每个页面都要强制用户使用另外一组外部组件并产生HTTP请求;(一般一次会话只访问网站一个页面) b. 创建一个单独的、联合所有的JavaScri... 阅读全文

posted @ 2013-04-12 22:37 BigPalm 阅读(253) 评论(0) 推荐(0) 编辑

规则7 避免CSS表达式

摘要: 1. CSS表达式: CSS expressions only work in Internet Explorer background-color: expression((new Date()).getHours()%2 ?"#B8D4FF" :"#F08A00"); expression方法接受一个JavaScript表达式,CSS属性将被设置为对js表达式进行求值得结果。 expression被其他浏览器忽略,但却是IE浏览器创建跨浏览器有效方法。 IE不支持min-width, 可以这样: width: expression(document. 阅读全文

posted @ 2013-04-12 20:54 BigPalm 阅读(146) 评论(0) 推荐(0) 编辑

规则6 将脚本放在底部

摘要: 1. 脚本下载时,将阻塞 后面内容的呈现 和 后面组件的下载 。因为脚本可能会使用document.write来修改页面内容,因此浏览器会等待,以确保页面能恰当地布局;还有一个原因是确保脚本的执行顺序。2. 并行下载 HTTP1.1 建议浏览器从每个主机名并行的下载两个组件,IE和Firefox都遵守这一建议,但可以修改浏览器配置; 也可以通过使用CNAME(DNS别名)来讲组件分别放到多个主机名中,Yahoo!研究表明,使用2个主机名比使用1,4,或10和主机名性能更好; 脚本下载会阻塞并行下载和页面呈现,执行时会阻塞页面呈现。3. 最佳情况:将脚本放在底部 defer属性指定不需要... 阅读全文

posted @ 2013-04-12 19:12 BigPalm 阅读(175) 评论(0) 推荐(0) 编辑

规则5 将样式表放在顶部

摘要: 1. 组件(图片、样式表、脚本等等)是呈现页面所必须的,组件通常是按照在文档出现的顺序下载的。2. 样式表在页面中的位置并不影响下载时间,但是会影响页面的呈现。 如果样式表仍在加载,构建呈现树就是一种浪费,因为在所有样式表加载并解析完毕之前无需绘制任何东西。否则,在其准备好之前显示内容就会遇到FOUC(无样式内容闪烁)问题。 样式表放在文档底部时,IE针对以下三种情况会用白屏代替闪烁: a. 在新窗口中打开时; b. 重新加载时; c. 作为主页。3. @import会造成组件无序下载,从而可能会引起闪烁和白屏,用link不会出现问题。 HTML规范:和A不一样,<link>只能出 阅读全文

posted @ 2013-04-12 18:59 BigPalm 阅读(177) 评论(0) 推荐(0) 编辑

导航