2018年4月11日

自印筆記本

http://gridzzly.com/

有網眼(方格點、三角點)、方格、五線譜…

還能調size

很ez用 ui比之前另一個好

2018年4月3日

[JAVA]用JEXL處理算式

/**

* @author Querida
http://solnone.blogspot.tw/2010/06/apache-commons-jexl.html
*/

package testQ;



import org.apache.commons.jexl3.JexlContext;

import org.apache.commons.jexl3.JexlEngine;

import org.apache.commons.jexl3.JexlExpression;

import org.apache.commons.jexl3.MapContext;

import org.apache.commons.jexl3.internal.Engine;



public class TestJEXL {


public static void main(String[] args) {

// Create or retrieve a JexlEngine

JexlEngine jexl = new Engine();

// Create an expression object

String fomula = "quanty * price * 100";

JexlExpression jexlExpression = jexl.createExpression(fomula);



// Create a context and add data

JexlContext jexlContext = new MapContext();

jexlContext.set("quanty", 2);

jexlContext.set("price", 3);

// Now evaluate the expression, getting the result

Object o = jexlExpression.evaluate(jexlContext);

System.out.println(o);

}

}

[JAVA]DATE 的一些處理(joda time)

Date nowDate= new Date();
//java DATE TO joda time
new DateTime(nowDate);


//今天是一個月裡的第幾天
new DateTime(nowDate).getDayOfMonth();


//這個月有幾天
new DateTime(nowDate).dayOfMonth().getMaximumValue();


//上個月有幾天
DateTime dayOfPeriousMonth = new DateTime(nowDate).minusMonths (1);

System.out.println(dayOfPeriousMonth);

int daysInPeriousMonth=dayOfPeriousMonth.dayOfMonth().getMaximumValue();

System.out.println(daysInPeriousMonth);


//取出上個月的12號
DateTime periousM12=dayOfPeriousMonth.withDayOfMonth(12); System.out.println(periousM12 );

//joda time to java Date
new DateTime().toDate();


//本月第一天
DateTime firstDayOfMonth = new DateTime().dayOfMonth().withMinimumValue();

//某個時間是否是在今天內
if( new DateTime( someDateTime).isAfter( DateTime.now().minusDays(1) )){
System.out.println(someDateTime+" is in 24 hours");
}else {
System.out.println("not in!");
}