Wednesday, July 29, 2015

Everything Search engine~! this is light but fast than window index search.

Today I want to introduce this program to you.



advantage of this search engine compare to window index.
1. fast
2. light
3. efficient




If you use everything, you will save your working time to find files.

Monday, July 27, 2015

Android Studio 첫번째

이클립스를 쓰다가 안드로이드로 바꾸려고 하니 엄청 복잡하다.
먼저 이전쓰던 소스들의 환경을 Android Studio 에 맞게 적용을 해야하는데 먼가가 너무 복잡하다.

처음에 이클립스에서 Android Studio 소스로 바꿔주는 Export 로 해서 뽑아냈는데.. 
내가 Android Studio를 잘 사용 못해서인지 Android 스튜디오에서는 돌아가질 않는다..

어찌해야 하나?? 이것저것 인터넷 찾아가면서 해봤는데도 안되네..
target version이 10으로 되어야 하는데.. 빌드툴버전도 있고 먼가가 복잡한데..
다시 초심으로 돌아가서
프로젝트를 하나 생성하고 파일을 하나씩 옮기기로 결정..

프로젝트를 딱 만드니.. 이건 머야?? 
mipmap 이라는 폴더도 있고 여기는 프로젝트 아이콘이 들어있던데..
시작이 반이라고 했던가 오늘 환경설정 셋팅을 마치고야 말테다..

Tuesday, July 21, 2015

페이스북 작성일 표시법 javascript source

프로젝트를 진행하다 보면 날짜를 어떻게 보여줄것인지에 대해서 많이 생각을 하게 됩니다.
어떤곳은 yyyy/mm/dd 형식으로 뿌려주는곳도 있고 dd/mm/yyyy 이런식으로 뿌려주는곳도 있는데요 
머 보여주고자 하는 content의 의도에 따라 달라질거라고 생각합니다.

ex) 2015-07-22 12:00 

그래서 요즘 그래도 핫한 페이스북에서는 어떠한 방식으로 보여주는지 확인해보았더니

방금전
2분
2시간
23시간
어제 오전 2시
어제 오후 8시
7월 19일 오후 11:55 (해당년에 대한 작성일)
2013년 12월 7일     (년도가 다른 날짜)

조금 더 사용자 관점과  보여주고자 하는 내용만 표시하고 '최근이 일어난 일이구나 라는' "실시간" 느낌을 받았습니다.

그래서 페이스북의 한국 시간보여주는거에 맞춰서 한번 library로 만들어봤는데 허접하지만 혹시 필요하신분 있으시면 
사용하셔도 됩니다.
추가적으로 영어까지 지원할 생각인데.. 음... 헛 ㅡ.ㅡ;;

Thursday, July 16, 2015

Euler Problem 220 Heighway Dragon or Dragon Curve

The subject of this problem is Heighway Dragon~!
https://projecteuler.net/problem=220

Let D0 be the two-letter string "Fa". For n≥1, derive Dn from Dn-1 by the string-rewriting rules:
"a" → "aRbFR"
"b" → "LFaLb"
Thus, D0 = "Fa", D1 = "FaRbFR", D2 = "FaRbFRRLFaLbFR", and so on.
These strings can be interpreted as instructions to a computer graphics program, with "F" meaning "draw forward one unit", "L" meaning "turn left 90 degrees", "R" meaning "turn right 90 degrees", and "a" and "b" being ignored. The initial position of the computer cursor is (0,0), pointing up towards (0,1).
Then Dn is an exotic drawing known as the Heighway Dragon of order n. For example, D10 is shown below; counting each "F" as one step, the highlighted spot at (18,16) is the position reached after 500 steps.
What is the position of the cursor after 1012 steps in D50 ?
Give your answer in the form x,y with no spaces.


Approaches

1. make this way using by phyton and turtle.
2. think more deeply to solve it.
3. I have to find pattern or math skill.

this is my phython coding.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
__author__ = 'ddavid'


import turtle

a = 'aRbFR'
b = 'LFaLb'

s = 'Fa'

wn = turtle.Screen()      # Creates a playground for turtles
tt = turtle.Turtle()    # Create a turtle, assign to alex
tt.speed(0)
tt.left(90)
tt.left(90)

for i in range(14):
    s = s.replace('a', 't')
    s = s.replace('b', 'p')
    s = s.replace('t', a)
    s = s.replace('p', b)

    print(s)
    print('\n')

    if i == 9:
        for d in range(len(s)):
            print(s[d-1])
            if s[d-1] == 'F':

                tt.forward(2)
            elif s[d-1] == 'L':
                tt.left(90)
            elif s[d-1] == 'R':
                tt.right(90)

wn.mainloop()             # Wait for user to close window


if you run this code
you will see this result.

Have Fun~ enyoing euler problem site.

reference
https://en.wikipedia.org/wiki/Dragon_curve


Tuesday, July 7, 2015

Project euler 169 found clue

I thought about one hour to come up with idea.

just find F(10^25)

