Source Code PHP Expert Systems Applications

Hello friend of the Smart Learning PHP, still at the end of 2012 ya. This time I wanted to share with you a PHP application, ie the application of expert systems. Friend already knew what it was all an expert system?


Expert System is an artificial system or application where we can consult the expert of a field through short questions contained in a program that ended up on the questions that we answer will result in a conclusion and a solution that can solve our problems. Almost as much as we consult the doctor, the doctor will ask us what our complaints and what we feel and he will tell us what we are and what the cure disease. Well so does the Expert Systems Applications.
Examples of Expert Systems Expert Systems Applications Doctor is Online. Where are we going to get some questions about our condition and we can finally find out what the disease was in our bodies. This application is similar to the display zoom poll application.

On this post I give Source Code Computer Consulting expert system with PHP. That is a website where you can consult about the state of the computer and in the end you will find a solution to solve a computer problem.

Source Code Application Expert System is still very simple and the data in it is still small. It is intended that you are challenged to further develop this source code.


Changing Border Color of Controls

 
Existing controls in VB does not provide a property to change the color bordernya. So if you want to change the color bordernya additional code is required.

How to make it as below:

Create a new project with a form and a Module therein.

Module type in the following code:

[ VB 6.0 ]
Private Declare Function CreateRectRgn Lib "gdi32.dll" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32.dll" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CreateSolidBrush Lib "gdi32.dll" (ByVal crColor As Long) As Long
Private Declare Function FrameRgn Lib "gdi32.dll" (ByVal hDC As Long, ByVal hRgn As Long, ByVal hBrush As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long

Public Sub BorderColor(ByVal Ctl As Control, ByVal lColor As OLE_COLOR, Optional ByVal BorderWidth As Integer = 2)
    Dim l As Long
   
    l = CreateRectRgn(BorderWidth, BorderWidth, (Ctl.Width / Screen.TwipsPerPixelX) - BorderWidth, (Ctl.Height / Screen.TwipsPerPixelY) - BorderWidth)
    SetWindowRgn Ctl.hwnd, l, False

    l = CreateRectRgn(Ctl.Left / Screen.TwipsPerPixelX, Ctl.Top / Screen.TwipsPerPixelY, Ctl.Width / Screen.TwipsPerPixelX + (Ctl.Left / Screen.TwipsPerPixelX), Ctl.Height / Screen.TwipsPerPixelY + (Ctl.Top / Screen.TwipsPerPixelY))
    FrameRgn Ctl.Container.hDC, l, CreateSolidBrush(lColor), BorderWidth, BorderWidth
End Sub

[ VB .NET ]
Private Declare Function CreateRectRgn Lib "gdi32.dll" (ByVal X1 As Integer, ByVal Y1 As Integer, ByVal X2 As Integer, ByVal Y2 As Integer) As Integer
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Integer, ByVal hRgn As Integer, ByVal bRedraw As Boolean) As Integer
Private Declare Function CreateSolidBrush Lib "gdi32.dll" (ByVal crColor As Integer) As Integer
Private Declare Function GetDC Lib "user32.dll" (ByVal hwnd As Integer) As Integer
Private Declare Function FrameRgn Lib "gdi32.dll" (ByVal hdc As Integer, ByVal hRgn As Integer, ByVal hBrush As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer

Public Sub BorderColor(ByVal Ctl As Control, ByVal lColor As Color, Optional ByVal BorderWidth As Integer = 1)
        Dim i As Integer

        i = CreateRectRgn(BorderWidth, BorderWidth, Ctl.Width - BorderWidth, Ctl.Height - BorderWidth)
        SetWindowRgn(Ctl.Handle, i, False)

        i = CreateRectRgn(Ctl.Left, Ctl.Top, Ctl.Width + Ctl.Left, Ctl.Height + Ctl.Top)
        FrameRgn(GetDC(Ctl.Parent.Handle), i, CreateSolidBrush(CInt(ColorTranslator.ToWin32(lColor))), BorderWidth, BorderWidth)
End Sub


Now create a TextBox on Form1 and for example you want to change the color to blue bordernya, then write the following code in the 'Form_Paint' of Form1:[ VB 6.0 ]
BorderColor Text1, vbBlue
[ VB .NET ]
BorderColor(TextBox1, Color.Blue)



NOTE:

- For users of VB 6.0, which will be replaced when the control is placed in a PictureBox bordernya color, then the property "AutoRedraw" of PicturBox should value "True".

- For users of VB 6.0, which will be replaced when the control is placed in the color bordernya Frame or Tab, then the above methods can not be used. The solution create a PictureBox (AutoRedraw property = True; BorderStyle = 0) to the Frame or Tab, the new control will replaced bordernya colors placed in the PictureBox.

Figures TextBox Class

Usually when you want to create a TextBox that can only be filled with the numbers made ​​any procedure in the TextBox. If the TextBox is only 1 or 2 may not be a problem,
but what if 10 pieces. It will be less efficient because a lot of code duplication. Because it needs to be made specifically TextBox Class numbers to save the code.

CrystalReport Without Database

Not always use CrystalReport must use the Database. Here are examples of its application in the manufacture of Name Card application.

Calculating Date Difference

When you need a code to calculate the date difference between 2 data either day, month, or year, the following example:

Fungsi : DateDiff( Interval Type, First Date, Second Date )

Jenis IntervalKeterangan
dDay (Hari)
mMonth (Bulan)
yyyyYear (Tahun)
hHour (Jam)

nMinute (Menit)
sSecond (Detik)
wwWeek (Minggu)
qQuater (4 Bulan)

Suppose you want to calculate the difference in days between the date of January 15, 2012 (written # 01/15/2012 #) and 20 Jan 2012, which means it will use a type of interval "d".t = DateDiff("d", #1/15/2012#, #1/20/2012#) , hasilnya 5
If the date obtained from controls such as the DateTimePicker, then the code:t = DateDiff("d", DateTimePicker1.Value, DateTimePicker2.Value)

Round Decimal Numbers

Many ways in VB to round a number / decimal numbers into integers. If you do not understand, here's a brief explanation:
  •      Automatic rounding
     Rounding is done automatically depending on the number is.
     If the primary number is odd and decimal numbers> = 0.5, then the rounding up (main numbers plus 1) and if the decimal number <0.5, then the rounding down.
     However, if the main number is 0 or even, and decimal numbers> 0.5, then the rounding up and when the decimal number <= 0.5, then the rounding down.
     i = CInt (0.4), the result is 0
     i = CInt (0.5), the result is 0
     i = CInt (0.6), the result 1
     i = CInt (1.4), the result 1
     i = CInt (1.5), the result is 2
     i = CInt (1.6), the result is 2
  •      Rounding Always Down
     Rounding is done is always down any decimal digit. In other words, would eliminate the decimal numbers.
     i = Int (1.1), the result 1
     i = Int (1.5), the result 1
     i = Int (1.8), the result 1
  •      Always rounding to the Top
     Rounding is done is always up regardless of decimal numbers.
     i =-Int (- (1.1)), the result is 2
     i =-Int (- (1.5)), the result is 2
     i =-Int (- (1.8)), the result is 2
  •      Rounding The Specified
     Rounding is done according to a predetermined limit.
     So if the decimal number> = limit then the rounding up and when the decimal number <limit then the rounding down.
     For example, the prescribed limit is 0.4 code like this:
  • Dim Nilai As Double, Hasil As Long

    Nilai = 1.4 'bilangan yg akan dibulatkan

    Hasil = Int(Nilai) + IIf(CDbl(CStr(Nilai - Int(Nilai))) >= 0.4, 1, 0) 'Batas = 0,4

    MsgBox Hasil 'pesan Hasil = 2

Reforming Child Form in MDI Form

If you're making project that uses MDI Form, there is good to add code to set the Child Form to make it look neat.
  • Cascade

    Kode :
    [ VB 6.0 ] Me.Arrange vbCascade
    [ VB .NET ] Me.LayoutMdi(MdiLayout.Cascade)

  • Tile Horizontal

    Kode :
    [ VB 6.0 ] Me.Arrange vbTileHorizontal
    [ VB .NET ] Me.LayoutMdi(MdiLayout.TileHorizontal)

  • Tile Vertical

    Kode :
    [ VB 6.0 ] Me.Arrange vbTileVertical
    [ VB .NET ] Me.LayoutMdi(MdiLayout.TileVertical)


To facilitate the user to use it, you can create a special menu like this:

Application Block Websites

This is an application used to block or blocking pulled Computer to access the website / specific sites of the Browser.

Pinger apps

As the name implies, this application is useful to ping the website. This application is also useful for stabilizing a weak internet connection.

ListBox can be in Edit


In order for the items contained in the ListBox can be edited, it would require a special way by combining it with the TextBox. Here's how:

    1. Add 1 ListBox, then 1 TextBox (property Visible = False) to the Form.
    1. Type this code in the event ListBox1_MouseDoubleClick:
      Dim i As Integer = ListBox1.SelectedIndex
      If i < 0 Then Exit Sub

      With TextBox1
        .Top = ListBox1.GetItemRectangle(i).Top + ListBox1.Top
        .Left = ListBox1.GetItemRectangle(i).Left + ListBox1.Left

        .Text = ListBox1.Items(i)
        .Visible = True
        .Focus()
      End With

    2. Type This code in event TextBox1_KeyPress :
      If e.KeyChar = Chr(Keys.Enter) Then
        ListBox1.Items(ListBox1.SelectedIndex) = TextBox1.Text
        TextBox1.Visible = False
      ElseIf e.KeyChar = Chr(Keys.Escape) Then
        TextBox1.Visible = False
      End If

    3. Type This code in event TextBox1_LostFocus :
      TextBox1.Visible = False

    4. For the experiment, you can fill out the items by typing in this code in event Form1_Load :
      Dim i As Integer
      For i = 1 To 100
        ListBox1.Items.Add("Item ke " & i)
      Next
    Run the application, and then double-click the item to be edited.

    Detect the version of MS Office

    The easiest way to detect the version of MS Office that are installed on the computer, that is by reading the registry value. Here's the code:

    Write the function code in the new module:
    Function VersiOffice(ByVal Aplikasi As String) As String
        On Error GoTo Ero
        Dim Reg As Object
        Dim s As String
          
        Set Reg = CreateObject("Wscript.Shell")
        s = Reg.RegRead("HKCR\" & Aplikasi & ".Application\CurVer\")
        VersiOffice = Replace(s, Aplikasi & ".Application.", "", , , 1)
      
    Ero:
    End Function

    Use code like this:
    Dim v As String
    v = VersiOffice("Word")
    If v <> "" Then
        MsgBox ("Microsoft Word versi " & v)
    Else
        MsgBox ("Microsoft Word tidak ter-install")
    End If

    Can be seen in the example above is used to detect the Word, then it can also be used to Excel, PowerPoint, Access, etc.

    Progress on the Taskbar


    Cara menambahkan Progress di Taskbar ini hanya bisa diterapkan pada Windows 7 menggunakan VB .NET. Library yang digunakannya adalah WindowsAPICodePack.

    Pressing the button with code

    Here's how to push Button / Button using code, so without doing click using the mouse pointer.

    Write the following code in the event '(Declarations)' of Form


    [VB 6.0]
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    [VB.Net]
    Private Declare Function SendMessage Lib"user32.dll" Alias "SendMessageA"(ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByRef lParam As Object) As Integer

    Const WM_LBUTTONDOWN = &H201
    Const WM_LBUTTONUP = &H202
    Now for practice use code like the following:
    [VB 6.0]
    SendMessage Command1.hwnd, &HF3, 1, 0
    Sleep 150
    SendMessage Command1.hwnd, &HF3, 0, 0

    Command1.Value = True 
    [VB.Net]
    SendMessage(Button1.Handle, WM_LBUTTONDOWN, 0, 0)
    Application.DoEvents()
    Threading.Thread.Sleep(150)
    SendMessage(Button1.Handle, WM_LBUTTONUP, 0, 0)

    Button1.PerformClick()

    Visual Styler


    Visual Styler is a control that is used to change the appearance of the form and its controls in it. The interface can be changed to such Office, Mac, or Vista.

    Its use is very easy, you just add the control to the Form Visual Styler. Then select the desired view in VisualStyle his property. After that save the Project to make changes.

    EDraw Office Viewer



    Edraw Office Viewer is used to help control displays office files Word, Excel, PowerPoint into a Form.

    Web Search Applications


    This application is a simple application that was made to make it easier for internet users in the internet web pecarian like using Google, Yahoo, Bing, etc.

     
    Support : Creating Website | Johny Template | Mas Template
    Copyright © 2011. Sanjaya Catur Blogging - All Rights Reserved
    Template Modify by Creating Website
    Proudly powered by Blogger