Pages

Saturday, September 20, 2014

Objective C data type

Objective C data type

  • int        (4bytes).                
  • float     (4bytes).
  • double  (8 bytes). 
  • BOOL      (1 bytes).
  • char      (1 bytes).

int  =  Integer number.
float = Single precision floating point.
double = Double precision floating point.
BOOL  = Boolean type data ( true / false ).
char  = A single character.



data type example


int number = 121;
float number2 = 1.231;
BOOL aDeer = YES;    [ YES | NO ]




4 bytes = 32 bits = 2^32   =      4.294.967.296  possible value.


-2.147.483.648     ----------------------------    2.147.483.648

with unsigned ( command to use only positive value, no negative! ) we can make it from

0   ----------------------------   4.294.967.296


example:   unsigned int positive_number;



**float and double cant use unsigned.



modifier

data type can use modifier.

  • short
  • long

example:  short int  ( cost 2 byte).
                 long int ( cost 8 byte).
                 long double (cost 16 byte).

Friday, January 24, 2014

introduction to socket

Here's my sockets tute:

The key point is this: a browser doesn't talk to a web server on port 80, cos that would be crowded. The browser knocks on the server's port 80 and says "I'd like to talk to you" and the server says "OK talk to this new random port number of mine e.g. number 12734".

Now let's suppose you have firefox and chrome both running on your laptop both looking at news.bbc.co.uk. How does the server know which browser is GETting when the laptop IP is the same? Answer: chrome and firefox both choose random local port numbers and quote them when they knock on the server's port 80.

Here's the same story with <API names> filled in:
1) Apache starts on bbc.co.uk and <bind>s to port 80. That requires root permission cos 80 is less that 1024. The effect is simply that no other process can <bind> to port 80 thereafter.
2) Apache calls <listen> which tells the system to expect people to knock on there
3) Apache enters a loop <accept>ing on port 80. <accept> blocks until a new client knocks (i.e. connects.)
4) Firefox wants to read the news so it <connect>s to bbc.co.uk at port 80 using a new random local socket number, say, 1234
5) Apache's <accept> returns with a lovely new socket containing a new server-side port number (12734) and the client's IP and 1234. The client has already been told 12734 and even acknowledged receiving that number, so both ends know both IPs and both port numbers.
6) Now, between these two random port numbers, the roles are symmetrical: anybody can <send> data to the other end or block in <recv> waiting for the other end to send something. Anybody can close the connection. Meanwhile, the server's 80 is waiting for a different cllient but that's irrelevant to our personal connection on these two random port numbers.