1 : 1
2 : 2
3 : 1
4 : 3
5 : 2
6 : 3
7 : 1
8 : 4
9 : 3
10 : 5
11 : 2
12 : 5
13 : 3
14 : 4
15 : 1
16 : 5
17 : 4
18 : 7
19 : 3
20 : 8
21 : 5
22 : 7
23 : 2
24 : 7
25 : 5
26 : 8
27 : 3
28 : 7
29 : 4
30 : 5
31 : 1
32 : 6
33 : 5
34 : 9
35 : 4
36 : 11
37 : 7
38 : 10
39 : 3
40 : 11
41 : 8
42 : 13
43 : 5
44 : 12
45 : 7
46 : 9
47 : 2
48 : 9
49 : 7
50 : 12
51 : 5
52 : 13
53 : 8
54 : 11
55 : 3
56 : 10
57 : 7
58 : 11
59 : 4
60 : 9
61 : 5
62 : 6
63 : 1
64 : 7
65 : 6
66 : 11
67 : 5
68 : 14
69 : 9
70 : 13
71 : 4
72 : 15
73 : 11
74 : 18
75 : 7
76 : 17
77 : 10
78 : 13
79 : 3
80 : 14
81 : 11
82 : 19
83 : 8
84 : 21
85 : 13
86 : 18
87 : 5
88 : 17
89 : 12
90 : 19
91 : 7
92 : 16
93 : 9
94 : 11
95 : 2
96 : 11
97 : 9
98 : 16
99 : 7
100 : 19

Make Intene Action_View receiver

This is the way to make my app would be exposed to other app when clicking some file.

reference by developer site
http://developer.android.com/training/sharing/receive.html


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package com.example.viewer;

import java.io.File;
import java.util.ArrayList;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.widget.Toast;

import com.example.com.example.viewer.R;

public class MainActivity extends Activity{

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  
  
  File file = new File(Environment.getExternalStorageDirectory() + "/download/shared.txt");
    Toast.makeText(getApplication(), "lenth " + file.length(), 0).show();

      Toast.makeText(getApplication(), "is deleted? " + file.delete(), 0).show();
    
     // Get intent, action and MIME type
     Intent intent = getIntent();
     String action = intent.getAction();
     String type = intent.getType();
     Toast.makeText(getApplication(), "action" + action +" : type " + type, 1).show();
     if (Intent.ACTION_VIEW.equals(action) && type != null) {
         if ("text/plain".equals(type)) {
             handleSendText(intent); // Handle text being sent
         } else if (type.startsWith("image/")) {
             handleSendImage(intent); // Handle single image being sent
         }
     } else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
         if (type.startsWith("image/")) {
             handleSendMultipleImages(intent); // Handle multiple images being sent
         }
     } else {
         // Handle other intents, such as being started from the home screen
     }
 }

 void handleSendText(Intent intent) {
     String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
     
     Uri uri= intent.getData();
     Toast.makeText(getApplication(), "pa " + uri.getPath(), 1).show();
     
     
     File file = new File(uri.getPath());
     
     Toast.makeText(getApplication(), "lenth " + file.length(), 0).show();

     
     Toast.makeText(getApplication(), "is deleted? " + file.delete(), 0).show();
     
     Toast.makeText(getApplication(), "lenth " + new File(uri.getPath()).length(), 0).show();
     
     
     
     Toast.makeText(getApplication(), "ajdidjdi" + sharedText, 1).show();
     Uri imageUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
     if (imageUri != null) {
      String st = imageUri.getPath();
      //
      Toast.makeText(getApplication(), "" + st, 1).show();
     }
     
     if (sharedText != null) {
      // Update UI to reflect text being shared
      
      Toast.makeText(getApplication(), "" + sharedText, 1).show();
     }
 }

 void handleSendImage(Intent intent) {
     Uri imageUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
     if (imageUri != null) {
         // Update UI to reflect image being shared
     }
 }

 void handleSendMultipleImages(Intent intent) {
     ArrayList<Uri> imageUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
     if (imageUris != null) {
         // Update UI to reflect multiple images being shared
     }
 }
}



ManifestFile
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 <activity
            android:name="com.example.viewer.MainActivity"
            android:configChanges="keyboardHidden|orientation"
            android:label="@string/app_name" 
            android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>  
                <category android:name="android.intent.category.DEFAULT"/>  
                <category android:name="android.intent.category.BROWSABLE"/>  
            </intent-filter>         
            <intent-filter>
          <action android:name="android.intent.action.SEND" />
          <category android:name="android.intent.category.DEFAULT" />
          <data android:mimeType="image/*" />
      </intent-filter>
      <intent-filter>
          <action android:name="android.intent.action.VIEW" />
          <category android:name="android.intent.category.DEFAULT" />
          <data android:mimeType="text/plain" />
      </intent-filter>
      <intent-filter>
          <action android:name="android.intent.action.SEND_MULTIPLE" />
          <category android:name="android.intent.category.DEFAULT" />
          <data android:mimeType="image/*" />
      </intent-filter>   
        </activity>

Thursday, July 2, 2015

nodejs + webstrom + express sample app guide

This article is about how to make sample express app using webstrom

I captured few pictures and just follow the steps






This is really sample and I will post how to start project later on.