Monday, 13 January 2014

VB language reference (Keywords) [List of functions/methods]

Source: http://msdn.microsoft.com/en-us/library/xw8td0cx.aspx

Arrays Summary (Visual Basic)
What can be do to array? Action:
1. Verify an array: IsArray
2. Declare and initialize an array: Dim, Private, Public, ReDim
3. Find the limits of an array: LBound, UBound
4. Reinitialize an array: Erase, ReDim

Collection
Actions:
1. Create a collection object
2. Add an item to a collection
3. Remove an object from collection
4. Reference an item in a collection
5. Return a reference to an IEnumerator interface

Compiler Directive summary
Actions:
1. Define a compiler constant: #Const directive
2. Compile selected blocks of code
3. Collapse and hide sections of code
4. Indicate a mapping between source lines and text external to the source

Control flow summary
Actions:
1. Branch: GoTo, On Error
2. Exit or pause the program: End, Exit, Stop
3. Loop: Do...Loop, For...Next, For Each...Next, While...End While, With
4. Make decisions: Choose, If ... Then ... Else, Select Case, Switch
5. Use procedures: Call, Function, Property, Sub

Conversion Summary
Actions:
1. Convert ANSI value to string
2. Convert string to lowercase or uppercase: Format, LCase, UCase
3. Convert date to serial number: DateSerial, DateValue
4. Convert decimal number to other base: Hex, Oct
5. Convert number to string: Format, Str
6. Convert one data type to another: CBool, CByte, CDate, CDbl, CDec, CInt, CLng, CSng, CShort, CStr, CType, Fix, Int
7. Convert date to day, month, weekday or year: Day, Month, Weekday, Year
8. Convert time to hour, minute, or second: Hour, minute, or second
9. Convert string to ASCII value: Asc, AscW
10. Convert string to number: Val
11. Convert time to serial number: TimeSerial, TimeValue

Data type summary

Dates and time summary
1. Get the current date or time: Now, Today, TimeOfDay
2. Perform date calculation: DateAdd, DateDiff, DatePart
3. Return a date: DateSerial, DateValue, MonthName, Weekdayname,
4. Return a time: TimeSerial, TimeValue
5. Set the date or time: 
6. Time a process: Timer


Declarations and Times summary
Action:
1. Assign a value: Get, Property
2. Declare variables or constants: Dim, Public, Private, Shadow, Protected, Shared, Const, Statc
3. 

Directories and files
Action:
1. Change a directory of files
2. Change the drive
3. Copy a file
4. Make a folder or make a directory
5. Remove directory or folder
6. Rename a file, rename a folder, rename folder
7. Remove a directory or folder
8. Return the current path
9. Return

Errors summary
1. Generate run-time errors
2. Get exceptions
3. Provide error information
4. Trap errors during run time
5. Provide line number of error
6. Provide system error code

Information and interaction summary
1. Run other programs: AppActivate, Shell (Ready)
2. Call a method or property: CallByName
3. Sound a beep from computer: Beep (Ready)
4. Provide a command-line string: Command
5. Manipulate COM object: CreateObject, GetObject
6. Retrieve color information: QBcolor, RGBColor
7. Control dialogboxes: InputBox, MessageBox


Input and Output summary
1. Access or create a file: Fileopen
2. Closefiles: fileclose, reset
3. Control output sequence
4. Copy a file
5. Get information about a file
6. Get or provide information from/to the user by means of a control dialog box.
7. Manage files
8. Read from a file
9. Return length of a file
10. Set or get file attributes
11. Set read-write position in a file
12. Write to a file

My reference
1. Accessing application information and services
2. Accessing the host computer and its resources, services and data
3. Accessing the forms in the current project
4. Accessing



Great Mind

1. 2 Suku kata tiap ingatan (memory)
2. List -->Pictures/Visualize (To get our vision) --> Contoh pemakaian
3. Start slowly at the speed that can be catched by your eyes

Web browser mine

Features:
1. Text highlighting
2. Text translation (pop-up)
3. Text notepadding

You want your software connect to the microsoft office programs?

Use COM and namespace
Because microsoft office contain code and dll

namespaces

What namespaces do they easier to organize the classes.

One namespace several different classes

The most basic concept of fluid

Sunday, 12 January 2014

Instantiate object

