thaicosmic.com

หนัง

วันอังคารที่ 29 ตุลาคม พ.ศ. 2556

Chrome / Chromium: Aw, Snap! every page on 10.04 Lucid Lynx

sudo gedit /etc/apt/sources.list

deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu lucid main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu lucid main

sudo apt-get update
sudo apt-get upgrade

หรือ

sudo add-apt-repository ppa:chromium-daily/ppa
sudo apt-get update
sudo apt-get install chromium-browser


วันเสาร์ที่ 19 ตุลาคม พ.ศ. 2556

เปลี่ยน connection ของ jhcis

Public Function Check_Host(sserver As String, sschema As String, suser As String, spassword As String, sport As String) As Boolean
On Error GoTo errdesc
Dim conn As ADODB.Connection
   
    Set conn = New ADODB.Connection
 '   conn = "Driver={mySQL ODBC 3.51 Driver};Server=" & sserver & ";" & _
           "Port=" & sport & ";Option=10;Database=" & sschema & ";Uid=" & suser & ";Pwd=" & spassword & ";"
    conn = "Driver={mySQL ODBC 3.51 Driver};Server=" & sserver & ";" & _
           "Port=" & sport & ";Database=" & sschema & ";Uid=" & suser & ";Pwd=" & spassword & ";"
    conn.Open
    Check_Host = True
    conn.Close
    Set conn = Nothing
errdesc:
    If Err.Number <> 0 Then
        If Err.Description Like "*Unknown database*" Then
            MsgBox "หา Database บ่พ้อ", vbOKOnly + vbInformation, "Error..."
      '     MsgBox "Unknown Database specified.", vbOKOnly + vbInformation, "Error..."
            Check_Host = False
        ElseIf Err.Description Like "*Unknown MySQL server host*" Then
            MsgBox "ติดต่อ Server  ไม่ได้", vbOKOnly + vbInformation, "Error..."
    '       MsgBox "Unknown Server Host specified.", vbOKOnly + vbInformation, "Error..."
            Check_Host = False
        ElseIf Err.Description Like "*Access denied for user*" Then
            MsgBox "username หรือ password ไม่ถูกต้อง", vbOKOnly + vbInformation, "Error..."
   '        MsgBox "Wrong username or password specified.", vbOKOnly + vbInformation, "Error..."
            Check_Host = False
        ElseIf Err.Description Like "*Can't connect to MySQL server*" Then
            MsgBox "ติดต่อ  Mysql ไม่ได้", vbOKOnly + vbInformation, "Error..."
  '          MsgBox "Incorrent port no. or host server unknown.", vbOKOnly + vbInformation, "Error..."
            Check_Host = False
        End If
    End If
End Function

อ้างอิงฟังชั่นในไฟล์ mdb อื่นใน directory เดียวกัน

Function FixUpRefs()
Dim loRef As Access.Reference
Dim intCount As Integer
Dim intX As Integer
Dim blnBroke As Boolean
Dim strPath As String
Dim FoundSpacialRef As Boolean
On Error Resume Next

'Count the number of references in the database
intCount = Access.References.Count

'Loop through each reference in the database
'and determine if the reference is broken.
'If it is broken, remove the Reference and add it back.
FoundSpacialRef = False
For intX = intCount To 1 Step -1
            Set loRef = Access.References(intX)
            With loRef
                        blnBroke = .IsBroken
                        strPath = .FullPath
                        If blnBroke = True Or Err <> 0 Then
                     
                                strPath = .FullPath
                                With Access.References
                                                .Remove loRef
                                                .AddFromFile strPath
                                End With

                        End If
                '===
                        If .Name = "PolngpoleVba" Then
                                    FoundSpacialRef = True
                         End If
                    '===
            End With
Next

If FoundSpacialRef Then
    Access.References.Remove Access.References("PolngpoleVba")
End If
    Access.References.AddFromFile CurrentProject.Path & "\" & "PolngpoleVba.mdb"
 
Set loRef = Nothing

' Call a hidden SysCmd to automatically compile/save all modules.
Call SysCmd(504, 16483)
End Function

วันศุกร์ที่ 18 ตุลาคม พ.ศ. 2556

เพิ่มสถานบริการใน jhcis

VBA เพิ่มสถานบริการใน jhcis โดย ms-access 2003 ให้เปลี่ยนชื่อไฟล์สถานพยาบาลเป็น hospitals.txt แล้วใส่ใน โฟล์เดอร์เดียวกันกับไฟล์ access นี้

ในโมดูลใส่
Public Function GetDBPath() As String
    Dim strFullPath As String
    Dim i As Integer

    strFullPath = CurrentDb().Name

    For i = Len(strFullPath) To 1 Step -1
        If Mid(strFullPath, i, 1) = "\" Then
            GetDBPath = Left(strFullPath, i)
            Exit For
        End If
    Next
End Function

และในฟอร์มใส่
Private Sub Form_Load()
    CodeDb.Execute "INSERT INTO chospital ( hoscode, hosname, provcode, distcode, subdistcode, mu ) SELECT hospitals.F1, hospitals.F2, hospitals.F4," & _
    "hospitals.F5, hospitals.F6, hospitals.F7 FROM [Text;HDR=NO;FMT=Delimited(,);CharacterSet=874;Database=" & _
    GetDBPath & " ;].hospitals.TXT AS hospitals LEFT JOIN chospital ON hospitals.F1=chospital.hoscode WHERE (((chospital.hoscode) Is Null));"
End Sub

วันเสาร์ที่ 12 ตุลาคม พ.ศ. 2556

update java

su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
apt-get install oracle-java7-installer
exit