Skip to content

Instantly share code, notes, and snippets.

@alexzhan
alexzhan / get_login_addr.py
Created June 18, 2015 07:26
get mail login address by email address
def get_login_addr(email):
main_addr = email.split('@')[-1]
if 'mail' in main_addr: return main_addr
else: return 'mail.' + main_addr
@alexzhan
alexzhan / url_encode_characters
Created August 5, 2015 15:23
URL Encode Characters
backspace %08
tab %09
linefeed %0A
creturn %0D
space %20
! %21
" %22
# %23
$ %24
% %25
import os
import string
RCV_LOG = r"/path/to/xxx.log"
def get_last_n_lines(logfile, n):
n = string.atoi(n)
blk_size_max = 4096
n_lines = []
with open(logfile, 'rb') as fp:
public class TestFile {
public static void main(String[] args) {
System.out.println("yes,alex!");
}
}
<s:set name="var" value="XXX" />
<s:property value="{#var}" />
<s:if test="%{#var == YYY}">
</s:if>
//setter and getter of pagination and currentPage is ignored
private List<Integer> pagination = new ArrayList<Integer>();
int up = (currentPage / 20 + 1) * 20 + currentPage % 20 + 1 -10;
int down = (currentPage / 20) * 20 + currentPage % 20 - 10;
for( int i = down; i < up; i ++){
if(i >= 1)
pagination.add(i);
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Date;
public class YangInitial {
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Date;
<s:if test="%{keyword == ''}">
<title><s:property value="keyword"/></title>
</s:if>
2 不能用来修饰interface的有()
A private B public C protected D static
3 下列正确的有()
A call by value 不会改变实际参数的数值 B call by reference 能改变实际参数的引用地址
C call by reference不能呢个改变实际参数的引用地址 D call by reference不会改变实际参数的内容
7 怎样让jvm自动开始垃圾回收过程?
A 不能
C 调用System.gc();
8 如下代码运行结果是:
public class Main implements Runnable {