Tuesday, November 25, 2014

SRM 635 div 2 500

This is somehow easy comparing to other 500 point problem.

this is about a square root.




public class QuadraticLaw {

 public long getTime(long time){
  long number  = (long)Math.floor(Math.sqrt(time));
  for(long i=number; i>0; i--){
   if((i * i) + i <=  time){
    return i;
   }
  }
  return 0l;
 }
}

SRM 635 DIV 2 250 problem in topcoder

This is somehow easy comparing to other 500 point problem.

this is about a square root.




public class QuadraticLaw {

 public long getTime(long time){
  long number  = (long)Math.floor(Math.sqrt(time));
  for(long i=number; i>0; i--){
   if((i * i) + i <=  time){
    return i;
   }
  }
  return 0l;
 }
}

Thursday, November 20, 2014

dp to px in Anroid

http://labs.rampinteractive.co.uk/android_dp_px_calculator/

하늘을 날다~ 쿼드콥터 (1)

갑자기 하늘을 날아보고 싶다는 생각이 들었다. 과거 라이트형제은 날아보고 싶다는 생각에 비행기를 만들었을것이다. 나는 아두노이로 쿼드콥터를 만들어봐야겠다. 아두노이도 없고 부품도 없고 아무것도 없다. 부품도 사고 이것저것 사야할것 같다. 오늘부터 쿼드콥터를 만드는거 도전한다. 제발 만들다가 그만두지 말기를...

Wednesday, November 19, 2014

CustomComparator in java

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class SecondArray {
 public static ArrayList list = new ArrayList();
 public static void main(String args[]){
  CustomString cs= new CustomString("123744444");
  list.add(cs);
  cs= new CustomString("421212345");
  list.add(cs);
  cs= new CustomString("758312948");
  list.add(cs);
  cs= new CustomString("134129302");
  list.add(cs);
  cs= new CustomString("123755555");
  list.add(cs);
  
  System.out.println(list);
  
  
  Collections.sort(list, new CustomComparator());
  
  System.out.println(list);
  
 }
 
}
class CustomString {
 
 String [] devidedValues = new String[2];
 
 CustomString(String value){
  devidedValues[0] = value.substring(0, 4);
  devidedValues[1] = value.substring(4, value.length());
  
 }

 /**
  * @return the devidedValues
  */
 public String[] getDevidedValues() {
  return devidedValues;
 }

 /**
  * @param devidedValues the devidedValues to set
  */
 public void setDevidedValues(String[] devidedValues) {
  this.devidedValues = devidedValues;
 }

 /* (non-Javadoc)
  * @see java.lang.Object#toString()
  */
 @Override
 public String toString() {
  return devidedValues[0] + devidedValues[1];
 }
 
}

class CustomComparator implements Comparator {

 @Override
 public int compare(CustomString arg0, CustomString arg1) {
  String[] first = arg0.getDevidedValues();
  String[] second = arg1.getDevidedValues();
  
  int firstCompareVal = first[0].compareTo(second[0]) ;
  
  if(first[0].compareTo(second[0]) == 0){
   return first[1].compareTo(second[1]) * -1; 
  }else{
   return firstCompareVal;
  }
 }

}

Tuesday, November 18, 2014

Bucket List ~ Success and TODO

Success

1. Getting the score over 900point in TOEIC
2. Going to america and Lasvegas~!
3. For honemoon, having good time in maldives

TODO

1. going to Europe .
2. Making bucket list application.
3. building a library


Monday, November 17, 2014

The difference between find('li:first') and find('li :fist') in jquery

Today I knew big difference between find $('ul').find('li:first') and find('li :first')

find('li:first') this will Return first li tag

find('li :fist') this will Return firlst tag of first li tag

Wednesday, November 12, 2014

Thinking about multi reply table in oracle~!



In these days, people want to spend their more time with mobile than Pc.
Pc resolution is very high. so it is very readable in short time.
Mobile resolution size is smaller than PC. so paradigm of design is simple.
It seems that people like if something is so simple.
what I want to say is multi reply system is not many used in these days.

but I have to know how to think and make table for multi reply in board.

one way : 


column : id
subcolumn : parent id, title

Id is unique value
and parent id indicate Id
and more and more

this architecture can make limitless depth replies.

query can express by using oracle grammer connect by


In my opinion

advantage : formal and readable
disadvantage : many article, connect by spend much time to query



the other recommendable way : 

column : id
subcolumn : order_id, title, root_comment_id, depth


I want to show you ex)..

id                                   title,        depth  depth_order     root_comment_id
00000000001               root title            0     1                   00000000001  
00000000002                title                1       1                   00000000001  
00000000003                title               2        1                   00000000001
00000000004                title               2        2                   00000000001 
00000000005                root title         0        1                  00000000002 


select * from table order by root_comment_id desc, depth asc, depth_order desc


Anyway there are lots of way you can make.

what kind of way to choose is up to you~!


 

angular infinite $digest loop error solution

I used ui.router and someday i found out
error console show me this error

10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [["fn: $locationWatch; newVal: 32; oldVal: 31"],["fn: $locationWatch; newVal: 33; oldVal: 32"],["fn: $locationWatch; newVal: 34; oldVal: 33"],["fn: $locationWatch; newVal: 35; oldVal: 34"],["fn: $locationWatch; newVal: 36; oldVal: 35"]]

and I debug for whole day and gave up.

after debugging, I seached on internet and many people face with this problem.

and I finally fix the error

Before if I used location.href='#/xxxxxx'
and changed is $location.path(realpath);

Tuesday, November 11, 2014

mobile Html page box-sizing




if you want to muliline ellipsis effect


  1. overflowhidden;
  2. text-overflowellipsis;
  3. display-webkit-box;
  4. -webkit-line-clamp3;
  5. -webkit-box-orientvertical;
  6. word-wrapbreak-word;



this would be a solution for you

Thursday, November 6, 2014

Iscroll 4.2.5 in iput, textarea, select focus issue

I used I scroll and It was very good.

and I can't complete mobile web project because in Iscroll div I can't touch and input, textarea, select never clicked.

I find some article that somebody shared..

and all the things that I saw internet was not working.
and tried to find more and more

this is my solution

onBeforeScrollStart: function (e) {
var nodeType = e.explicitOriginalTarget ? e.explicitOriginalTarget.nodeName.toLowerCase():(e.target ? e.target.nodeName.toLowerCase():'');
if(nodeType !='select' && nodeType !='option' && nodeType !='input' && nodeType!='textarea') e.preventDefault();
},

Iscroll 4.2.5 scroll has some how issue during scrolling

Today I tried to using I Scroll 4.2.5 for pullup to morelist and pulldown to refresh
But I was in trouble because if you scroll when it is already scrolling
page will refresh and you can see the position of scroll will be strange..


anyway I had to fix it

What i Changed code is


_start : .....

if (x != that.x || y != that.y) {
/**
* hanwha 주석 2014-11-06 더블 스크롤시 화면이 튕기는 현상 제거
*
* david
*/
//if (that.options.useTransition) that._unbind(TRNEND_EV);
//else cancelFrame(that.aniTime);
// that.steps = [];
// that._pos(x, y);
if (that.options.onScrollEnd) that.options.onScrollEnd.call(that);
}

this source is called when you are willing to scroll during scrolling.
in other word. double scrolling..

I hope to remever these things so

If you guys are faced with this problem.
remove that source.