기본 콘텐츠로 건너뛰기

2016의 게시물 표시

[DataTable Lib] :: Custom Responsive Add Collaps Option

Responsive version = 2.0.0 Code ---  var tableCollapse = true ; // Add //find 'this.s.dt.settion()[0]' before add if (b.details.collapse != null ){tableCollapse = b.details.collapse}; if (tableCollapse){c(b.table().node()).toggleClass( "collapsed" ,e);} Using. Javascript init DataTable Option responsive: {         details: {              display: $.fn.dataTable.Responsive.display.childRowImmediate,             type: '' ,             collapse : false         }},

[Bootstrap] :: Bootstrap Modal Styling for header.

Bootstrap modal를 그대로 사용해도 나름 깔끔하지만 Header부분에 상황에 따라서 색상으로 표현을 해주고 싶어서 CSS로 적용한것을 남겨두려 한다. CSS file .modal-primary-header {     color : #fff ;     background-color : #337ab7 ;     border-color : #2e6da4 ;     border-top-left-radius : 5px ;     border-top-right-radius : 5px ; } HTML File <!-- Modal --> < div class ="modal fade" id ="confirmModal" tabindex ="-1" role ="dialog" aria-labelledby ="myModalLabel" aria-hidden ="true" > < div class ="modal-dialog" > < div class ="modal-content" > < div class ="modal-header modal-primary-header" > < button type ="button" class ="close" data-dismiss ="modal" aria-hidden ="true" > &times; </ button > < h4 class ="modal-title...

[JAVA] :: JAVA에서 간단히 URL 파일 다운로드 방법

Java에서 정말 간단하게 URL파일을 다운 받을때 사용하면 좋은거 같아서 남겨두려 한다. 코드는 이게 끝이다. try(InputStream in = new URL(fileURL).openStream()){      Files.copy(in, Paths.get("저장할 파일 경로 및 파일명+".파일 확장자"),     StandardCopyOption.REPLACE_EXISTING); } 이상이다.

[JAVA] :: Jsoup을 이용한 HTML페이지 Parsing

최근에 HTML페이지를 Parsing하여 페이지 이미지를 추출해 컴퓨터에 저장하는 일이 생겨 찾아보다가 알게된 Jsoup에 사용법에 대해 남겨 놓으려고 한다. pom.xml < dependency >   <!-- jsoup HTML parser library @ http://jsoup.org/ -->   < groupId > org.jsoup </ groupId >   < artifactId > jsoup </ artifactId >   < version > 1.8.3 </ version > </ dependency > 최신버전으로 Maven pom에 등록후 사용이 가능하다. Document doc = Jsoup.connect( url )    .timeout(0)     .ignoreContentType( true )    .get(); 을 호출하면 Document Object로 HTML코드들이 반환된다. String imgUrl = doc.select("#IMG1"). attr (" src "); 추출하고자하는 HTML field의 ID or Tag name or css등으로 원하는 부분을 Select할 수 있다. 그리고 해당 태그의 속성의 값만을 추출할 수도있다 .attr을 사용함으로써. 끝이다. 매우 간단하다.. 몇몇 사이트는 페이지를 Jsoup로 호출하면 416 에러가 발생하면서 robot으로 인식하여 페이지 접근을 막아놓은 사이트들이 있다. 그럴땐 .userAgent( "로봇이름") 으로 증명하면된다. 왠만하면 나는 google robot입니다 라고 보내면 거의다 통과된다. Jsoup를 이용하여 로그...

[Android] :: bluetooth keyboard 연결시 화면 갱신 문제.

bluetooth keyboard 연결시 Activity가 갱신되는 문제가 발생하게 되어 찾다 찾다 보니 매우 간단하게 해결 할 수 있는 방법이 나왔다. AndroidManifest.xml 파일안에 <activity tag에  android :configChanges= " keyboard |keyboardHidden|orientation|screenSize|screenLayout" 를 추가해주면 해결.. 이거때문에.. 구글링을 엄청했었는데.. 너무 허무하다..

[Spring Framework] :: Spring 4 + JasperReports + JsonDataSource Step 1.

pom.xml < dependency > < groupId > net.sf.jasperreports </ groupId > < artifactId > jasperreports </ artifactId > < version > ${jasperreports.version} </ version > </ dependency > < dependency > < groupId > com.google.code.gson </ groupId > < artifactId > gson </ artifactId > < version > 2.5 </ version > </ dependency > < dependency > < groupId > net.sf.barcode4j </ groupId > < artifactId > barcode4j </ artifactId > < version > 2.1 </ version > </ dependency > < dependency >     < groupId > batik </ groupId >     < artifactId > batik -bridge </ artifactId >     < version > 1.6-1 </ version > </ dependency > WebConfig.java @Bean // Jasper preview bean Set....

[Spring Framework] :: Spring4 Boot Email Setting

Spring Boot을 사용하면서 많은 것들이 달라져서 잊어 먹지 않고자 여기에 정리를 해두려 한다. Boot을 사용하기 이전에는 Mail Config File을 Xml파일로 셋팅 후 Spring Config에 설정해주어야 했지만 이제는 Boot에서 application.properties파일에 간단하게 설정이 가능해졌다. 방법은 아래와 같다. 우선 pom.xml에 dependency를 추가해준다. < dependency >     < groupId > org.springframework.boot </ groupId >     < artifactId > spring-boot-starter-mail </ artifactId > </ dependency > 그 후 application.properties에 아래와 같이 셋팅해준다. spring.mail.host= smtp.gmail.com spring.mail.port= 465 spring.mail.username= xxxxx@gmail.com spring.mail.password=xxxxx spring.mail.properties.mail.smtp.auth = true spring.mail.properties.mail.smtp.ssl.enable = true spring.mail.properties설정은 옵션이다 메일서버에 따라서 해줘야 할 경우도 있고 안해줘도 될 경우가 있다. 그 후 이제 바로 사용이 가능하다. 필자의 경우는 Service를 따로 만들어 사용하고 있다. @Service ( "emailSendService" ) public class EmailSendServiceImpl implements EmailSendService { @Autowired priva...

[Android Lib] Butter Knife(1) - Setting

안드로이드 개발할때 매우 필수적으로 이용하고 있는 Butter Knife 사용법을 정리 해놓고자 한다. Butter Knife는 안드로이드 View 및 View Event들에 대한 Annotation을 제공해줌으로써 코드를 매우 간결하게 작성할수 있도록 도와준다. 우선 Butter Knife를 이용하기 위해서는 Gradle에 아래 내용을 추가해주어야 한다. compile 'com.jakewharton:butterknife: 7.0.1 ' 그리고 사용하고자 하는 Active 및 Fragment에 아래와 같이 작성한다. class ExampleActivity extends Activity { @Bind ( R . id . title ) TextView title ; @Bind ( R . id . subtitle ) TextView subtitle ; @Bind ( R . id . footer ) TextView footer ; @Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ); setContentView ( R . layout . simple_activity ); ButterKnife . bind ( this ); // TODO Use fields... } } public class FancyFragment extends Fragment { @Bind ( R . id . button1 ) Button button1 ; @Bind ( R . id . button2 ) Button button2 ; @Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundl...

[Android Code] Gson TypeToken example.

ArrayList Type 1 2 3 Gson gson  =   new  Gson(); Type type  =   new  TypeToken < List < YourClass > > (){}.getType(); List < YourClass >  arryList  =  gson.fromJson( JsonDataString , type); cs Map Type 1 2 3 Gson gson  =   new  Gson(); Type type  =   new  TypeToken < Map<Object, Object> > (){}.getType(); Map<Object, Object>  mapObject  =  gson.fromJson( JsonDataString , type);

[Android Lib] Gson

Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of. There are a few open-source projects that can convert Java objects to JSON. However, most of them require that you place Java annotations in your classes; something that you can not do if you do not have access to the source-code. Most also do not fully support the use of Java Generics. Gson considers both of these as very important design goals. Gson Goals Provide simple  toJson()  and  fromJson()  methods to convert Java objects to JSON and vice-versa Allow pre-existing unmodifiable objects to be converted to and from JSON Extensive support of Java Generics Allow custom representations for objects Support arbitrarily complex objects (with deep inheritance hierarchies and extensi...

[ Android Lib] FButton

[ Android Lib] FButton FButton is a custom Button of Android with "Flat UI" concept. FButton's design get inspiration from  designmono . This library is very small and highly customizable. Demo application on playstore:  https://play.google.com/store/apps/details?id=info.hoang8f.fbutton.demo Screenshot Link https://github.com/hoang8f/android-flat-button

[Android App] :: PowerBall Maker v1.0

Po werBall Maker v1.0 Good Luck !! powerball number generator. Download link