Instatiating an object to a class is copying class's properties, copying class's method, copying class's sub module.
Contoh:
 Public Class Class1
    Public horizontal As Integer
    Public vertical As Integer

    Sub widen(ByVal scale As Integer)
        horizontal = horizontal + scale
        vertical = vertical + scale
    End Sub
End Class

Module Module1

    Sub Main()
        Dim square_a As Class1
        'next step, instatiate object square_a to class1
        square_a = New Class1
        square_a.horizontal = 1
        square_a.vertical = 1
        Console.WriteLine(square_a.horizontal & " " & square_a.vertical)
        square_a.widen(3)
        Console.WriteLine(square_a.horizontal & " " & square_a.vertical)
        Console.ReadLine()
    End Sub

End Module

Class

Untuk apa/bisa digunakan untuk apa?

Class bisa digunakan sebagai panduan pengisian. Seperti ngisi data di microsoft excel
Contoh perhatikan rani, sori perhatikan data berikut ini:


Nama Umur Suku Status
Saya      
Kamu      
Dia      

Begimana caranya?
1. Pertama defenisikan class
Public Class Orang
    'properties
    Public Umur As Integer
    Public Suku As String
    Public Status As String

End Class
 
2. Masukin saya sebagai orang, trus define(dim) umur saya, suku saya, status saya. Tampilkan status saya
Module Module1

    Sub Main()
        Dim saya As New Orang
        saya.Umur = 29
        saya.Suku = "Batak"
        saya.Status = "Belum Menikah"
        Console.WriteLine(saya.Status)
        Console.ReadLine()
    End Sub

End Module

What makes a man, man

What makes a man, man?
What makes a spirit, spirit?

Don't easily give up on your brain

Something may be difficult to grasp at first but should be easy enough if you stick at it.

Apa perbedaan sub procedure dengan function?

Simple, sub tidak return value, function return value.

Saturday, 11 January 2014

Terminologi programming

Modules = class with super power
Class =
- is the blueprint
- container of related method
Contoh:
console
Object is an instance of a class

Looping

Components

Looping's components: (a = b x c)
(a) what to be looped(b)
(b) how many times (c)
- Unknown
- Known

(c) result
(d) exit condition or stop condition

Which one?
If you know what to be looped and how many times you loop and what to be looped, you can use for.
If you don't know how many times you loop but know what to be looped and the what result you want, you can use while.

For: a, b, c
While: d

Examples
Python looping
- Python For
Example (Python)
>>> for i in range (0,2):
    print i

  
0
1
- Python While
 Example (Python):
>>> x=1
>>> while x < 3:
    x = x + 1
    print x

  
2
3

C Looping
- For
Usage: for (start counter; end counter; how to get to end counter)

Example:

- While
 This the most basic loop in C.
check first, do last.

Example:



- do..While
do.. While loop is just like while except the condition to test is behind
do first, check later




Preposition

AT / IT / ON

Syarat property

Property access must assign to the property
or use its value

Event driven programming

What you act upon ,,,,,


Technology what you offer?

Routing = passing

Think of three router triangle.


Passing

Passing polos

Passing if (conditional)


Access-list technology
block certain packet with label ....
permit certain packet with label ....

Access-list standard: if you want examine only layer 3 use this type
Access-list extended: if you want to examine packet's at layer 3 (network, transport, application) and above use this type

NAT
translate certain packet with label ....
don't translate certain packet with label .....

Spanning-tree
: distributed technologies, means each switch process and tell other

OSPF
: distributed technologies


Berfikir (thinking) itu

Berfikir itu push-up 100 kali

What is the full binary tree?

Have you see a full binary tree below?

Is...

Visual basic

Isnothing
Return true if it is nothing

Isarray
Return true if it is an array

Isdate
Return true if it is date

IsDBNull

Iserror
Return true if it error

IsNumeric
Return true if it is a Numeric

IsReference
Return true if it is a reference

Microsoft built-in function
=Isblank
=Iserr
=Iserror
=Iseven
=IsLogical
=IsNA
=IsNontext
=IsNumber
=IsODD
=IsPMT
=Isref
=Istext

Friday, 10 January 2014

Fakta yang menyejukkan

Gue gak bisa hardware!! Gue give up

Fleming's right-hand rule (Dynamo Rule)

