2014년 9월 9일 화요일

string이 URL 형태인지 체크 (Java)


import java.net.MalformedURLException;
import java.net.URL;


try { URL url = new URL("url_string"); }
catch (MalformedURLException e) { /* invalid URL */ }



http://stackoverflow.com/questions/9902265/find-out-the-string-is-url

2014년 9월 2일 화요일

Permission issue of Apache2 on OSX Mavericks

Permission issue of Apache2 on OS X Mavericks :



sudo vi /private/etc/apache2/httpd.conf

Just replace "Deny" with "Allow"

    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
#    Deny from all
    Allow from all

Restart Apache server :
sudo apachectl restart

"It works!"

2014년 9월 1일 월요일

Lemon 설치


아래와 같이 Policy 때문에 설치가 안됨.
관련 문서 : http://www.cmake.org/cmake/help/v3.0/policy/CMP0048.html

$ cmake ..
CMake Error at CMakeLists.txt:3 (CMAKE_POLICY):
  Policy "CMP0048" is not known to this version of CMake.

CMakeLists.txt 에서 주석처리함.

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

#CMAKE_POLICY(SET CMP0048 OLD)

SET(PROJECT_NAME "LEMON")
PROJECT(${PROJECT_NAME})


$ cmake ..
CMake Error at CMakeLists.txt:3 (CMAKE_POLICY):
  Policy "CMP0048" is not known to this version of CMake.


-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.3")
-- Found Wget: /usr/bin/wget
-- Found Doxygen: /usr/bin/doxygen
-- Found Ghostscript: /usr/bin/gs
-- Found GLPK: /usr/lib/libglpk.so (Required is at least version "4.33")
-- Could NOT find ILOG (missing:  ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR)
-- Could NOT find COIN (missing:  COIN_INCLUDE_DIR COIN_CBC_LIBRARY COIN_CBC_SOLVER_LIBRARY COIN_CGL_LIBRARY COIN_CLP_LIBRARY COIN_COIN_UTILS_LIBRARY COIN_OSI_LIBRARY COIN_OSI_CBC_LIBRARY COIN_OSI_CLP_LIBRARY)
-- Could NOT find SOPLEX (missing:  SOPLEX_LIBRARY SOPLEX_INCLUDE_DIR)
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long long
-- Check size of long long - done
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Copy doc from source tree
-- Configuring incomplete, errors occurred!






2014년 8월 10일 일요일

Fragment 동적으로 만들떄

동적으로 만들때


xml 쪽에는
       android:id="@+id/fragment_place"
       android:layout_height="match_parent">
 

or

        android:id="@+id/fragment_place"
        android:layout_marginTop="120dp"
        android:layout_height="match_parent"
        android:layout_width="match_parent"        >
   


.java 파일에는
...
// Create new fragment and transaction
        Fragment newFragment = new FragmentDefault();
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
// Replace whatever is in the fragment_container view with this fragment,
// and add the transaction to the back stack
        transaction.replace(R.id.fragment_place, newFragment);
        transaction.addToBackStack(null);
// Commit the transaction
        transaction.commit();


https://github.com/codepath/android_guides/wiki/Creating-and-Using-Fragments

2014년 7월 31일 목요일

Android에서 키보드 사라지게 하기


다음처럼부르면 됨

DDUtil.setupUI(MainActivity.this, findViewById(R.id.parent));


다음처럼 간단히
public class DDUtil {
    public static void setupUI(final Activity activity, View view) {
        //Set up touch listener for non-text box views to hide keyboard.
        if(!(view instanceof EditText)) {
            view.setOnTouchListener(new View.OnTouchListener() {
                public boolean onTouch(View v, MotionEvent event) {
                    hideSoftKeyboard(activity);//MainActivity.this
                    return false;
                }
            });
        }
        //If a layout container, iterate over children and seed recursion.
        if (view instanceof ViewGroup) {
            for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
                View innerView = ((ViewGroup) view).getChildAt(i);
                setupUI(activity, innerView);
            }
        }
    }
    public static void hideSoftKeyboard(Activity activity)
    {
        InputMethodManager inputMethodManager = (InputMethodManager)  activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
        inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
    }
}



