ITeye博客

mrjeye's blog

mrjeye · 共 107 篇文章

普通用户增加sudo权限

修改/etc/sudoers文件,修改命令必须为visudo才行 #/usr/sbin/visudo -f /etc/sudoers 在root ALL=(ALL) ALL 之后增加 yourusername ALL=(ALL) ALL 普通用户的.bash_profile文件在PATH变量中增加 /sbin;/usr/sbin;/usr/local/sbin;/usr/kerberos/sbin

2011-05-19 10:46 · linux · 评论(0)

常用API

'激活指定的窗口 SetActiveWindow '获取声音音量 waveOutGetVolume '设置输出音量 waveOutSetVolume '将指针限制到指定区域。 ClipCursor '决定是否互换鼠标左右键的功能 SwapMouseButton '排列一个父窗口的最小化子窗口(在vb里使用:用于在桌面排列图标,用GetDesktopWindow函数获得桌面窗口的一个句柄) ArrangeIconicWindows '将指定的窗口带至窗口列表顶部 BringWindowToTop '破坏(即清除)指定的窗口以及它的所有子窗口 DestroyWindow '在指定的窗口里允许或禁…

2011-05-19 10:38 · windows · 评论(0)

共享一个以前学习时写的WEB ANT

<?xml version="1.0" encoding="UTF-8"?> <project name="ANT" basedir="."> <property name="build.src" value=".\src" /> <property name="build.dest" value=".\~!mrjeye$`" /> <property environment="environment" /> <property name="jboss.home" value="${environment.JBOSS_HOME}" /> <property name="build.jar" …

2011-05-19 10:30 · java web · 评论(0)

类示例

class Cat(object): __name = '' __age =0 def __init__(self,name,age): self.__name = name self.__age = age print 'init cat , name is %s;age is %d' %(name,age) def getName(self): return self.__name def getAge(self): return self.__age def setName(self,name): self.__name = name def setAge(self,age): sel…

2011-05-19 10:26 · python · 评论(0)

枚举文件加入特定字符串

import os,os.path path = os.path class VersionOper(object): 'The version appendor class .' __dir ='' __appendStr='mrjeye' __isDebug =False __doType =() def debug(self,msg): 'prints the msg if debug mode .' if not self.__isDebug: return print 'JDebug , msg :%s' %msg def addType(self,item): 'add the …

2011-05-19 10:24 · python · 评论(0)

列表和元组

序列:包含一些顺序排列的对象的一个结构 #和并两个列表 l1= l2= l1.extend(l2) l1,l2 (, ) l1+l2 zip() sorted()

2011-05-19 10:20 · python · 评论(0)

访问模型

分类 Python 类型 直接访问 数字 顺序访问 字符串、列表、元组 映射访问 字典 数据类型 存储模型 更新模型 访问模型 数字 Scalar 不可更改 直接访问 字符串 Scalar 不可更改 顺序访问 列表 Container 可更改 顺序访问 元组 Container 不可更改 顺序访问 字典 Container 可更改 映射访问

2011-05-19 10:20 · python · 评论(0)

常用模块

sys >>> import sys >>> dir(sys) types:包含所有内置TYPE >>> import types >>> dir(types) decimal:十进制浮点数 >>> import decimal >>> dir(decimal) array:高效数值数组 math/cmath:标准数学运算函数 random:多种伪随机数的实现 >>> s='' >>> for x in range(1,10) : ... s+=str(random.randrange(1,100))+' ' ... >>> s '48 19 83 40 40 3 32 70 43 ' >>…

2011-05-19 10:19 · python · 评论(0)

常用函数及命令

is,is not = id(...)==id(...) #比较对象引用是否相同 >>> import cat >>> c1 = cat.Cat('c',4) init cat , name is c;age is 4 >>> c2=c1 >>> c3=cat.Cat('c',4) init cat , name is c;age is 4 >>> c1 is c2 True >>> c1 is c3 False >>> c2 is not c3 True >>> id(c1),id(c2),id(c3) (12799152, 12799152, 12799120) str(obj) #返回…

2011-05-19 10:18 · python · 评论(0)

Python学习笔记

python,怎么说呢,感觉很好玩,以下说明几点笔者感兴趣的东西: 它抛弃了包裹代码块的花括号,而只依据缩进对代码块进行理解(语句有代码块的要以:结束) 注释用#,若一行以#开头,则不会被解释 FOR循环的用法不同,Python的FOR和java中的for in功能一样,具体可以参照后续代码 for语法: for iter in iter: ... else: #当且仅当在FOR循环结束时没遇到BREAK标签时执行 ... 对象的比较有些时髦: >>> 2>1<3 True #相当于:(2>1) and (1<3) >>> 2>1<0 False 这是一条正确的赋值方法:i=j=1 #i=1…

2011-05-19 10:17 · python · 评论(0)

gcc中的预编译宏

gcc中的预编译宏 * 预定义的宏 * __NASE_FILE__ 源文件的完整路径名,和 __FILE__ 不同,被引用的文件仍然是原来文件名 * __CHAR_UNSIGNED__ 用于指定该机器上 char 是无符号类型 * __cplusplus 使用 C++ 编译器编译 * __DATE__ 编译时的日期 * __FILE__ 编译文件名 * __func__ 同 __FUNCTION__ * __GNUC__ GCC 的主版本号 * __GNUC_MINOR__ GCC 的次版本号 * __GNUC_PATCHLEVEL__ GCC 的修订号 * __GNUG__ 由 C++ 编…

2011-05-19 09:42 · other · 评论(0)

用JAVA生成二维码

使用SwetakeQRCode在Java项目中生成二维码 首先将SwetakeQRCode拷贝在项目lib中,加入Build Path,然后: byte[] buff = "http://www.mrjeye.org".getBytes("utf-8"); Qrcode qrcode = new Qrcode(); qrcode.setQrcodeVersion(3); qrcode.setQrcodeErrorCorrect('M'); qrcode.setQrcodeEncodeMode('B'); boolean[][] bRect = qrcode.calQrcode(buff); …

2011-05-18 17:33 · java · 评论(5)

導航加入功能按鈕

UIBarButtonItem *takeGoods = [[[uibarbuttonitem alloc] init] autorelease]; [takegoods setaction:@selector(takegoods:)]; [takegoods settarget:self]; takeGoods.title = @"購買"; [self.navigationitem setrightbarbuttonitem:takegoods];

2011-05-17 13:44 · iphone · 评论(0)

鍵盤隱藏

[self.txtnamefield resignfirstresponder]; 說明:常規做法是將VIEW最下層加入一個UIButton,將其類型設爲Custom(不會顯示邊框),然後綁定其ACTION事件,當該按鈕被點擊時,調用VIEW上所有INPUT的resignFirstResponder方法.

2011-05-16 17:22 · iphone · 评论(0)

UITableView高度自適應

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { // 列寬 CGFloat contentWidth = self.tableView.frame.size.width; // 用何種字體進行顯示 UIFont *font = [uifont systemfontofsize:13]; // 該行要顯示的內容 NSString *content = [data objectatindex:indexpath.row]; // 計算出顯示完內容需要的…

2011-05-16 17:05 · iphone · 评论(0)