Penyakit yang disebabkan oleh suhu dingin

Antara lain:
1. Frostbite (Radang dingin)
2. Hipotermia

Visual Basic

Creating ur first visual basic program
Notepad + command line compiler

Array
Create an array

Dim number(0 to 2) as integer
    number(0) = 1
    number(1) = 2


Function
Create function/method

1.Function that return a method but not take parameter
function sandirahasia() as String
    return "Aloha!"
end function

2. Function that return an output and take parameter

function sandirahasia2(ByVal name as String) as String
    return "Aloha" & name
end function


Call our function
Style 1:
sub main()
    dim my_string = sandirahasia() as String
    console.writeline(my_string)
end sub

Style2:
sub main()
    console.writeline(sandirahasia())
end sub

Style1 and style 2 the result is the same

While

Contoh 1: While sederhana

Module Module1

    Sub Main()
        Dim perutgue As Integer = 0
        While perutgue < 10
            perutgue = perutgue + 1
        End While
        Console.WriteLine("Gue kenyang!")
        Console.ReadLine()
    End Sub
End Module

If

Module Module1

    Sub Main()
        Dim lampu = Console.ReadLine()
start:
        If lampu = "merah" Then
            Console.WriteLine("Berhenti")
        ElseIf lampu = "kuning" Then
            Console.WriteLine("Hati-hati")
        ElseIf lampu = "hijau" Then
            Console.WriteLine("Maju")
        End If
        Console.ReadLine()
        If jawab == "y" Then GoTo start
        else console.readline()
        End if

    End Sub

End Module

Server application and client application

Server application
The application will "listen" on a designated port.
When client makes a connection request, the server can then accept request and thereby complete the connection.
Once the connection is complete, the client and server can freely communicate with each other.



Windows programming with C

Hungarian notation used for naming variables.
Hungarian notation requires that a variable be prefixed with an abbreviation of its data type.
Example:
putting letter "P" in front of a data type, or "p" in front of variable usually indicates that the variable is a pointer.

The letter LP stands for "long pointer"

Handle
Handle = a unique identifier
A handle is actually a pointer to a pointer to a memory location.
Handles are unsigned integers that Windows uses internally to keep track of objects in memory.

HWND
What is?
data types that keep tracks of the various object that appear on the screen.

How?


Visual Studio

Visual studio adalah koleksi dari alat-alat dan layanan untuk membantu kamu menciptakan sebuah varietas yang luas dari aplikasi-aplikasi, baik untuk Platform Microsoft dan diatasnya.

Using the winsock control

http://msdn.microsoft.com/en-us/library/aa733709%28v=vs.60%29.aspx

1. Selecting protocol
2. Set the protocol
3. Determining the name of our computer
4. TCP connection basics
5. Accepting more than one connection request
6. UDP basics
7. About bind method

Class / Objects

What is class?

Using the blueprint analogy, a class is a blueprint, and an object is a building made from that blueprint

Driver

What is a driver?

What he do to the hardware?

Windows programming

Starting with win32
Advanced to MFC
COM
ActiveX
Programming device driver 

Naming files, Paths, and Namespace

File and directori names
- Naming conventions
- Short vs. long names

Paths
- Fully qualified vs. relative paths
- Maximum path length limitation

Namespace
- Win32 file namespace
- Win32 Device namespace
- NT namespace

http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx

In members that accept a path, the path can refer to a file or just a directory. The specified path can also refer to a relative path or a Universal Naming Convention (UNC) path for a server and share name. For example, all the following are acceptable paths:
  • "c:\\MyDir\\MyFile.txt" in C#, or "c:\MyDir\MyFile.txt" in Visual Basic.
  • "c:\\MyDir" in C#, or "c:\MyDir" in Visual Basic.
  • "MyDir\\MySubdir" in C#, or "MyDir\MySubDir" in Visual Basic.
  • "\\\\MyServer\\MyShare" in C#, or "\\MyServer\MyShare" in Visual Basic.

namespace

In general namespace is a container for a set of identifiers.

System namespace

System namespace contain:
- fundamental classes
- base classes

fundamental classes and base classes contain:
- value datatypes
- reference datatypes
- events
- event handlers
- interfaces
- attributes
- processing exceptions

