Showing posts with label Misc. Show all posts
Showing posts with label Misc. Show all posts

Multiple Gammu Service

0 comments
Membuat Servis Gammu :
1. Gammu-smsd -c smsd -i   (Servis Gammu dengan nama Standar GammuSMSD)
2. Gammu-smsd -i -c smsdrc -n Modem1 (Servis Gammu dengan Nama Modem1)

Gammu-smsd -i -c [NamaSmsdrc] -n [NamaService]
Contoh :
Gammu-smsd -i -c smsdrc -n Gammu1
Gammu-smsd -i -c smsdrc1 -n Gammu2

Menghapus Servis :
1. Gammu-smsd -u (Menghapus servis gammu dengan nama standar GammuSMSD)
2. Gammu-smsd -n Modem1 -u (Hapus servis Gammu dengan nama Modem1)

gammu-smsd -n [NamaService] -u
Contoh :
gammu-smsd -n Gammu1 -u
gammu-smsd -n Gammu2 -u

Menjalankan Service :
gammu-smsd -c [NamaSmsdrc] -n [NamaService] -s
Contoh :
gammu-smsd -c smsdrc -n Gammu1 -s
gammu-smsd -c smsdrc1 -n Gammu2 -s

Menghentikan Service :
gammu-smsd -c [NamaSmsdrc] -n [NamaService] -k
Contoh :
gammu-smsd -c smsdrc -n Gammu1 -k
gammu-smsd -c smsdrc1 -n Gammu2 -k


/ untuk cek koneksi dengan modem/HP apakah bekerja dengan baik
gammu identify
// untuk mengirim SMS tanpa database
gammu sendsms TEXT 08xxxxxxxxxx -text coba
// untuk install service gammu
gammu-smsd -c smsdrc -i
// untuk menjalankan service gammu
gammu-smsd -c smsdrc -s
// untuk mengirim sms dengan metode inject
gammu-smsd-inject -c smsdrc TEXT 08xxxxxxxxxx -text coba
// untuk mengirim sms dengan metode inject dengan jumlah karakter > 166
gammu-smsd-inject -c smsdrc EMS 08xxxxxxxxxx -text coba
// untuk stop service gammu
gammu-smsd -c smsdrc -k
// untuk uninstall service gammu
gammu-smsd -c smsdrc -u

Copy Paste Clipboard

0 comments
'Menggunakan Copy Paste dengan Clipboard di VB6
Private Sub Command1_Click()
    'Mengosongkan Clipboard
    Clipboard.Clear
    'Menentukan Clipboard
    Clipboard.SetText Text1.Text
End Sub

Private Sub Command2_Click()
    'Mengambil Data Teks dari Clipboard
    Text1.Text = Clipboard.GetText
End Sub

Optimasi SQL

0 comments


 Database administrator dan programmer sering menggunakan SQL (Structured Query Language) untuk memberikan instruksi kepada database. Tetapi hati-hati, berikan instruksi yang tepat agar database Anda tidak ngambek.

JIKA DIIBARATKAN manusia, database adalah sahabat yang patuh dan mengerti pada setiap perintah yang diberikan, sayangnya terkadang tidak berlaku sebaliknya, kita tidak patuh dan tidak mengerti pada “perintah” yang diberikan database. 

Database kadang dapat “mengomel” dengan berbagai cara, bisa jadi dalam bentuk performance yang menurun, pesan kesala han, atau bahkan hasil laporan yang tidak sesuai. Semua-nya dapat kita minimalisasi, bahkan sebelum hal itu terjadi.

SQL dan RDBMS


10 Tips and Trick Visual Basic From Vb Bego Forum

1.Denied deletion file, this trick are open the file for simultan so the windows couldn’t delete the file until the aplication end or stopped
Source Code :
Private Sub Form_Load()
timer1.interval = 1
End Sub

Private sub timer1_timer()
Open "PathFilenya" For Input As 1
End Sub
2.Random Coloured label, this trick will change your label each sec
Source Code :
Private Sub Timer1_Timer()
randomize()
Label1.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
End Sub
3.Set the Attributes file without API function
Source Code :
Private Sub Command1_Click()
Setattr pathname,vbhidden+vbsystem+vbreadonly
End Sub

'To make it normal
Private Sub Command1_Click()
Setattr pathname,vbnormal
End Sub
4. Animated form when unload
Source Code :
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
'The form go up
Do Until Me.Top <= -5000
DoEvents
Me.Move Me.Left, Me.Top – 10
DoEvents
Loop
Unload Me
End Sub