참고 :
http://stackoverflow.com/questions/4165414/how-to-hide-soft-keyboard-on-android-after-clicking-outside-edittext


2014년 7월 28일 월요일

Maya: parenting an object


parent 붙일child  parent노드


풀기 : unparent given object(s) -- parent to world
parent -w instrument_asm_10mm;

엮기
parent 붙일child  parent노드
parent coupler:IGES_Model_Data active_arm_v1_tmp:transform1094;


아래는 공식 사이트에서


// Move the circle under group2.
// Note that the circle remains where it is.
parent circle1 group2;


2014년 7월 9일 수요일

CMAttitudeReferenceFrame

Enum constants for indicating the reference frames from which all attitude samples are referenced.


typedef enum {
     CMAttitudeReferenceFrameXArbitraryZVertical = 1 << 0,
     CMAttitudeReferenceFrameXArbitraryCorrectedZVertical = 1 << 1,
     CMAttitudeReferenceFrameXMagneticNorthZVertical = 1 << 2,
     CMAttitudeReferenceFrameXTrueNorthZVertical = 1 << 3
} CMAttitudeReferenceFrame


CMAttitudeReferenceFrameXArbitraryZVertical
: Describes a reference frame in which the Z axis is vertical and the X axis points in an arbitrary direction in the horizontal plane.

CMAttitudeReferenceFrameXArbitraryCorrectedZVertica
: Describes the same reference frame as CMAttitudeReferenceFrameXArbitraryZVertical except that the magnetometer, when available and calibrated, is used to improve long-term yaw accuracy. Using this constant instead of CMAttitudeReferenceFrameXArbitraryZVertical results in increased CPU usage.

CMAttitudeReferenceFrameXMagneticNorthZVertical
: Describes a reference frame in which the Z axis is vertical and the X axis points toward magnetic north. Note that using this reference frame may require device movement to calibrate the magnetometer.

CMAttitudeReferenceFrameXTrueNorthZVertical
: Describes a reference frame in which the Z axis is vertical and the X axis points toward true north. Note that using this reference frame may require device movement to calibrate the magnetometer. It also requires the location to be available in order to calculate the difference between magnetic and true north.

all available in iOS 5.0 and later.


source : Apple dev page.

2014년 7월 6일 일요일

atan2

The atan2 function takes into account the signs of both vector components, and places the angle in the correct quadrant.



The following expression derived from the tangent half-angle formula can also be used to define atan2.




from http://en.wikipedia.org/wiki/Atan2

2014년 7월 1일 화요일

CWnd::~CWnd


Warning: calling DestroyWindow in CWnd::~CWnd; OnDestroy or PostNcDestroy in derived class will not be called.


Callback code

/* Return code for callbacks, determines whether the operation is finished
   and will unscheduled, or whether it will continue running. */

typedef unsigned int HDCallbackCode;
#define HD_CALLBACK_DONE     0
#define HD_CALLBACK_CONTINUE 1

from
\OpenHaptics\Academic\3.2\include\HD\hdScheduler.h

2014년 5월 29일 목요일

Missing Solidworks menu bar



HKEY_CURRENT_USER\Software\SolidWorks\Solidworks 2010\User Interface\CommandManager - Switch the Dock State to something something else.  In other words if it is et to "1" set it to "0".

from https://forum.solidworks.com/message/203457#203457

2014년 5월 20일 화요일

ofVec3f.h

아래처럼 벡터 클래스 개조

float * getPtr()
{
return (float*)&x;
}

float& operator[]( int n )
{
return getPtr()[n];
}


from ofVec3f.h

2014년 5월 18일 일요일

미터 규격 나사 부호 매기는 법

미터 규격 나사 부호 매기는 법






규격 비교표

2014년 5월 8일 목요일

IEEE 저널 Single column latex format


IEEE 저널 Single column latex format

Default:
\documentclass[10pt,journal,cspaper,compsoc]{IEEEtran}

--> 이걸로 변경
\documentclass[journal,10pt,draftclsnofoot,onecolumn]{IEEEtran}

from http://www.michaelshell.org/tex/ieeetran/