大海Online的博客

Looking for Interest

html5版仙剑

刚学习html5时, 为了练手, 基于html5写了版仙剑, 试玩点击这里 或 github

当时花了不少心血, 也解决了不少算法问题, 可用度80%, 然而后来比较忙, 就停止了

今天心血来潮, 在服务器上重新部署了一套, 欢迎试用 (图片点击右键, 新窗口打开)

xianjian

刚开始下载时, 速度有点慢, 请耐心等待, 后续再更改算法, 如果本地玩, 可以git clone哦~~

about octopress

一直以来, 都使用javaeye来记录博客, 见 http://seavers.iteye.com/, 偶有心得, 必记录之

然, 随着时间积累, 发现只依赖博客, 很多的需求无法满足, 如一个DEMO, 一个作品, 甚至是自定义样式 每遇新技术时, 总想折腾下, 无奈博客只能写写文字, 不能充分自主设计 现在好了, 服务器,域名 都已经OK了, 开始折腾了~~~

不过, 博客还是要先建起来, 前段时间, 曾折腾过 jekyll , 却半途而废了 今天突然发现 http://www.ithans.com 改用 octopress 了, 尝试了下

发现 octopress 是基于ruby 写的, 还是挺好用的

rake --help
rake --tasks
rake new_post[title]
rake generate
rake deploy

后续试试自动化, 外加git同步, 自动部署至服务器

小清新网站标准

小清新网站标准 纯属YY

  • 采用微博登录
  • 提供iphone,android,html5版本
  • 采用小新清设计原则: 色块背景, 图文混排, 配色明亮, 合适留白
  • 新删改采用ajax请求, 支持滚动式翻页
  • restful url
  • icon式文字, 文字式按钮
  • 赞, 评论, 分享, 收藏, 加关注

wget 整站下载

下载整站

wget -r -nv --restrict-file-names=nocontrol http://seavers.iteye.com/

下载时可以加 -np, 不下载父目录

wget -r -nv --restrict-file-names=nocontrol -np http://seavers.iteye.com/blog/

下载时, 加入断点续传

wget -r -nv -c --restrict-file-names=nocontrol http://seavers.iteye.com/
  • –restrict-file-names=nocontrol 用来解决中文乱码问题

  • http://aotee.com/using-wget-recursive-download-the-entire-station
  • http://www.cnblogs.com/lybeta/archive/2012/05/23/2514759.html
  • http://blog.csdn.net/flyskywhy/article/details/7777972
  • http://www.butian.org/knowledge/linux/254.html

ubuntu ipconfig

sudo vi /sbin/ipconfig

#! /bin/bash
for word in `ifconfig eth0 | grep "inet addr" | sed  's/          inet addr/addr/g'`; do echo $word | sed 's/:/\t/g'; done
route -n | awk '/UG/ {printf "gateway    %-21s %s\n", $2,$8}' ;
grep nameserver /etc/resolv.conf ;
sudo chmod +x /sbin/ipconfig

ipconfig


待改进

  • 支持eth0 与 wlan0
  • 支持dnsmasq

ubuntu 注册 wins

以下是为了让ubuntu进入windows网络,实现互ping,互连

  1. ubuntu进入windows网络,必须安装samba
    sudo apt-get install samba
    
  2. 修改/etc/samba/smb.conf, 将wins server修改为正确的ip 可以在windows上, 敲入ipconfig /all得到具体ip
  3. 重启服务
    sudo service nmbd restart
    
  4. 验证下
    nmblookup -R -U <wins_server_ip> <hostname>
    
  5. 这时windows就可访问ubuntu,可以直接ping通
  6. ubuntu互ping, 需要设置search domain
    echo 'search abc.com' >> /etc/resolv.conf
    

  1. 如果IP改变后, wins_server的缓存的ip不正确了, 可以删除以下两个文件 /var/cache/samba/wins.dat /var/cache/samba/browse.dat 然后重启 nmbd 即可
  2. 如果ubuntu ping 时, ip仍然不正确, 检查下dns server (这块还没有搞清楚, 试试换备用server, 或者等等dns同步)

