iPhone应用程序取得程序关闭事件的方法
非常简单,在你的AppDelegate对象中实现以下方法
- (void) applicationWillTerminate:(UIApplication *)application {
// 在这里完成程序将要关闭时的事情
}
标签: Objective-c iPhone
非常简单,在你的AppDelegate对象中实现以下方法
- (void) applicationWillTerminate:(UIApplication *)application {
// 在这里完成程序将要关闭时的事情
}
标签: Objective-c iPhone
正式开始转Java了,第一天,语法基础啥的咱都会,直接从做功能开始。先研究怎么用Java连接MySQL吧
代码
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
public class MyTest {
public static void main(String args[]) {
Connection con = null;
try {
// 获得MySQL驱动的实例
Class.forName("com.mysql.jdbc.Driver").newInstance();
// 提供地址用户名密码并获得连接对象
con = DriverManager.getConnection("jdbc:mysql://127.0.0.1/test","root", "123456");
if (!con.isClosed())
// 连接成功提示
System.out.println("Successfully connected to MySQL server using TCP/IP...");
// 有Connection对象创建Statement
Statement st = con.createStatement();
// 运行SQL语句读取
ResultSet rs = st.executeQuery("SELECT * FROM emlog_blog");
// 循环读取数据
while (rs.next()) {
// 打印数据
System.out.println(rs.getString("gid"));
}
// 关闭
con.close();
} catch(Exception e) {
System.err.println("Exception: " + e.getMessage());
}
}
}
要注意的东西有
这个com.mysql.jdbc.的包需要自己去MySQL哪里下载的
下载地址:
http://dev.mysql.com/downloads/connector/j/
下载后把这个包加到Eclipse的libary里面上面的代码才能运行
前不久弄了几套eclipse PDT的暗色代码主题,用的甚是舒服,最近由于工作的需要转换到了Java平台开发,Java这块的代码配色方案又成了新的目标,网上转悠了一圈只发现了一款配色比较符合我胃口,使用的同时并分享之:
主题原作者地址,他的页面上还提供 Visual Studio 的主题哦
http://blog.prabir.me/post/Dark-Eclipse-Theme.aspx
主题包见日志附件
安装步骤如下
1 . 下载附件压缩包,解压缩后启动eclipse。
2 . 选择 File -> Import -> General -> Preferences 再选择压缩包中的eclipse.epf,按着提示一路下一步即可,导入成功即可看到效果。
其实还有其他的样式,但是好多主题对比度太高了我感觉很刺眼就没有截图,但是链接还是贴出来吧
http://qinghe3012.javaeye.com/blog/413317
http://www.blogjava.net/LittleDS/archive/2009/04/17/266231.html
http://utensil.javaeye.com/blog/444590
http://yaou.hailuo.de/archives/53
http://weblogs.manas.com.ar/ary/2009/03/13/black-theme-for-eclipse/
如何让你的CSS既兼容各种浏览器,又可以通过w3c的验证?答案是CSS hack
测试页面在附件压缩包中
标准CSS样式
#style {
color :orange;
}
火狐效果
IE7 独有hack写法
*+html #style{
color :green;
}
表现效果
* html #style {
color :blue;
} /* IE6独有HACK,只有IE6可以理解,后复盖前,所以IE6会使用这个样式 */
W3C CSS 验证
CSS3 验证完美通过
附件下载:
css hack.zip 609字节
标签: css
喜欢Google Chrome的外观又不想抛弃Firefox的易用性?试试Chromifox Extreme这款主题吧
这个主题可以完美的在Firefox上面实现Google Chrome的外观,喜欢的朋友们不要错过了
如果要实现上面效果图中的样式必须安装Hide Caption插件,这样才能完美实现Google Chrome的外观
主题下载地址:
https://addons.mozilla.org/zh-CN/firefox/addon/10674
Hide Caption插件下载地址:
https://addons.mozilla.org/en-US/firefox/addon/9256
标签: FireFox
unserialize的这个问题是由一个emlog论坛用户在使用时报错而发现的
问题表现情况如下:
emlog缓存 的保存方式是将php的数据对象(数组)序列化(serialize)后以文件的形式存放,读取缓存的时候直接反序列化(unserialize)缓存字 符串即可读取数据,关于序列化和反序列化的原理请看我先前的文章《php函数 serialize()与unserialize()不完全研究》
我从用户那里取到的缓存的序列化数据为:
a:1: {s:8:"kl_album";a:4:{s:5:"title";s:12:"精彩瞬 间";s:3:"url";s:41:"http://www.kaisay.cn/?plugin=kl_album";s:8:"is_blank";s:7:"_parent";s:4:"hide";s:1:"n";}}
咋 一看了解序列化的人都会说,这个数据很正常啊,没什么问题呢。可是直接把这段字符串进行unserialize,返回的值却是个False;
代 码
var_dump(unserialize('a:1:{s:8:"kl_album";a:4: {s:5:"title";s:12:"精彩瞬间";s:3:"url";s:41:"http://www.kaisay.cn /?plugin=kl_album";s:8:"is_blank";s:7:"_parent";s:4:"hide";s:1:"n";}}'));
运行结果
在开发中有3台数据库服务器需要访问和管理,用客户端切换太过麻烦,直接用phpmyadmin来解决问题
修改根目录中的config.inc.php配置
$i = 0;
/*
* 服务器A
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '3307';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '123456';
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
/*
* 服务器B
*/
$i++;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '3308';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = ‘123456';
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
/*
* 服务器C
*/
$i++;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '123456';
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
保存,打开phpmyadmin,在首页就可以看到服务器列表了
Fx4 是Firefox 主题库中新的一款实现Firefox3.7样式和布局的主题,效果基本上先前我发现的主题Strata一样,但是细节上做的比Strata要好的多,本主题还可以配合插件Fx4 options来对界面进行自定义配置
主题样式预览:
主题个性配置界面:
Fx4安装地址:
https://addons.mozilla.org/zh-CN/firefox/addon/49178
Fx4 options 安装地址: