分类 生活 下的文章

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.")
  • }

 


The Swift Programming Language

The complete guide and reference to the Swift programming language.

  • Take an interactive tour of language features that make app development easier, faster, and more reliable.

  • 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.

Using Swift with Cocoa and Objective-C

Tools and strategies for integrating Swift into the Cocoa app development process.

  • 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.

运行在SAE上的WordPress修改Storage地址的方法

找到wp-includes/functions.php在大约第1714行找到

1 $url 'http://' $_SERVER['HTTP_APPNAME'] . '-'.SAE_STORAGE.'.stor.sinaapp.com'.SAE_DIR;

‘.stor.sinaapp.com’替换为‘.stor.vipsinaapp.com’
保存,覆盖。
只是这样子还不行,原来的图片还是使用*.stor.sinaapp.com的地址,我们需要进去PHPMYADMIN,执行

1 UPDATE wp_posts SET post_content = replace(post_content, 'http://***.stor.sinaapp.com','http://***.stor.vipsinaapp.com')

其中:’http://***.stor.sinaapp.com’替换成你原来的Storage地址,’http://***.stor.vipsinaapp.com’替换成现在的Storage地址。
然后看看自己主题以及插件中是否调用了原来的Storage地址,修改过来即可。

收集Bing背景图片

本例是用Python Image Library(PIL)的Image模块进行图片处理,并把保存的图片设置成桌面。在此之前,当然还是要用urllib取得网站的response。
PIL 是Python下最有名的影像处理套件,由许多不同的模块所组成,并且提供了许多的处理功能,允许我们在简单的Python程序里进行影像的处理。 使用像 PIL 这样的程序库套件可以帮助我们把精力集中在影像处理的工作本身,避免迷失在底层的算法里面。由于影像处理牵涉到了大量的数学运算,因此PIL中有許多的模块是用 C 语言所写成的,以提升处理的效率。
详细参考请看这里。
当我们使用微软的Bing的时候,会发现每天背景图片都是不一样的,但每张都很漂亮。鉴于最近在学习python,就萌生了获取每日Bing图片的想法,代码取自网上,我只是做了分析。
如果想看以前的,到Bing Image Archive来看,如果想下载请使用Bing Downloader
工作步骤:
  1. 取得Bing的response,分析一下Bing主页的源代码,有var g_img={url:’/fd/hpk2/ShuBrocade_ZH-CN760216482.jpg’,id:’bgDiv’,d:200,cN:’_SS’,crN:’bIm’,hash:’648′};sc_bgL(),在这里就是需要取得背景图片的地方。因为整个源代码只有这一处,所以可以用index(‘ ‘g_img={url:‘)的方法去过滤背景图片的地址:content = urllib.urlopen(‘http://cn.bing.com/’).read()
    tempStr = content[content.index(‘g_img={url:’)+12 : len(content)]
    tempStr = tempStr[0 : tempStr.index(‘,id:’)-1]
    tempStr = tempStr.replace(”, ”)
    bgImageUrl = ‘http://cn.bing.com’+tempStr
  2. 下载图片的时候,使用urlretrieve(url, filename=None, reporthook=None, data =None)
  3. 使用win32gui.SystemParametersInfo(Action, Param, WinIni)

移植SAE的经验(未完成)

首先,我要知道SAE与传统主机服务方式不同,SAE的代码空间是目录没有写入权限,所有需要上传的图片等内容都应该上传到Storage。也就是说,无论我们要移植的CMS、Blog、BBS的程序,还是插件,所有的上传功能均不可使用。有许多的程序自带安装的向导,绝大多数不能正常使用,其主要原因还是因为代码空间没有写入权限,以至于安装向导不能自动的修改数据库连接文件。

如果安装向导不能正常工作,可以现在本地环境进行安装,将代码传至代码空间,备份本地MySQL,还原至SAE的MySQL,修改数据库连接文件

用户名 SAE_MYSQL_USER
密  码 SAE_MYSQL_PASS
主库域名 SAE_MYSQL_HOST_M
从库域名 SAE_MYSQL_HOST_S
端  口 SAE_MYSQL_PORT
数据库名 SAE_MYSQL_DB

 

阅读剩余部分 –

2025 年 5 月
 1234
567891011
12131415161718
19202122232425
262728293031  

广告

分类

近期评论

标签

历史上的今天

归档