如果只是为了互连互通,只需要 nmbd 服务即可 如果还需要windows共享文件的服务, 需启动smbd

===========================================================

nsswitch.conf是SUN公司开发的一种扩充(name services switch)

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

aliases:    邮件别名, sendmail(8) 使用该文件. 
ethers:     以太网号. 
group:      用户组, getgrent(3) 函数使用该文件. 
hosts:      主机名和主机号, gethostbyname(3) 以及类似的函数使用了该文件. 
netgroup:   网络内主机及其用户的列表, 访问规则使用该文件. 
network:    网络名及网络号, getnetent(3) 函数使用该文件. 
passwd:     用户口令, getpwent(3) 函数使用该文件. 
protocols:  网络协议, getprotoent(3) 函数使用该文件. 
publickey:  NIS+及NFS 所使用的secure_rpc的公开密匙. 
rpc:        远程过程调用名及调用号, getrpcbyname(3) 及类似函数使用该文件. 
services:   网络服务, getservent(3) 函数使用该文件. 
shadow:     shadow用户口令, getspnam(3) 函数使用该文件.

=====================

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

  • files: /etc/hosts
  • mdns : dnsmasq avahi-daemon
  • dns : dns server

===================

dnsmasq

Dnsmasq is a lightweight, easy to configure DNS forwarder and DHCP server. https://wiki.archlinux.org/index.php/Dnsmasq_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

stop dnsmasq:

  1. sudo vi /etc/NetworkManager/NetworkManager.conf
  2. comment dns=dnsmasq
  3. sudo service network-manager restart

ubuntu 五笔

ubuntu 使用五笔输入法 ubuntu 13.10 测试通过

  • sudo apt-get install ibus-table-wubi
  • ibus-daemon -x -r -d
  • 选择五笔输入,生效

使用SHIFT+SPACE切换全半角 使用SHIFT切换中英文输入

pycompile not found

sudo apt-get remove python 后, 出现了很多错误, 导致后续的无法进行

pycompile not found 解决方案: 删掉 /usr/bin/pycompile, 然后继续apt-get -f install / remove

gconf2 not found 错误 sudo dpkg-reconfigure gconf2 sudo apt-get –purge remove gconf2

gconf2安装时 gconf-schemas not found 因安装gconf2时,需执行脚本,脚本中需要python,而python需要gconf2 导致了这个地方的问题

解决方案: 注掉报错的脚本中的那几行命令,然后重新执行 或: 如果已经安装了python的话, ln -s 下python即可

==============================

ubuntu从13.04升级至13.10时,报/usr/bin/python错误,不知原因 修改/usr/bin/python链接位置时,也无法通过 故直接remove python python3, 然后就出现上面的错误了 修复后, 可以执行do-release-upgrade了

ubuntu的包管理,要赞一下

maven的全局去除依赖

我们在maven中有时候希望将某个依赖包彻底去除

如我们的系统使用的是spring3.1.2, 但是依赖的二方包中, 总是或多或少依赖了spring2.5.6, 希望有个方法, 能全局去除掉

<!-- globally exclusion -->
<dependency>
	<groupId>org.springframework</groupId>
	<artifactId>spring</artifactId>
	<version>2.5.6.SEC03</version>
	<scope>provided</scope>
</dependency>

以上方式, 有个弊端, 就是eclipse中, 还是会依赖, 且容易用混

有三个方案(建议使用第三种)

<dependency>
	<groupId>org.springframework</groupId>
	<artifactId>spring</artifactId>
	<version>99.0-does-not-exist</version>
	<scope>provided</scope>
</dependency>
<dependency>
	<groupId>org.springframework</groupId>
	<artifactId>spring</artifactId>
	<version>2.5.6</version>
	<scope>system</scope>
	<systemPath>${basedir}/lib/empty.jar</systemPath>
</dependency>
			<plugin>
				<artifactId>maven-eclipse-plugin</artifactId>
				<configuration>
					<downloadSources>true</downloadSources>
					<downloadJavadocs>true</downloadJavadocs>
					<classpathContainers>
						<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
					</classpathContainers>
					<excludes>
						<exclude>org.springframework:spring</exclude>
					</excludes>
				</configuration>
			</plugin>