Mac – TextEditor 쓸만한거..

XCode도 물론 훌륭하긴한데.. 로딩속도도 느리고
언어별 커스터마이징이 약한것같다.

TextWrangler
Emacs
AquaEmacs
뭐 요런것들 써봤었는데…

Emacs게열은 괜찮기는 한데… 파일 여러개 편집하는 기능이 좀 후졌었고
TextWrangler는 편집기가 좀 후졌었고…

오래 써보진 않았는데 색감이 맘에든다

Hibernate nativesql 사용시 발생하는 문제

Exception String : org.hibernate.loader.custom.NonUniqueDiscoveredSqlAliasException: Encountered a duplicated sql alias [coalesce] during auto-discovery of a native-sql query

환경 : Postgresql, Hibernate 4.x, Java7, Spring3.1 … etc

상황 : 복잡한 조인을 사용해서 DB의 데이터를 조회해야하는 상황..HQL은 익숙하지 않고 Criteria로 하기에는 불편한 상황이라서 native sql을 사용하려고 했는데….

pgadmin에서 돌렸을 때 아무 문제도 없는 상황인데 session.createSQLQuery(queryString)을 사용하면 문제가 발생했다.

 

처리 :

alias문제… coalesce 함수를 두번 사용했는데 두개가 동일한 alias name으로 인식된 것 같다. pagadmin에서는 문제가 없었다.  as iteam1, as item2와 같이 두개에 다른 이름을 부여하니 문제없이 정상 동작했다.

 

 

엑셀에서 방위 계산하는 VBA코드

데이터 샘플이 이런 형태

A            B        c

WindSpeed1 WindDir1
6.0 276.9
5.8 346.1
8.1 276.3
7.1 253.4
4.9 256.1
6.8 275.4

Sub ChangeDir()
    Dim num As Double
    num = ActiveCell.Offset(0, -1).Value
    ' ActiveCell.Offset(0,-1).Value
    Debug.Print (num)

    ' If IsEmpty(num) Or num = 0 Then
    If ActiveCell.Offset(0, -2).Value < 0.4 Then
        ActiveCell.Value = "Calm"
    ElseIf IsEmpty(ActiveCell.Offset(0, -1).Value) Then
        ActiveCell.Value = ""
    ElseIf Scope(11.25, 33.75, num) Then
        ActiveCell.Value = "NNE"
    ElseIf Scope(33.75, 56.25, num) Then
        ActiveCell.Value = "NE"
    ElseIf Scope(56.25, 78.75, num) Then
        ActiveCell.Value = "ENE"
    ElseIf Scope(78.75, 101.25, num) Then
        ActiveCell.Value = "E"
    ElseIf Scope(101.25, 123.75, num) Then
        ActiveCell.Value = "ESE"
    ElseIf Scope(123.75, 146.25, num) Then
        ActiveCell.Value = "SE"
    ElseIf Scope(146.25, 168.75, num) Then
        ActiveCell.Value = "SSE"
    ElseIf Scope(168.75, 191.25, num) Then
        ActiveCell.Value = "S"
    ElseIf Scope(191.25, 213.75, num) Then
        ActiveCell.Value = "SSW"
    ElseIf Scope(213.75, 236.25, num) Then
        ActiveCell.Value = "SW"
    ElseIf Scope(236.25, 258.75, num) Then
        ActiveCell.Value = "WSW"
    ElseIf Scope(258.75, 281.25, num) Then
        ActiveCell.Value = "W"
    ElseIf Scope(281.25, 303.75, num) Then
        ActiveCell.Value = "WNW"
    ElseIf Scope(303.75, 326.25, num) Then
        ActiveCell.Value = "NW"
    ElseIf Scope(326.25, 348.75, num) Then
        ActiveCell.Value = "NNW"
    Else
        ActiveCell.Value = "N"
    End If

    num = ActiveCell.Offset(1, 0).Select

End Sub

Function Scope(small As Double, big As Double, num As Double)

    If small <= num And num < big Then
        Scope = True
    Else
        Scope = False
    End If

End Function