to be a better man
eve · 共 17 篇文章
funny error messages
Baptist explanation: There must be sin in your life. Everyone else opened it fine. Presbyterian explanation: It's not God's will for you to open this link. Word of Faith explanation: You lack the faith to open this link. Your negative words have prevented you from realizing this link's fulfillment.…
2014-12-16 00:43 · 评论(0)
Extension methods
public static T As<T>(this object obj) where T : class { return obj as T; } public static bool Contains(this string source, string toCheck, StringComparison comp) { return source.IndexOf(toCheck, comp) >= 0; } public static bool Contains(this IEnumerable<string> container, string toCheck, StringCom…
2013-12-20 06:44 · c# · 评论(0)
muahaha
(function(){ if (!window.confirm("S.831?")){ alert("seriously?"); arguments.callee(); } })();
2013-10-04 05:53 · 评论(0)
Browser Specific Hacks
http://css-tricks.com/snippets/css/browser-specific-hacks/
2013-09-20 02:42 · 评论(0)
placeholder text
Lorem ipsum dolor sit amet consectetur adipiscing elit. Man suscipit risus id dolor sin accumsan pharetra. Proin asrisus non purus adipiscing cursus ut neque. Nullam tampus tempus lacus, amet aliquam dolor blanit. Lorem ipsum dolor amet consectetur adipiscing elit. Suscipit risus dolor accumsan pha…
2013-05-14 15:56 · 评论(0)
how to verify an element does NOT exist in Selenium 2
WebElement element = driver.findElements(By.id("block-id")); assertNull(element); this code snippet will get a NoSuchEleementException, use the following 2 implementations instead 1. make the test expect the very exception @Test(expected = org.openqa.selenium.NoSuchElementException.class) public vo…
2011-10-26 11:22 · selenium 2 · 评论(0)
convert Excel 'AB'-like column name to digit number
/** * A-Z 1-26 * AA-AZ 27-52 * @param column * @return */ public static int getColumn(String column) { char[] columnArray = column.toUpperCase().toCharArray(); final int grade = 26; final char base = 'A' - 1; int result = 0; final int maxIndex = columnArray.length - 1; for (int i = maxIndex ; i >= …
2011-08-10 17:44 · 评论(0)
driving-learning related materials
Recent depressing driving-learning experience made me realize that my manipulative ability is worse than bad, and I begin to get the point why I cannot play pc games as good as my fellas, maybe I just did not try hard enough, but it is crystal evident I am not gifted for these stuffs. I deeply hope…
2011-07-20 21:33 · driving-learning · 评论(0)
noobie killer -- what returns?
a. public static int test() { try { int number = 1/0; return 1; } catch (Exception e) { return 2; } finally { return 3; } } \(^o^)/~ 3 b. public static int test() { int number; try { number = 1; return number; } catch (Exception e) { } finally { number = 3; } number = 4; return number; } O(∩_∩)O~ 1…
2010-11-10 17:00 · 评论(0)
how to generate hashcode
1. Store some constant nonzero value, say 17, in an int variable called result. 2. For each significant field f in your object (each field taken into account by the equals method, that is), do the following: a. Compute an int hash code c for the field: i. If the field is a boolean, compute (f ? 0 :…
2010-09-27 15:45 · 评论(0)
SOA relevant terms
1, WS (web service) 2, SOAP (simple object access protocol) 3, XSD (xml schema description) 4, UDDI (universal description,discovery and integration) 5, JMS (java message service) 6, MFL (message format language) 7, WSDL (web service description language) 8, XSLT (xml stylesheet language transforma…
2010-05-11 14:37 · 评论(0)