DOS批处理中%cd%和%~dp0的区别
输入:echo %cd% ,则显示为:c:dir 。
%cd%的内容是可以被改变的,其内容为命令的执行路径或批处理文件的执行路径。
2.%~dp0只可以用在批处理文件中,它是由它所在的批处理文件的目录位置决定的,是批处理文件所在的盘符:+路径。在执行这个批处理文件的过程中,它展开后的内容是不可以改变的。比如在D盘下有个批处理文件,path.bat,其内容为:
echo this is %%cd%% %cd%
echo this is %%~dp0 %~dp0
SAE未备案域名加速
众所周知,SAE对于未备案的域名比较的不仁慈,访问二级域名还好说,但对于大多数绑定顶级域名而又苦于备案的站长来说,不但得不到SAE的高速,反而变得更慢。虽然通过DNSPOD+加速乐/360DNS等免费资源可以实现双DNS加速,以及开启GZIP对网站改良的措施,对网站速度有了一定的改观,但毕竟使用的是海外代理,速度终究不理想。
网站的速度无论从SEO角度还是用户体验方面来说,都是一个网站不可忽视的要素,相信众多站长长期奔走于对此优化的道路上,由此也引出了一些极其优秀的缓存软件,诸如Hyper Cache、W3 Total Cache、Wp Super Cache这些插件在网站的优化上有着极其优秀的表现,然而对于驻扎在SAE上的用户来说,目录写入权限是不可改变的硬伤。所以这些所谓的加速神器也是爱莫能助了,加之SAE的优化方法少之又少,除了压缩和DNS外似乎别无他法。
本人也是经过长期致力于此,最终发现一个好方法,作为福利共享出来-SAE未备案域名加速插件:
这个插件的作用主要是用来加速SAE未备案域名的访问速度,用创新的方法实现加速:采用的策略是将资源文件通过SAE二级域名进行访问,而将网站主要文件通过主域名访问,进而加快了访问速度。这个插件最初是由SAE云商店用于加速wordpress的访问,当然在SAE上也是可以使用的,由于SAE和云商店环境的细微差异,所以在SAE只需要稍加修改即可使用,下面是已经修改的可以在SAE使用的插件源代码。
<?php if(isset($_SERVER['HTTP_APPNAME'])){ add_filter('pre_option_siteurl','ysd_siteurl'); add_filter('pre_option_home','ysd_home'); add_filter('site_url','ysd_site_url',10,2); add_filter('login_url','ysd_login_url'); add_filter('logout_url','ysd_logout_url'); add_filter('admin_url','ysd_admin_url'); add_action('wp_before_admin_bar_render','ysd_before_admin_bar_render'); add_action('wp_after_admin_bar_render','ysd_after_admin_bar_render'); } function ysd_siteurl(){ return 'index.php'==basename($_SERVER['SCRIPT_FILENAME']) && false===strpos($_SERVER['SCRIPT_FILENAME'], 'wp-admin')?'http://'.substr($_SERVER['HTTP_APPNAME'],5).'.1kapp.com':'http://'.$_SERVER['HTTP_HOST']; } function ysd_home(){ return 'http://'.$_SERVER['HTTP_HOST']; } function ysd_site_url($url,$path){ if(in_array($path,array('wp-login.php?action=register','/wp-comments-post.php'))){ return str_replace('http://'.substr($_SERVER['HTTP_APPNAME'],5).'.1kapp.com', 'http://'.$_SERVER['HTTP_HOST'],$url); }else{ return $url; } } function ysd_before_admin_bar_render(){ ob_start(); } function ysd_after_admin_bar_render(){ echo str_replace('http://'.substr($_SERVER['HTTP_APPNAME'],5).'.1kapp.com', 'http://'.$_SERVER['HTTP_HOST'],ob_get_clean()); } function ysd_login_url($login_url){ return str_replace('http://'.substr($_SERVER['HTTP_APPNAME'],5).'.1kapp.com', 'http://'.$_SERVER['HTTP_HOST'],$login_url); } function ysd_logout_url($logout_url){ return str_replace('http://'.substr($_SERVER['HTTP_APPNAME'],5).'.1kapp.com', 'http://'.$_SERVER['HTTP_HOST'],$logout_url); } function ysd_admin_url($url){ return str_replace('http://'.substr($_SERVER['HTTP_APPNAME'],5).'.1kapp.com', 'http://'.$_SERVER['HTTP_HOST'],$url); } ?>
巨卡无比,经常失灵,这是要换新手机的节奏吗
算了,刷个4.2的老版本的系统试试吧
Welcome to Swift
Welcome to Swift
Swift is a new object-oriented programming language for iOS and OS X development. Swift is modern, powerful, and easy to use.
let people = ["Anna": 67, "Beto": 8, "Jack": 33, "Sam": 25]
for (name, age) in people {
println("(name) is (age) years old.")
}
Safe
Swift pairs increased type safety with type inference, restricts direct access to pointers, and automatically manages memory—making it easy to create secure, stable software.
func configureLabels(labels: [UILabel]) {
let labelTextColor = UIColor.greenColor()
for label in labels {
// label inferred to be UILabel
label.textColor = labelTextColor
}
}
Modern
Swift includes optionals, generics, tuples, and other modern language features. Inspired by and improving upon Objective-C, Swift code feels natural to read and write.
let cities = ["London", "San Francisco", "Tokyo", "Barcelona", "Sydney"]
let sortedCities = sorted(cities) { $0 < $1 }
if let indexOfLondon = find(sortedCities, "London") {
println("London is city number (indexOfLondon + 1) in the list")
}
Powerful
Take advantage of powerful pattern matching in Swift to write simple, expressive code. Format strings naturally with string interpolation. Use frameworks like Foundation and UIKit directly from Swift.
let size = (20, 40)
switch size {
case let (width, height) where width == height:
println("square with sides (width)")
case (1...10, 1...10):
println("small rectangle")
case let (width, height):
println("rectangle with width (width) and height (height)")
}
Interactive
Use playgrounds to experiment with new technologies, analyze problems, and prototype user interfaces.
Fast
The Swift compiler applies advanced code analysis to tune your code for performance, letting you focus on writing great apps instead of on implementing complex optimizations.
The complete guide and reference to the Swift programming language.
-
A Swift Tour
Take an interactive tour of language features that make app development easier, faster, and more reliable.
-
Language Guide
Learn Swift concepts, principles, and syntax through comprehensive descriptions and code examples.
-
Dive into the details of the language with a thorough discussion of its behavior, syntax, and grammar.
Tools and strategies for integrating Swift into the Cocoa app development process.
-
Getting Started
Learn how to interact with Cocoa frameworks in a Swift environment.
-
Take advantage of Swift language features to build on Objective-C APIs, and improve the way you write Cocoa apps.
-
Create a mixed-language app using Swift and Objective-C.
-
Explore strategies to migrate your app to Swift.
近期评论