That was TCP. UDP is simpler. In UDP, you either <bind> to a local port number and block in <recvfrom> which tells you the senders IP and port when it returns, or you <sendto> some foreign IP/port. (You can <bind> before <sendto>ing if you're fussy about the sender port number.) There's no concept of a connection here. The packet might get through or get lost and the sender will never know unless the receiving application does something special to tell him. Sometimes this is what you want because it's more efficient and there might already be some higher level connection/acknowledgement system.

(Incidentally, if anybody tells you that UDP connections can't get through routers cos the router needs a TCP connection to do masquerading, they're lying.)

For more tutes, google for "berkeley sockets"

introduction to socket by 'adrian' quorve.

Tuesday, May 28, 2013

sqlite command for android program database development

sqlite3 tabel_buku.db           // membuat database bernama tabel_buku.db

CREATE TABLE BUKU (id integer primary key, title text,author text,isbn text default 'not available');  

// membuat tabel buku dan menetapkan bentuk variabelnya.




INSERT INTO BUKU (id,title,author,isbn) VALUES (1,'WAR AND PEACE', 'Leo Tolstoy', '978-03454123');   /

/ nama kolomnya diisi value  (kita ngisi row/baris pertama didalam tabel)




INSERT INTO BUKU (title,author,isbn) VALUES ('toro', 'tero', '203-12343');      

// kita bisa input 3 kolom terakhirnya saja. karena sudah auto increment idnya.


Monday, April 29, 2013

learning java...?!

java menurut saya sebenernya pemrograman yang cukup ribet :'( karena sepenuhnya mendukung object oriented programming dimana ketika kita membuat sebuah program maka kita harus bermain-main dengan yang namanya object. Makanan yang tak lazim dicerna untuk pemula seperti saya.


Setelah melalui beratus2  semester... akhirnya saya sedikit mulai paham dengan pemrograman berbasis object. Kenapa saya bilang ribet? coz sebelum memulai menjalankan program utama kita terlebih dahulu diwajibkan untuk membuat/ memikirkan kerangka sebuah object. Namun dikarenakan wajib menggunakan pemrograman berorientasi object maka program akan menjadi lebih rapi dan dapat reuseable.


Dalam pemrograman berorientasi object semisal kita membangun sebuah object manusia, maka kita dapat membangun object kuku, tangan, kaki , kepala, badan terlebih dahulu, dimana tiap kelas merupakan warisan dari kelas kelas sebelumnya. Jadi membentuk dari sebuah object yang kecil, di extend/ diwariskan menjadi suatu object baru yang lebih padat. Membesar membesar MEMBESARRRRRRRRrrrrrrr   hingga mencapai object tujuan. Sehingga object yang sebelumnya telah ditulis (misal : kuku) tidak perlu ditulis ulang untuk membentuk object kaki dan tangan.


berbeda dengan pemrograman prosedural dimana kita membangun langsung keseluruhan program. apabila terdapat perubahan / kesalahan maka kita harus membongkar ulang program. Hal ini tidak masalah jika program yang dibuat merupakan program yang kecil namum apabila program telah mencapai ribuan baris, akan cukup melelahkan untuk mencari dan memperbaiki kesalahan tersebut.



dibawah ini merupakan

Tuesday, April 16, 2013

reverse ssh port locked connection concept

berawal dari ide meremote komputer di dalam sebuah jaringan privat yang ada didalam kantor jogjamedianet ketika sedang kerja praktek dulu (karena salah satu tugas dari kerja prakteknya mendownload film2 / konten buat diisi ke server :p    kan enak tuh jadinya ngerjain tugasnya remote dari rmh hahaha :D  jadi ditempat kp ga perlu lg download2. bs fokus trouble shoot jaringan hotspot).




bolak balik sana sini cari tau gimana sih caranya biar bisa remote pc yang ada didalam jaringan komputer yang memiliki ip private....

salah satu post saya di http://opensource.telkomspeedy.com/forum/viewtopic.php?id=14465



jadi intinya memang harus ada akses ke router yang memiliki ip public bersentuhan langsung dengan ip private komputer yang akan kita remote. lalu melakukan dst nat / destination nat untuk memforward port dari ip public ke ip private.



atau menggunakan menggunakan software untuk membangun virtual private network yang menghubungkan antar jaringan privat seperti hamachi / teamviewer. Namun dengan menggunakan kedua software tersebut maka koneksi kita terlebih dahulu menuju server tempat hamachi / teamviewer berada (yang mana merupakan server yang berada dijalur IX / international )  dengan ping > 200ms sangat terasa apabila ingin melakukan remote komputer dengan menggunakan remote desktop connection / vnc  T_T


nah tujuan utama saya waktu itu  meremote komputer dengan menggunakan perantara server yang ada

Thursday, April 11, 2013

hardware oh hardware..


cpu speed= clock rate       yaitu cycles per second biasanya dalam satuan mhz.

1Mhz  = 1 juta cycle per second





Bus = circuit yang menghubungkan 1 bag motherboard ke yang lain. semakin besar bus speed smakin banyak data yang bisa ditransfer




ref: front side bus / FSB.  yang mengkonekkan cpu ke northbridge.
 



 fsb besar > performance lebih baik.


fsb  66mhz -  lebih dari 800 mhz.  





cpu sampe ke memory controller lewat northbridge.  fsb bisa menaikkan performa.




dalam dunia networking / server pemilihan motherboard dengan fsb tinggi = lebih baik.




ram dengan CL(cas latency ) kecil lebih baik.

1066 dengan CL=7     faster >  1066 dengan CL=8


You can figure that 1333 @ 9 is going to be slower than 1066 @ 7.
One step of speed advantage, two steps of delay.
The delay is more important.
Argument ensues when comparing 1333 @ 8 with 1066 @ 7 however.


Basically, pick a speed (MHz) of RAM that suits you, then look for the lowest CL available for a reasonable price










src: tomshardware.com

Tuesday, April 9, 2013

catatan administrator part 2


ls  xxx 2> errorfile


===mount iso file==


mount -o loop Fedora-11-i386-dvd.iso /test/


===============


mount


network file system

mount -t nfs 192.168.0.50:/toro /test
umount /test

samba

mount -t cifs //192.168.0.50/toro /test
umount /test



If the Windows box requires a username/password you should use

Code:
mount -t smbfs -o username <your user name> password <your password> //servername/sharename  /mnt/sharename


============

ls > file                 : memasukkan output dr ls ke file

ls >> fileappended        : menambahkan isi direktori skrg ke fileappended


database < data          :    input data ke database


ls *.png | xargs rm       : output yang ada *.png di hapus


=   :  assign variable
==  :  question true / false


/dev/null   : linux trashbin , auto discarded.    -> digunakan sebagai spam email(dibuang).