Showing posts with label My-note=programming. Show all posts
Showing posts with label My-note=programming. Show all posts

Saturday 11 January 2014

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

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
 

Friday 3 January 2014

C

1. Datatypes 

Datatypes determine the size, layout of the variable's memory, the range of values that can be stored within that memory, and the set of operations that can be applied to the variable.

2. Variables
A name given to a storage area that our programs can manipulate.

Styles:
1.type variable_list;
2.type variable_name = value;




Type can be: {int, char, float, double, void}
Note: void is bencong (absence of type)

Integer

Floating point

Components:
1. storage size
2. value ranges
3. the precision (berapa dijit dibelakang koma yang dimunculkan)

Contoh:


3. Constants and literals: 
Constants: fixed values that the program may not alter during the execution of a program.
Programming practice use all capslock word as constant name

Literals:


Styles defining constant:
1. Using #define preprocessor
#define name value
example:
#define LENGTH 10

2. Using const keyword
const type variable = value;

example:
cons int LENGTH = 10;



4. Storage class
Define scope (visibility) and lifetime of variables.
Storage class: {auto, register, static, extern}

auto storage class is default, can only be used within a function
register storage class define a local variable that should be stored in register instead in RAM. This means the variable has a maximum value size equal to the register size(usually one word) and doesn't have unary operator (&) applied to it (as it does not have a memory location)
static storage class
extern storage class is used to give a reference of a global variable that is visible to all the program files. Can't be initialized




5. Operators
An operator is a symbol, symbol that tells the compiler to perform specific mathematical manipulation or logical manipulation.

Arithmetic = {+. -. /, *}
Relational = {==, !=, <, >, >=, <=}
Logic = {And, Or, Not}
Bitwise = {
Unary = & = give memory address of a variabel
Sizeof(type) or sizeof(variable): return the size of type/variable






6. Decision making
Components:
1. Conditionals to be evaluated
2. Statements to be evaluated

Styles:
1. If
if there is another if then use elseif


2. Switch



7. Loops
Components:
1.
2.
3.

Styles:
1.
2.

8. Functions
Function is a group of statements. Divide your code so each function performs a specific task.

C at least having 1 function that is main() function.

The type of a function specifies the type of function's return value.

For functions that require parameters, you can pass parameters by reference or by value.
For functions that not require parameters, you shall not pass parameters by reference or by value.

Alias
A function = a method = a sub-routine = a procedure

Components:
1. Function name
2. Function's return type value
3. Function's argument/parameter
4. What function do

Examples:
main()


9. Scope rules
Scope is a region, a region of where variable can be accessed (local/interlocal?)
Scope in Bahasa is Batasan, daerah mana variabel itu bisa diakses.
Scope = [local, global, formal]

Local variabel = variabels that declared inside a function or block. They can be used only by statements that are inside that function or inside that block of code. Local variables are not known to functions outside their own.




10. Arrays

Array is a data structure.
Array is a collection of variable of the same type.


11. Pointers
Untuk menyimpan alamat memori suatu variabel.
Trus apa gunanya kalau kita sudah simpan alamat memori suatu variabel? Yah, lo bisa munculinnya.


Styles:
type *variable_name

Example:
Int *aloha


12. Strings
The string in C programming language is actually a one-dimensional array of characters and terminated by null character.

13. Structure
Array is same data type but structure variabel can save many different data type.

You can access a variabel attribute with (.),example: variabel1.name, variabel1.memory_address,

1st. Define structure format
- define structure name
- define attributes

2nd. Assign a variable as member of  a structure
-

3rd.

14. Unions
Unions: "One (unity) for all"
Imagine that you want to build a variabel that not restricted to only one data type, how you do that?
It is using unions

1st. Define the variabel that would be used as unions
2nd.
3rd.

Unions is a special data type.


Unions allow us to store different data types in the same memory location.

Unions provide an efficient way of using the same memory location for multi-purpose.



15. Bitfields


16. Typedef
Typedef is to give a type a new name.
 


17. Input & Output
When we are saying Input that means

C treat all device as file. So display is addresses the same way as files.




18. File I/O
How to open/create, close, read and write a file.

File represent a sequence of bytes.

Open file
fopen()

Closing file
fclose()

Writing file
fputc()

Reading file
fgetc()


19. Preprocessors (something that compiler do before compiling our program)
CPP as C preprocessor.

All preprocessor commands begin with a pound system (#)

The most common examples:
#include <stdio.h>


20. Header Files
File header adalah sebuah file yang berekstensi .h yang memuat deklarasi-deklarasi fungsi C dan defenisi-defenisi macro dan untuk dibagi antara file-file source.

Ada 2 tipe dari file-file header: file header buatan sendiri atau file header bawaan.

Contoh file header bawaan: stdio.h

Kedua tipe file header di ikut sertakan dengan menggunakan # atau directive include.
Contoh:
#include <stdio.h>



21. Type Casting (converting)
Type casting is a way to convert a variable from one data type to another data type.

For example, if you want to store a long value into simple integer then you can type cast to long to int.


22. Error Handling (Nanganin error)

Error is not what we expected.

We can define

23. Recursion
Calling a function inside a function.

When? Very useful when used to solve mathematical problems like to calculate factorial of a number, generating fibonacci sequence, etc.
 




24. Variable Arguments
#include stdarg.h

25. Memory Management
#include stdlib.h

Components:
1. void malloc
2. 

 
26. Command Line Arguments
Components:
1. Argc
2. Argv



Cozy Environment to build a C program

1. Download codeblocks
2. Install codeblocks
3. Add codeblocks to system environment. Contoh: punya gue: C:/programfiles/codeblocks/bin
4. Open notepad, write your code there, save ke folder yang lo suka, punya gue: e:/C
5. Open cmd, type e:, type c,
6. type gcc <your filename> -o <your exe filename>
contoh: gcc aloha -o alohabin.exe
7. back to cmd, type alohabin
8. Finish

Component:
1. CMD
2. C file
3. C exe file