Register Components without using Regsvr32.exe

0 comments
Before you can use an DLL or an OCX you must register it. Registering a component places information about the control in the system registry. Once the control has been registered, applications and development environments can search the registry to determine which components have been installed. Most developers use the Package and deployment wizard to register their components. However, it is occasionally useful to make your own setup kit. The most common method of doing this usually involves shelling Regsvr32.exe. The main problem with shelling Regsvr32.exe is that it is relatively difficult to see if the component was successfully registered.
The following code shows how to register DLL/Ocx components (including ActiveX EXE's) :
Option Explicit

Private Declare Function LoadLibraryA Lib "kernel32" (ByVal lLibFileName As String) As Long
Private Declare Function CreateThread Lib "kernel32" (lThreadAttributes As Any, ByVal lStackSize As Long, ByVal lStartAddress As Long, ByVal larameter As Long, ByVal lCreationFlags As Long, lThreadID As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal lMilliseconds As Long) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lProcName As String) As Long
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function GetExitCodeThread Lib "kernel32" (ByVal hThread As Long, lExitCode As Long) As Long
Private Declare Sub ExitThread Lib "kernel32" (ByVal lExitCode As Long)

'Purpose   :    This function registers and Unregisters OLE components
'Inputs    :    sFilePath                       The path to the DLL/OCX or ActiveX EXE
'               bRegister                       If True Registers the control, else unregisters control
'Outputs   :    Returns True if successful
'Notes     :    This is the API equivalent of RegSvr32.exe.
'Example   :
'               If RegisterComponent("C:\MyPath\MyFile.dll") = True Then
'                   Msgbox "Component Successfully Registered"
'               Else
'                   Msgbox "Failed to Registered Component"
'               End If
'Revisions :    1/Jan/2002. Updated to include code for registering ActiveX Exes.

Function RegisterComponent(ByVal sFilePath As String, Optional bRegister As Boolean = True) As Boolean
    Dim lLibAddress As Long, lProcAddress As Long, lThreadID As Long, lSuccess As Long, lExitCode As Long, lThread As Long
    Dim sRegister As String
    Const clMaxTimeWait As Long = 20000     'Wait 20 secs for register to complete
    
    On Error GoTo ErrFailed
    If Len(sFilePath) > 0 And Len(Dir(sFilePath)) > 0 Then
        'File exists
        If UCase$(Right$(sFilePath, 3)) = "EXE" Then
            'Register/Unregister ActiveX EXE
            If bRegister Then
                'Register EXE
                Shell sFilePath & " /REGSERVER", vbHide
            Else
                'Unregister ActiveX EXE
                Shell sFilePath & " /UNREGSERVER", vbHide
            End If
            RegisterComponent = True
        Else
            'Register/Unregister DLL
            If bRegister Then
                sRegister = "DllRegisterServer"
            Else
                sRegister = "DllUnRegisterServer"
            End If
            
            'Load library into current process
            lLibAddress = LoadLibraryA(sFilePath)
            
            If lLibAddress Then
                'Get address of the DLL function
                lProcAddress = GetProcAddress(lLibAddress, sRegister)
                If lProcAddress Then
                    lThread = CreateThread(ByVal 0&, 0&, ByVal lProcAddress, ByVal 0&, 0&, lThread)
                    If lThread Then
                        'Created thread and wait for it to terminate
                        lSuccess = (WaitForSingleObject(lThread, clMaxTimeWait) = 0)
                        If Not lSuccess Then
                            'Failed to register, close thread
                            Call GetExitCodeThread(lThread, lExitCode)
                            Call ExitThread(lExitCode)
                            RegisterComponent = False
                        Else
                            'Successfully registered component
                            RegisterComponent = True
                            Call CloseHandle(lThread)
                        End If
                    End If
                    Call FreeLibrary(lLibAddress)
                Else
                    'Object doesn't expose OLE interface
                    Call FreeLibrary(lLibAddress)
                End If
            End If
        End If
    End If
    Exit Function

ErrFailed:
    Debug.Print Err.Description
    Debug.Assert False
    On Error GoTo 0

End Function
 
VB Source Code | © 2011 Design by DheTemplate.com and Theme 2 Blog

Find more free Blogger templates at DheTemplate.com - Daily Updates Free Blogger Templates