1. 给root加密码:/usr/bin/mysqladmin -u root password 123456
2. 导出:mysqldump -u root -p dbname > file.sql
3. 导入:mysql -u root -p dbname < backup-file.sql
4. 授权:grant all on *.* to root@"%" identified by "密码";
5. 收回权限:revoke all privileges on *.* from root@"%";
6. 登录:mysql -u root -p
7. 查看数据库:show databases;
8. 使用数据库:use test;
9. 查看表:show tables; ......
写入时,先做encode:
public static String encode(String src) {
String result = null;
try {
result = new String(src.getBytes("gbk"), "ISO-8859-1");
} catch (UnsupportedEncodingException uee) {
System.err.println(uee);
}
return result;
}
读出时,再做decode:
public static String decode(String src) {
String result = null;
try {
result = new String(src.getBytes("ISO-8859-1"), "gbk");
} catch (UnsupportedEncodingException uee) {
System.err.println(uee);
}
return result;
}
连接时不需要指定字符集 ......
写入时,先做encode:
public static String encode(String src) {
String result = null;
try {
result = new String(src.getBytes("gbk"), "ISO-8859-1");
} catch (UnsupportedEncodingException uee) {
System.err.println(uee);
}
return result;
}
读出时,再做decode:
public static String decode(String src) {
String result = null;
try {
result = new String(src.getBytes("ISO-8859-1"), "gbk");
} catch (UnsupportedEncodingException uee) {
System.err.println(uee);
}
return result;
}
连接时不需要指定字符集 ......
一直想写点东西,但却迟迟没有开始,今天无意中回到ERP100这个网站,发现有了QAD的专区,于是,一时热血沸腾,写了点东西,就借此机会将内容也发到这里吧,呵呵。
其实内容都是本人写的,不过为了图方便,在ERP100中写完了,然后直接Copy到这里,偷了点懒,呵呵。
以下是正文,在ERP100中的地址是
http://bbs.erp100.com/forum.php?mod=viewthread&tid=74269&page=1&extra=#pid438182
由于小弟接触QAD也只有短短几年时间,目前也只是刚刚入门的菜鸟级别,希望借此机会与熟悉QAD软件的前辈一起交流,呵呵。
项目名称:
异构数据库数据同步(从Progress到MySQL)
背景介绍:
我现在公司使用的QAD版本很老,是85g的,于是,要升级到eb2.1,但由于有很多水晶报表是直接连到QAD后台取数的,而eb2.1对连接数限制在1个,因此,公司决定将QAD的数据同步导入到MySQL数据库中,这样,只要将水晶报表的连接重新指向MySQL,就可以正常使用了。
实现思路:
要实现实时同步,最直接的就是触发器了,通过在触发器中分析各字段的值,生成SQL语句,并存入文本文件中,然后,定期调用一段Java程序,读取文本中的SQL语句,将数据插入MySQL数据库中。
注:当时在项目分析阶段 ......
mysql的 find_in_set函数使用方法
很多时候我们在设计数据库时有这种情况,比如:
有个文章表里面有个type字段,他存储的是文章类型,有 1头条,2推荐,3热点,4图文 .....11,12,13等等
现在有篇文章他既是 头条,又是热点,还是图文,
type中以 1,3,4的格式存储.
那们我们如何用sql查找所有type中有4图文标准的文章呢,
这就要我们的find_in_set出马的时候到了.
先看mysql手册中find_in_set函数的语法:
FIND_IN_SET(str,strlist)
假如字符串str 在由N 子链组成的字符串列表strlist 中, 则返回值的范围在 1 到 N 之间 。一个字符串列表就是一个由一些被‘,’符号分开的自链组成的字符串。如果第一个参数是一个常数字符串,而第二个是type SET列,则 FIND_IN_SET() 函数被优化,使用比特计算。如果str不在strlist 或strlist 为空字符串,则返回值为 0 。如任意一个参数为NULL,则返回值为 NULL。 这个函数在第一个参数包含一个逗号(‘,’)时将无法正常运行。
mysql> SELECT FIND_IN_SET('b','a,b,c,d');
-> 2
用起来很简单
就以上面我说到的情况来举例:
以下为引用的内容:
select * ......
VB显示透明FLASH效果
演示效果:
代码如下:
公共声明区域
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Const WS_EX_LAYERED = &H80000
Const GWL_EXSTYLE = (-20)
Const LWA_COLORKEY = &H1
Dim rtn&
Private Sub Form_Load()
ShockwaveFlash1.BackgroundColor = RGB(255, 255, 255)
rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong hwnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes hwnd, RGB(255, 255, 255), 0, LWA_COLO ......
VB显示透明FLASH效果
演示效果:
代码如下:
公共声明区域
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Const WS_EX_LAYERED = &H80000
Const GWL_EXSTYLE = (-20)
Const LWA_COLORKEY = &H1
Dim rtn&
Private Sub Form_Load()
ShockwaveFlash1.BackgroundColor = RGB(255, 255, 255)
rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong hwnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes hwnd, RGB(255, 255, 255), 0, LWA_COLO ......
from http://stackoverflow.com/questions/101268/hidden-features-of-python
http://www.okpython.com/bbs/thread-3434-1-1.html
http://www.okpython.com/bbs/thread-3436-1-2.html
http://www.okpython.com/bbs/thread-3437-1-2.html
http://www.okpython.com/bbs/thread-3438-1-1.html
http://www.okpython.com/bbs/thread-3439-1-1.html
http://www.okpython.com/bbs/thread-3440-1-1.html
http://www.okpython.com/bbs/thread-3441-1-1.html
#74 太懒而不愿对字典进行初始化?没问题!
# n Python > 2.3:
from collections import defaultdict
In Python <= 2.3:
def defaultdict(type_):
class Dict(dict):
def __getitem__(self, key):
return self.setdefault(key, type_())
return Dict()
In any version:
d = defaultdict(list)
for stuff in lots_of_stuff:
d[stuff.name].append(stuff)
......