jfo planet

Hope is the best gift that tomorrow gives.

  • 首页
  • 分类
  • 归档
  • 标签
  • 搜索
close

The 11 JavaScript Mistakes you’re Making

发表于 2011-06-13   |   分类于 python/js/php/html/mysql/http
http://net.tutsplus.com/tutorials/javascript-ajax/the-10-javascript-mistakes-youre-making/节选了一部分 Mistake 2 - You’re Not Using SemicolonsFor example, look at this simple function:function returnPerson (name) {      return      {          name : name      };  }  This looks like it should return a cute little object … but in reality, the JavaScript compiler assumes you meant to put a semicolon after retu ...
阅读全文 »

HTML5 in 5 minutes

发表于 2011-06-13   |   分类于 python/js/php/html/mysql/http
HTML5 in 5 minutes:http://v.youku.com/v_show/id_XMjc1NjAwMDI0.html
阅读全文 »

New Tricks in XMLHttpRequest2

发表于 2011-06-11   |   分类于 python/js/php/html/mysql/http
 http://www.html5rocks.com/en/tutorials/file/xhr2/ IntroductionOne of the unsung heros in the HTML5 universe is XMLHttpRequest. Strictly speaking XHR2 isn’t HTML5. However, it’s part of the incremental improvements browser vendors are making to the core platform. I’m including XHR2 in our new bag of goodies because it plays such an integral part in today’s complex web apps.Turns out our old friend got a huge makeover but many folks are unaware of its new features. XMLHttpRequest L ...
阅读全文 »

JavaScript Equality (==) and Identity (===)

发表于 2011-06-11   |   分类于 python/js/php/html/mysql/http
The following rules are used to determine whether two values are identical according to the ===operator: If the two values have different types, they are not identical. If both values are numbers and have the same value, they are identical, unless either or both values are NaN, in which case they are not identical. The NaN value is never identical to any other value, including itself! To check whether a value is NaN, use the global isNaN( )function. If both values are strings and contain exactl ...
阅读全文 »

websocket与node.js的完美结合

发表于 2011-06-10   |   分类于 python/js/php/html/mysql/http
原文:http://cnodejs.org/blog/?p=273之所以写下此文,是我觉得越是简单的技术往往能发挥越重要的作用,随着各种新的技术的诞生,实时web技术已经走进我们。websocket和node.js使开发实时应用非常简单,同时性能也非常高。关于websocketwebsocket是html5的重要feature,它直接在浏览器上对与socket的支持,这给了web开发无限的想象,虽然以前也有flashsocket+js的实现,不过毕竟不稳定,而且兼容性有很多问题,当然websocket的普及也依赖于支持html5标准的浏览器的更新,目前只有chrome、safari、firefox4.0等少数浏览器可以支持,不过大势所驱,加上智能移动设备的普及,websocket可以有更大的作为。他解决了web实时化的问题,相比传统http有如下好处:一个WEB客户端只建立一个TCP连接 Websocket服务端可以推送(push)数据到web客户端.有更加轻量级的头,减少数据传送量本文来重点来分析下。websocket的原理和应用在继续本文之前,让我们了解下websocket的原理 ...
阅读全文 »

关于JavaScript的单线程模型

发表于 2011-06-10   |   分类于 python/js/php/html/mysql/http
JS的执行原理:js引擎执行js代码的时候是单线程的,即同一时刻只会有一个进程执行JS代码,回调函数也是一个一个执行的(按照事件发生的顺序,而不是代码的顺序)。JS中的异步通信和定时是由另外的线程实现的,脱离js线程上下文。以JS定时操作举例,当JS引擎执行setTimeout(callbackFunction,100)操作时,它会通知定时线程我需要100毫秒的定时,之后JS引擎进入事件循环。100毫秒之后,定时引擎向事件队列中加入一个时间已到的事件。JS引擎从队列中读取时间已到的事件,执行callbackFunction。如果同一时间有多个事件加入事件队列,JS引擎也只会一个一个的执行callback。对于异步也是同样,JS代码发起通信请求,通信线程执行通信操作,并在操作完成后将完成事件加入事件队列。JS引擎从队列中取出事件并调用回调处理通信结果。JS引擎在执行回调函数的时候,不能同时响应其他事件。 下面两幅图能很直观的说明问题:  参考: http://www.phpv.net/html/1700.htmlhttp://www.grati.org/? ...
阅读全文 »

JS实现 File Download

发表于 2011-06-03   |   分类于 python/js/php/html/mysql/http
problem:Ajax is inable to receive a response in any form but text. Since it is now common for web applications to offer options for exporting your data in desktop app formats — such as .doc or .xls 方法一: http://www.filamentgroup.com/lab/jquery_plugin_for_requesting_ajax_like_file_downloads/jQuery.download = function(url, data, method){//url and data options requiredif( url && data ){ //data can be string of parameters or array/objectdata = typeof data == ‘string’ ? da ...
阅读全文 »

Android换肤

发表于 2011-05-14   |   分类于 Android
 http://www.eoeandroid.com/forum-viewthread-tid-73500-extra-page%3D1%26orderby%3Ddateline.html一个apk应用访问另一个apk包中的资源,可以实现换肤。ps: 在AndroidManifest.xml中设置sharedUserId @Overridepublic void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentView(R.layout.main);    Context friendContext = null;    try {        friendContext = this.createPackageContext(     ...
阅读全文 »

动态编译Java源文件(介绍)

发表于 2011-05-13   |   分类于 Java
http://www.iteye.com/topic/608485 通过JavaCompiler进行编译都是在当前目录下生成.class文件,而使用编译选项可以改变这个默认目录。编译选项是一个元素为String类型的Iterable集合。如我们可以使用如下代码在D盘根目录下生成.class文件。 Iterable options = Arrays.asList("-d", "d:\");JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager,diagnostics, options, null, compilationUnits);  006 年底,Sun 公司发布了 Java StandardEdition 6(Java SE 6)的最终正式版,代号 Mustang(野马)。跟 Tiger(Java SE 5)相比,Mustang在性能方面有了不错的提升。与 Tiger 在 API 库方面的大幅度加强相比,虽然 Mus ...
阅读全文 »

动态编译Java源文件(code)

发表于 2011-05-13   |   分类于 Java
http://www.infoq.com/cn/articles/cf-java-byte-codeimport java.io.IOException;import java.lang.reflect.InvocationTargetException;import java.lang.reflect.Method;import java.net.URI;import java.net.URISyntaxException;import java.util.Arrays;import javax.tools.DiagnosticCollector;import javax.tools.JavaCompiler;import javax.tools.JavaFileObject;import javax.tools.SimpleJavaFileObject;import javax.tools.StandardJavaFileManager;import javax.tools.ToolProvider;import javax.tools.JavaCompiler.Compilat ...
阅读全文 »
1…151617…61
jfo

jfo

605 日志
38 分类
4 标签
RSS
GitHub 微博
友情链接
  • 收藏夹
  • 网络剪贴板
  • 爱逛吧
© 2007 - 2018 jfo
由 Hexo 强力驱动
主题 - NexT.Pisces