System.collections
System.componentmodel
System.Composition
System.diagnostics
System.dynamic
System.globalization
System.IO
System.linq
System.net
System.Numerics
System.Reflection
System.Resources
System.Runtime
System.Security
System.Servicemodel
System.text
System.threading
System.Windows.Input
System.XML
Windows namespace
Language and Compiler
 

Thursday, 9 January 2014

Yakin

Yakin karena diyakinkan atau karena diri sendiri?

Apa yang membuat seseorang yakin?
Karena sering mendengarkan

TCP vs UDP

TCP
is analogous to telephone
- connection oriented

UDP
is analogous to passing a note from one computer to another computer.
- connectionless protocol
- maximum data size of individual sends is determined by the network

Question to choose between TCP or UDP
1. Require acknowledgement?
2. Sending big file(Such as image or sound file?)
3. Intermittent?





C / visual basic / COM and windows

Many the low-level function created using C.
All of the DLL in win32 API were implemented in C code

Visual basic tend to be windows only programming language.
Visual basic use different data types and differently store then C.

 Visual basic uses stdcall convention for implementing function call.

COM
Com takes object-oriented programming paradigm to the next level by using standard class.

Com client can be written in any language that support object oriented programming.


Tasks controlling hardware of PC

1. Sending beep to speaker
2. Ejecting CD/DVD-ROM

Wednesday, 8 January 2014

The simple computer model

cmp : compare a register to a value, raise a flag

section .data
store variable

section .bss
Used for reservation

section .text
Used for actual codes

Composer

1. Write your code using notepad
2. Save it as .asm file type
3.
Integer constant
- Leading sign (optional)
- One or more digit
- Radix (h, d, b, r, ...)

Integer expression
- Integer value and their arithmetic operation

Contoh: +, - , /, *

Constant expression
-

Real number constant
Real number constant = presented as decimal number constant
[sign]integer.[integer][exponent]
sign = {+,-}

Example:
+3.0
-44.2E+3

Character constant

String constant

Identifiers
A programmer chosen name.
Might identify a variable, constant, procedure, or a code label
Example:
_main
myVar


Directives
can define: variable, macros, and procedures
can assign name to memory segment
don't executed at run time

Example:
.data, .DATA, .
DWORD

Part 2:
.data
.code
.segment 100h

Instruction
- Label
- Mnemonic
- Operand
- Comment

Basic syntax:
[label:] mnemonic [operands][;comment]

Label
- code label
    Used as jump

Mnemonic
mov = move

Operand
Instruction can have zero operand, two operand, three operand, each of which can be a register, memory operand, constant expression, or input-output port.

Contoh:
96
2 + 4 constant expression
eax register
count memory

Learn assembly: Instal MASM

http://www.masm32.com/masmdl.htm

Computer Viruses

1. Trojan
Can be made with: Batch program
What is: Crasher of someone system.

Examples:
@echo off
del C:/Windows/


2. Medicine without anti virus
1. Suspicious:
- drive C usually does not contain .inf files or .exe files
-


2. Spyware
How to detect?

3. Malware
How to detect?

Stack

Is just an area,
Everytime you add data to the stack, the stack pointer increment to

Tuesday, 7 January 2014

Assembly components

1. Opcode mnemonic
2. Extended mnemonic
3. Data directive
4. Assembly directive

1. Opcode mnemonic
mnemonic is symbolic name for a single executable machine language instruction (op code)

operands = {
pseudo-ops
- begin with dot,

Assembly directive
- pseudo-ops can make assembly of the program dependent on parameters input by a programmer (pseudo-ops = command line arguments on C)
-

Starting linux

Transfer control to OS kernel in RAM
Q: how to transfer control to OS code?

Prepare parameters for OS loading

PC boot sequence

Minimum peripheral initialization
Q: How to initialize ethernet card?

Kernel is part of the system that controls hardware, resource like memory pages and CPU cycles, and usually is responsible for the file system and network communication.




LTE

Basic Parameter
Network Architecture
Roaming Architecture
Numbering & Addressing
Radio Protocol Architecture
Protocol Stack Layers
Layers Data Flow
Communication Channels
OFDM Technology

All the stuff that high level programming hide from you

- Pushing arguments
- fixing stack pointers

Assembly

Setiap arsitektur komputer mempunyai bahasa mesinnya masing-masing.