ITeye博客

kaqi

kaqi · 共 209 篇文章

IntelliJ IDEA Live Templates for Unit Testing

http://vansande.org/2015/03/26/intellij_idea_live_templates_for_unit_testing/

2017-12-12T17:29:59Z · 编程语言 · 评论(0)

memory management in java

https://www.journaldev.com/2856/java-jvm-memory-model-memory-management-in-java

2017-12-07T15:25:06Z · 编程语言 · 评论(0)

Read write text file in shell

#!/bin/bash contains() { string="$1" substring="$2" if test "${string#*$substring}" != "$string" then return 0 # $substring is in $string else return 1 # $substring is not in $string fi } file=$1 dest=$2 rm $dest while IFS= read -r line do # display $line or do somthing with $line echo "$line" >> "…

2017-11-21T22:57:53Z · 编程语言 · 评论(0)

Easiest way to read write files in java 8

Path path = Paths.get(getClass().getClassLoader() .getResource("fileTest.txt").toURI()); //relative to the class String content = new String(Files.readAllBytes(path)); try (Stream<String> stream = Files.lines(Paths.get(fileName))) { stream.forEach(System.out::println); } String text = "Text to save…

2017-10-25T15:46:36Z · 编程语言 · 评论(0)

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-19T16:41:58Z · 编程语言 · 评论(0)

Tomcat 在启动时开启调试

很容量找到怎么在tomcat中远程调试的文章。如 http://stackoverflow.com/questions/6733849/remote-debugging-in-intellij-tomcat 但是这种调试只能在tomcat启动完成之后才能开启。但是我们有时想调试tomcat启动时用到的代码,如一应用的初始化代码。其实很简单。 <jvmarg line="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${debug-port}"/> 只需要把suspend=n改成suspend=y. 这时候,tomcat在启动…

2017-03-31T11:47:00Z · 编程语言 · 评论(0)

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 $PATH on shell restarts. It's more efficient than putting a command in your config.fish to modify your $PATH…

2016-11-01T18:11:07Z · 操作系统 · 评论(0)

building microservices summary

building microservices summary

2016-06-29T15:29:55Z · 企业架构 · 评论(0)

Integer Break

public class IntegerBreak { public int integerBreak(int n) { if (n == 2) { return 1; } if (n == 3) { return 2; } if (n % 3 == 1) { int p = n / 3; return (int) Math.pow(3, p - 1) * 4; } if (n % 3 == 2) { int p = n / 3; return (int) Math.pow(3, p) * 2; } int p = n / 3; return (int) Math.pow(3, p); } }

2016-05-17T11:48:10Z · 编程语言 · 评论(0)

Longest Increasing Subsequence

public class Solution { public int lengthOfLIS(int[] nums) { if(nums.length==0){ return 0; } int[] lens= new int[nums.length]; lens[0]=1; int max=1; for(int i=1;i<nums.length;i++){ for (int j = 0; j < i; j++) { if(nums[i]>nums[j] && lens[i]<lens[j]){ lens[i]=lens[j]; } } lens[i]++; max=Math.max(max…

2016-05-17T11:22:52Z · 编程语言 · 评论(0)

Top K Frequent Elements

import java.util.*; public class Solution { public List<Integer> topKFrequent(int[] nums, int k) { HashMap<Integer, Integer> numberOccur = getNumOccur(nums); PriorityQueue<Integer> priorityQueue = new PriorityQueue<>((o1, o2) -> numberOccur.get(o1) - numberOccur.get(o2)); Set<Map.Entry<Integer, Int…

2016-05-17T11:16:25Z · 编程语言 · 评论(0)

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.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>my.startup</string> <key…

2016-05-11T16:40:40Z · 操作系统 · 评论(0)

Extend image disk size in KVM

1. Switch to root 2. sudo qemu-img resize images/win2008.img +20G 3. Start windows vm and go to server manager 4. Server Manager->Storage->Diskmanagement 5. Extend volume of C with the added disk space

2015-07-14T11:35:05Z · 操作系统 · 评论(0)

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 things to consider when you start using this with the out-of-the-box NHibernate Linq provider. Let’s first look …

2014-06-17T14:32:59Z · 编程语言 · 评论(0)

进程和线程的区别

http://www.cnblogs.com/lmule/archive/2010/08/18/1802774.html

2014-06-08T17:12:47Z · 操作系统 · 评论(0)