- 博客(209)
- 资源 (3)
- 收藏
- 关注
原创 IntelliJ IDEA Live Templates for Unit Testing
http://vansande.org/2015/03/26/intellij_idea_live_templates_for_unit_testing/
2017-12-12 17:29:59 218
原创 memory management in java
https://www.journaldev.com/2856/java-jvm-memory-model-memory-management-in-java
2017-12-07 15:25:06 229
原创 Read write text file in shell
#!/bin/bashcontains() { string="$1" substring="$2" if test "${string#*$substring}" != "$string" then return 0 # $substring is in $string else return 1 ...
2017-11-21 22:57:53 210
原创 Easiest way to read write files in java 8
Path path = Paths.get(getClass().getClassLoader() .getResource("fileTest.txt").toURI()); //relative to the classString content = new String(Files.readAllBytes(path));try (Stream<Stri...
2017-10-25 15:46:36 141
原创 start sublime from terminal on mac
Put this in the profile. If you use fish, put it in ~/.config/fish/config.fish ln /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/st
2017-07-19 16:41:58 137
原创 Tomcat 在启动时开启调试
很容量找到怎么在tomcat中远程调试的文章。如http://stackoverflow.com/questions/6733849/remote-debugging-in-intellij-tomcat 但是这种调试只能在tomcat启动完成之后才能开启。但是我们有时想调试tomcat启动时用到的代码,如一应用的初始化代码。其实很简单。 <jvmarg line="-...
2017-03-31 11:47:00 343
原创 Append path to $PATH in fish shell on mac & linux
The best way I have found to persistently add a path to your $PATH is set-U fish_user_paths $fish_user_paths ~/path/name This prepends to $PATH. And since it's persistent, the path stays in ...
2016-11-01 18:11:07 159
原创 Integer Break
public class IntegerBreak { public int integerBreak(int n) { if (n == 2) { return 1; } if (n == 3) { return 2; } if...
2016-05-17 11:48:10 91
原创 Longest Increasing Subsequence
public class Solution { public int lengthOfLIS(int[] nums) { if(nums.length==0){ return 0; } int[] lens= new int[nums.length]; len...
2016-05-17 11:22:52 93
原创 Top K Frequent Elements
import java.util.*;public class Solution { public List<Integer> topKFrequent(int[] nums, int k) { HashMap<Integer, Integer> numberOccur = getNumOccur(nums); ...
2016-05-17 11:16:25 98
原创 Setting environment variables via launchd.conf no longer works in OS X Yosemite/
Create an environment.plist file in ~/Library/LaunchAgents/ with this content:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple...
2016-05-11 16:40:40 151
原创 Extend image disk size in KVM
1. Switch to root2. sudo qemu-img resize images/win2008.img +20G3. Start windows vm and go to server manager4. Server Manager->Storage->Diskmanagement5. Extend volume of C with the adde...
2015-07-14 11:35:05 138
原创 Use Fetch in NHibernate to solve N+1
http://bartwullems.blogspot.com/2012/03/nhibernate-eager-fetching.html NHibernate eager fetching NHibernate supports the concept of eager fetching for a long time. However there are some t...
2014-06-17 14:32:59 129
原创 SQL where 条件顺序对性能的影响有哪些
SQL where 条件顺序对性能的影响有哪些http://blog.sina.com.cn/s/blog_4586764e0100mdif.html Where子句中条件的顺序对性能没有影响(不管是CBO还是RBO优化器模式),注意,额外说一下,这里只是说条件的顺序,不包含表的顺序。在RBO优化器模式下,表应按结果记录数从大到小的顺序从左到右来排列,因为表间连接时,最右边的表会被放...
2014-05-20 16:31:48 430
原创 Install android apk from PC
http://developer.android.com/tools/help/adb.html#moveadb install <path_to_apk>
2013-12-02 17:48:57 129
原创 java读取文件内容
//将要读的文件文件放在resources/xml/目录下, resources设置成source folder public String getContent(String modelFileName) { InputStream fileStream = getClass().getClassLoader().getResourceAsStream("xm...
2013-11-19 15:37:44 107
原创 Will android (java) UUID.randomUUID() return repeated UUIDs?
Theoretically, I don't think this method will return repeated UUIDs, even from different devices.Let's check the documentation of android: http://developer.android.com/reference/java/util/UUID.html....
2013-11-19 06:11:35 121
原创 Keep ProgressDialog while rotate the phone
Just add the following to the activity in AndroidManifest.xml <activity android:name=".view.cohort.FormTemplateWizardActivity" android:label="Download Form Templates" android:configChanges...
2013-10-21 22:56:43 108
原创 Maven to add v7 GridLayout support
1. check out the deployer https://github.com/mosabua/maven-android-sdk-deployer2. cd maven-android-sdk-deployer/extras/compatibility-v7-gridlayout3. mvn install add the following into the pom...
2013-10-12 17:18:09 93
原创 Android resources
Android Asset Studio: http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html Inspired UI: http://android.inspired-ui.com/ Android cheatsheet for graphic designershttp://...
2013-09-11 15:13:06 142
原创 Default shell
How do I make fish my default shell?Edit /etc/shells as root, and add the line (if missing):/usr/local/bin/fishThen run:chsh -s /usr/local/bin/fish To change back to bashchsh -s /bin/ba...
2013-08-13 15:40:33 165
原创 Setting environment variables in OS X?
stackoverflow.com/questions/135688/setting-environment-variables-in-os-x Bruno is right on track. I've done extensive research and if you want to set variables that are available in all GUI ap...
2013-08-13 02:43:14 169
原创 The 30 CSS Selectors you Must Memorize
The 30 CSS Selectors you Must Memorize So you learned the base id, class, and descendant selectors – and then called it a day? If so, you’re missing out on an enormous level of flexibility. While...
2013-07-05 21:51:37 261
原创 git strip commits corresponding to hg strip
git reset --hard HEAD~1 The ending number represents the number of commits to remove.
2013-06-28 03:32:25 98
原创 git alias for corresponding "hg in" "hg out"
hg outgit config --global alias.out "log origin/master..master"use "git out" hg ingit config --global alias.in "log master..origin/master"use "git in"
2013-06-28 03:03:24 104
原创 html marquee
<marquee behavior="scroll" direction="up" width="100" height="250" scrollamount="2" scrolldelay="10""> Your content goes here<br/> Your content goes h
2013-05-14 17:11:42 94
原创 Web应用需要考虑的安全问题
1. SQL注入2. CSRF3. XSS4. 后台异常不要显示给用户,这样给黑客跟踪到后台技术及代码结构提供了便利,会大大降低黑客攻击的难度。
2013-05-07 14:07:28 128
原创 javascript HTML encode
_htmlEncode: function (value){ return $('<div/>').text(value).html(); }
2013-04-22 10:44:19 93
原创 function to convert ticks to DatetimeOffset
--function to convert ticks to DatetimeOffsetif object_id(N'GetTimeFromTicks', N'FN') is nullbeginexecute dbo.sp_executesql @statement = N'CREATE FUNCTION dbo.GetTimeFromTicks(@Ticks BIGINT)...
2013-04-08 17:05:37 115
原创 Install resharper plugin for Concordion
http://www.gallio.org/ download and install
2013-03-28 14:57:10 78
原创 Authentication related technologies
SSL SSO WIF OAuth Cryptographic nonce Digest Access Authentication MD5 Basic Access Authentication Base64
2012-11-08 17:21:39 97
原创 The database principal owns a schema in the database, and cannot be dropped
http://blog.sqlauthority.com/2011/12/26/sql-server-fix-error-15138-the-database-principal-owns-a-schema-in-the-database-and-cannot-be-dropped/ SELECT s.nameFROM sys.schemas sWHERE ...
2012-08-06 15:53:28 300
原创 sql server function example to find managed employees
Prepare data:USE AdventureWorks2008GOCREATE TABLE HumanResources.Employee2( EmployeeID int NOT NULL, ManagerID int NULL REFERENCES HumanResources.Employee2(EmployeeID), JobTitle nva...
2012-08-04 11:44:30 83
原创 c#读取文件目录path
private static string GetFullName() { var current_dir = Path.GetDirectoryName(new Uri(Assembly.GetCallingAssembly().CodeBase).LocalPath); return ...
2012-07-30 20:07:40 107
原创 SQL Server Isolation Levels By Example
To check the current database isolation level, use: DBCC useroptions http://www.gavindraper.co.uk/2012/02/18/sql-server-isolation-levels-by-example/SQL Server Isolation Levels By...
2012-07-27 22:02:27 104
jboss in action
2009-03-28
Java Persistence With Hibernate
2009-02-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人