Nugroho's blog.

Friday, June 6, 2014

PCV Valve and Throttle Position Sensor on My 323F Astina


Drove it with broken PCV and TPS socket unplugged for straight two years without major problem

At least, my luck is gradually wornout

The symptoms began the moment I change the broken PCV valve.

After replaced the old broken PCV valve and installed the new one, there's no change at idle.

Another story when I stepped on throttle pedal, the engine is getting hesitant and the rpm didn't rise smoothly and it had tendency to not rise at all.


Hmm, if broken PCV valve and unplugged TPS proved okay, whilst new PCV valve and unplugged TPS result in trouble, then combination of new PCV valve and plugged TPS maybe solving the problem.

The result is I have low idle rpm, so far so good, and I stomped the throttle pedal, the rpm is increasing smoothly, this getting better and better until rpm reach 3000 and suddenly drop to 1000, ...

I press and hold the throttle pedal, hoping it can reach beyond 3000, to no avail. It drop every time it reach 3000 point.

Here, almost without doubt that the TPS is the trouble maker. Almost, since the idle setting and other setting is done with the TPS unplugged, so maybe my engine have wrong setup since begining, still...

Checked TPS with OhmMeter, the result is fine, no problem.

Checked TPS socket (cable to ECU) using voltmeter, the signal is OK, so the TPS isn't the problem.

My TPS is the switch-type-TPS (from many online source including discussion in Mazda Astina Indonesia ), in opposite to potentiometer-type. So it has three switch position mode. (look at the first pic)

Let us name three connector cable in TPS with A, B and C. The first position is when idle, without step on the throttle pedal, A and B is connected. (second pic)

The second position is when we slightly open throttle; A, B and C is connected together. (third pic)

Finally while we are on full throttle, B and C is connected. (4th pic)

I don't really know, maybe because my "exotic" setup since beginning, my 323F couldn't get right rpm while TPS is plugged, so I manually checked by bypassing it function using jumper.

Bypassing A and B through jumper resulted in erratic rpm, it oscilating from 1000 to 3000, ....., ups..., the throttle cable is stuck, make it right...., ok, rpm at idle is 1000, step the throttle, and...., still drop at 3000, duh....

The same with A, B and C connected together.

Don't have a choice, bypassing B and C and... Idle is 1000, step the pedal, it raise smoothly to 3000 and 3500, 4000 and so on..., huray...

Stick with this setting until now, :)





Thursday, June 5, 2014

Kebebasan

Beberapa hari lalu gencar berita tentang penyerangan dan perusakan rumah pendeta oleh sekelompok orang; beberapa malah tetangga sendiri. Pihak penyerang merasa benar menghancurkan rumah pendeta karena itu adalah "rumah tinggal" dan bukannya "tempat peribadatan".

Beberapa mungkin membenarkan argumen kelompok penyerang.

Beberapa mungkin memahami alur pikiran kelompok penyerang namun menyayangkan tindakan main hakim sendiri kelompok tersebut.

Ada juga yang menyayangkan tindakan kelompok penyerang rumah pendeta itu, apapun alasannya.

Saya sebagai orang Malang yang beberapa tahun tinggal di Jogja sedikit banyak mengerti dengan situasi yang berbeda antara budaya "sini" dan "sana".


Ketika bulan pertama di jogja, tepat pada bulan puasa, saya merasa ada yang aneh.

Tubuh saya telah siap menerima "sesuatu" selama sebulan, namun ternyata di Jogja "sesuatu" itu tidak ada, dan jadilah saya seperti merasa sangat-sangat-sangat jauh dari rumah, meskipun memang iya,...

Lama saya mencari apa yang menyebabkan "sesuatu" tidak muncul, akhirnya ketemu juga jawabannya.

"Sesuatu" itu adalah suara-suara yang biasa saya dengar saat bulan puasa di Malang (mungkin Jawa Timur secara umum).
Seruan jam 3 pagi lewat speaker di musholla untuk bangun makan sahur.
Seruan waktu sahur telah habis.
Suara adzan lengkap tiap musholla, yang di bulan lain hanya saat maghrib dan isya
Dan saat speaker tidak digunakan untuk menyerukan hal-hal tersebut maka suaranya berganti dengan suara mengaji mp3 di speaker semua musholla dari jam 3 pagi sampai jam 12 malam.

Terlepas dari suka atau tidak, karena tidak terelakkan lagi, tubuh saya secara fisik dan mental telah siap dengan itu.

Namun saat di Jogja, semua itu tidak ada, hanya suara adzan normal, tidak ada nyanyian pujian setelah adzan, tak ada suara mengaji yang keras di speaker sampai tengah malam setelah tarwih.

Bahkan setelah bulan puasa pun, tidak ada suara mp3 mengaji di speaker setengah jam sebelum adzan subuh, tidak ada nyanyian pujian setelah adzan.

Tidak ada suara speaker tahlilan rutin seminggu beberapa kali yang diselenggarakan dari rumah ke rumah, sore dan malam.

Dan saya merasa sangat nyaman, :)

.....
nah, kembali ke peristiwa penyerangan rumah pendeta di Ngaglik Sleman Jogja.
Saya membayangkan, jika mereka, para penyerang itu pindah ke Jawa Timur,

apakah mereka akan menyerang tiap rumah yang digunakan untuk tahlilan? (seminggu beberapa kali, tahlil RT, tahlil RW, tahlil bapak-bapak, tahlil ibu-ibu, sore atau malam, pake speaker/salon bawah)

Menyerang rumah ustadz (rumah tinggal) yang digunakan sebagai tempat mengaji anak-anak dan ibu-ibu dari sore hingga malam setiap hari? (suara anak belajar ngaji biasanya disiarkan melalui speaker)

di sini, hampir semua "rumah tinggal" dapat berfungsi sebagai "tempat peribadatan", bahkan sampai luber ke jalan depan rumah, tutup jalan, dan suara speakernya terdengar jelas hingga setengah kilometer.

...bagaimana jika mereka tinggal di lingkungan seperti ini?

Wednesday, June 4, 2014

[Delphi] n-Order Interpolation (just for self documentation)

Of course, it can be linear, quadratic, cubic or any order interpolation




unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;

type
TForm1 = class(TForm)
Timer1: TTimer;
Image1: TImage;
Memo1: TMemo;
procedure awal;
procedure datamentah;
function newton(v:real):real;
function lagrange(v:real):real;
procedure diferensiasi;
procedure interpolasi;
procedure ilagrange;
function fx(x:real):real;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

const n=11;
orde=n;
skalax=17;
skalay=5;
var
Form1: TForm1;
x,y:array[0..n]of real;
a,f:array[0..orde]of real;
x0,y0:integer;
xi,yi:real;
implementation

{$R *.dfm}

function tform1.lagrange(v:real):real;
var j,m:integer;lag,suku:real;
begin{}
lag:=0;
for j:=0 to orde do begin
suku:=1;
for m:=0 to orde do begin
if j<> m then suku:=suku*(v-x[m])/(x[j]-x[m]);
end;
lag:=lag+y[j]*suku;
end;
lagrange:=lag;
end;

procedure tform1.ilagrange;
var i:integer;v:real;
begin{}
image1.Canvas.Pen.Color:=clred;
image1.Canvas.
MoveTo(x0+round(-n*skalax),y0-round(lagrange(-n)*skalay));
for i:=-n*100 to n*100 do begin
v:=i/100;
image1.Canvas.
LineTo(x0+round(v*skalax),y0-round(lagrange(v)*skalay));
end;
end;

procedure tform1.diferensiasi;
var i,j,k:integer;prod:real;
begin
a[0]:=y[0];
memo1.Lines.Append('a[0] = '+floattostr(a[0]));
for i:=1 to orde do begin
a[i]:=0;
for j:=0 to i do begin
prod:=1;
for k:=0 to i do begin
if (k<>j) then prod:=prod*(x[j]-x[k]);
end;
a[i]:=a[i]+y[j]/prod;
end;
memo1.Lines.Append('a['+inttostr(i)+'] = '+floattostr(a[i]));
end;
end;

function tform1.newton(v:real):real;
var i:integer;newt,suku:real;
begin
newt:=a[0];
suku:=1;
for i:=1 to orde do begin
suku:=suku*(v-x[i-1]);
newt:=newt+a[i]*suku;
end;
newton:=newt;
end;

procedure tform1.interpolasi;
var i:integer;v:real;
begin
diferensiasi;
{plot}
image1.Canvas.Pen.Color:=cllime;
image1.Canvas.
MoveTo(x0+round(-n*skalax),y0-round(newton(-n)*skalay));
for i:=-n*100 to n*100 do begin
v:=i/100;
image1.Canvas.
LineTo(x0+round(v*skalax),y0-round(newton(v)*skalay));
end;
end;

procedure tform1.awal;
begin
randomize;
image1.Width:=400; image1.Height:=400;
x0:=round(image1.Width/2); y0:=round(image1.Height/2);
image1.Canvas. Pen.Color:=clblue;
image1.Canvas.MoveTo(0,y0); image1.Canvas.LineTo(image1.Width,y0);
image1.Canvas.MoveTo(x0,0); image1.Canvas.LineTo(x0,image1.Height);
xi:=1.11; memo1.Text:='';
datamentah; interpolasi;
//ilagrange;
end;

procedure tform1.datamentah;
var i:integer;
begin
for i:=0 to n do begin
x[i]:=i-n/2; y[i]:=fx(x[i]);
with image1.Canvas do begin
pen.Color:=clblue; brush.Color:=clgreen;
pixels[x0+round(x[i]*skalax), y0-round(y[i]*skalay)]:=clred;
Ellipse(x0+round(x[i]*skalax)-7, y0-round(y[i]*skalay)-7,
x0+round(x[i]*skalax)+7, y0-round(y[i]*skalay)+7);
end;
end;
end;

function tform1.fx(x:real):real;
begin
fx:=x*x+random(20)-10;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
timer1.Enabled:=false;
awal;
end;

end.

[Delphi] Linear and Quadratic Regression (just for self documentation)

The code below have the plots and graphs (linear and quadratic regression) included





unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, ExtCtrls, StdCtrls;

type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Image1: TImage;
Memo1: TMemo;
procedure awal;
procedure datamentah;
procedure plotdata;
procedure regresi;
procedure kuadratis;
procedure plotregresi;
function f(x:real):real;
function fk(x:real):real;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

const n=40; skala=3;
var
Form1: TForm1;
x0,y0:integer; x,y:array[-n..n]of real;
a,b:real; c:array[1..3]of real;
matrik:array[1..3,1..4]of real;
implementation

{$R *.dfm}
procedure tform1.kuadratis;
var sxi,sxi2,sxi3,sxi4,syi,syixi,syixi2:real;
i,j,k:integer; jml,simpan:real;
begin
sxi:=0;sxi2:=0;sxi3:=0;sxi4:=0; syi:=0;syixi:=0;syixi2:=0;
{sigma xi} {sigma xi kuadrat} {sigma xi pangkat3} {sigma xi pangkat4}
{sigma yi} {sigma yi*xi} {sigma yi* xi*xi }
for i:=1 to n do begin
sxi:=sxi+x[i]; sxi2:=sxi2+x[i]*x[i];
sxi3:=sxi3+x[i]*x[i]*x[i]; sxi4:=sxi4+x[i]*x[i]*x[i]*x[i];
syi:=syi+y[i]; syixi:=syixi+y[i]*x[i];
syixi2:=syixi2+ y[i]*x[i]*x[i];
end;
{isi matrik}
matrik[1,1]:=n; matrik[1,2]:=sxi;
matrik[1,3]:=sxi2; matrik[1,4]:=syi;
matrik[2,1]:=sxi; matrik[2,2]:=sxi2;
matrik[2,3]:=sxi3; matrik[2,4]:=syixi;
matrik[3,1]:=sxi2; matrik[3,2]:=sxi3;
matrik[3,3]:=sxi4; matrik[3,4]:=syixi2;
{gaus naif}
for k:= 1 to 3 do begin
for i:= k+1 to 3 do begin
simpan:=matrik[i,k];
if simpan=0 then begin end
else begin
for j:=k to 4 do
matrik[i,j]:=
matrik[i,j]/
simpan*
matrik[k,k]-
matrik[k,j];
end;
end;
end;
{subtitusi}
c[3]:=matrik[3,4]/matrik[3,3];for i:=2 downto 1 do begin jml:=0;for j:=i+1
to 3
do jml:=jml+matrik[i,j]*c[j]; c[i]:=(matrik[i,4]-jml)/matrik[i,i];end;
memo1.Lines.Append('c[1] = '+ floattostr(c[1]));
memo1.Lines.Append('c[2] = '+ floattostr(c[2]));
memo1.Lines.Append('c[3] = '+ floattostr(c[3]));
{plot kuadratis}
image1.Canvas.Pen.Color:=clred;
image1.Canvas.MoveTo(x0+round(x[-n]),y0-round(skala*fk(x[-n])));
for i:=-n to n do begin
image1.Canvas.lineto(x0+round(x[i]),y0-round(skala*fk(x[i])));
end;
end;

function tform1.fk(x:real):real;
begin
fk:=c[1]+c[2]*x+c[3]*x*x;
end;

procedure tform1.regresi;
var i:integer; xix,xixx,rx,ry:real;
begin
rx:=0;ry:=0;
for i:=1 to n do begin
rx:=rx+x[i]; ry:=ry+y[i];
end;
rx:=rx/n; ry:=ry/n;
memo1.Lines.Append('rx = '+floattostr(rx)); memo1.Lines.Append('ry = '+floattostr(ry));
xix:=0; xixx:=0;
for i:=1 to n do begin
xix:=xix+(x[i]-rx)*(y[i]-ry); xixx:=xixx+(x[i]-rx)*(x[i]-rx);
end;
b:=xix/xixx; memo1.Lines.Append('b = '+floattostr(b));
a:=ry-b*rx; memo1.Lines.Append('a = '+floattostr(a));
end;

procedure tform1.awal;
begin
randomize; memo1.Text:='';
stringgrid1.Cells[0,0]:='x'; stringgrid1.Cells[1,0]:='y';
stringgrid1.RowCount:=2;
datamentah;
plotdata;
regresi;
plotregresi;
kuadratis;
end;

procedure tform1.plotregresi;
var px,py:real;
begin
px:=-2*n; py:=a+b*(-2*n);
image1.Canvas.pen.Color:=cllime;
image1.Canvas.MoveTo(x0+round(px), y0-skala*round(py));
px:=2*n; py:=a+b*(2*n);
image1.Canvas.lineTo(x0+round(px),y0-skala* round(py));
memo1.Lines.Append('fungsi regresi: y ='+ floattostrf(a,ffGeneral,2,4)+' + '+
floattostrf(b, ffGeneral,2,4)+' x');
end;

procedure tform1.plotdata;
var i:integer;
begin
x0:=round(image1.Width/2); y0:=round(image1.Height/2);
image1.Canvas.MoveTo(0,y0); image1.Canvas.LineTo(image1.Width,y0);
image1.Canvas.MoveTo(x0,0); image1.Canvas.LineTo(x0,image1.Height);
for i:=-n to n do begin
image1.Canvas.Pixels[x0+round(x[i]),y0-round(skala*y[i])]:=clblue;
end;
end;
procedure tform1.datamentah;
var i:integer;
begin
stringgrid1.RowCount:=2*n+1;
for i:=-n to n do begin
x[i]:=i; y[i]:=f(x[i]);
stringgrid1.Cells[0,i+n+1]:=floattostr(x[i]);
stringgrid1.Cells[1,i+n+1]:=floattostr(y[i]);
end;
end;

function tform1.f(x:real):real;
begin
f:=x*x/32+random(20)-10;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
awal;
end;

end.

[Delphi] Differential of Function (just for self documentation)

Here the code, it have the graph of function and plot of it diferential (gradien) line



unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;

type
TForm1 = class(TForm)
Image1: TImage;
Timer1: TTimer;
procedure proses;
procedure awal;
function f(x:real):real;
function df(x:real):real;
function fs(x,xs,ys,m:real):real;
procedure gambar;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
dx:real=0.01;
x0,y0:integer;
implementation

{$R *.dfm}

procedure tform1.awal;
begin
{gambar sumbu}
x0:=round(image1.Width/2);
y0:=round(image1.Height/2);
with image1.Canvas do begin
moveto(0,y0);
lineto(image1.Width,y0);
moveto(x0,0);
lineto(x0,image1.Height);
end;
end;
function tform1.f(x:real):real;
begin
f:=10*cos(x)+x;
end;
function tform1.df(x:real):real;
begin
df:=(f(x+dx)-f(x))/dx;
end;
function tform1.fs(x,xs,ys,m:real):real;
var c:real;
begin
c:=ys-m*xs;
fs:=m*x+c;
end;

procedure tform1.gambar;
var i:integer;
x,y,x1,y1,m:real;
begin
// image1.Canvas.TextOut(0,0,'f(x)=x^2-2x-8 memiliki gradien '+floattostrf(df(0),ffnumber,8,2)+' di x=0');
image1.Canvas.TextOut(0,0,'f(x)=x^2-2x-8 memiliki gradien '+format('%8.2f',[df(0)])+' di x=0');
with image1.Canvas do begin
{gambar fungsi}
for i:=-200 to 200 do begin
x:=i/8;
y:=f(x);
x1:=(i+1)/8;
y1:=f(x1);
pen.Color:=clblue;
moveto(x0+i,y0-round(y));
lineto(x0+i+1,y0-round(y1));
end;
{gambar garis singgung}
m:=df(0);
for i:=-200 to 200 do begin
x:=i/8;
y:=fs(x,0,f(0),m);
x1:=(i+1)/8;
y1:=fs(x1,0,f(0),m);
pen.Color:=cllime;
moveto(x0+i,y0-round(y));
lineto(x0+i+1,y0-round(y1));
end;
end;
end;
procedure tform1.proses;
begin
awal;
gambar;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
timer1.Enabled:=false;
proses;
end;

end.

[Delphi] Gauss Naif Method (just for self documentation)

Here the code



unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
StringGrid1: TStringGrid;
StringGrid2: TStringGrid;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const n=3;
var
Form1: TForm1;
a:array[1..n,1..n+1]of real;
x:array[1..n]of real;
kotak:array[1..n] of tedit;
implementation

{$R *.dfm}

procedure bacamatrik;
var i,j:integer;
begin
for i:=1 to n do begin
for j:=1 to n+1 do begin
a[i,j]:=strtofloat(form1.StringGrid1.Cells[j-1,i-1]);
end;end;
end;

procedure tulismatrik;
var i,j:integer;
begin
for i:=1 to n do begin
for j:=1 to n+1 do begin
form1.StringGrid2.Cells[j-1,i-1]:=floattostr(a[i,j]);
end;end;
end;

procedure naif;
var i,j,k:integer;
simpan:real;
begin
for k:= 1 to n do begin
for i:= k+1 to n do begin
simpan:=a[i,k];
if simpan=0 then begin
end else begin
for j:=k to n+1 do a[i,j]:=a[i,j]/simpan*a[k,k]-a[k,j];
end;
end;
end;
end;
procedure subtitusi;
var i,j:integer;
jml:real;
begin
x[n]:=a[n,n+1]/a[n,n];
for i:=n-1 downto 1 do begin
jml:=0;
for j:=i+1 to n do jml:= jml+a[i,j]*x[j];
x[i]:=(a[i,n+1]-jml)/a[i,i];
end;
end;
procedure buatedit;
var i:integer;
begin
for i:=1 to n do begin
kotak[i]:=tedit.Create(form1);
kotak[i].Left:=300;
kotak[i].Top:=40+30*i;
kotak[i].Parent:=form1;
end;
end;
procedure isiedit;
var i:integer;
begin
for i:=1 to n do kotak[i].Text:=floattostr(x[i]);
end;

procedure TForm1.FormCreate(Sender: TObject);
var i,j:integer;
begin
randomize;
stringgrid1.RowCount:=n;
stringgrid2.RowCount:=n;
stringgrid1.ColCount:=n+1;
stringgrid2.ColCount:=n+1;
for i:=1 to n do begin
for j:=1 to n+1 do begin
a[i,j]:=random(20)-10;
stringgrid1.Cells[j-1,i-1]:=floattostr(a[i,j]);
end;end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
bacamatrik;
naif;
subtitusi;
tulismatrik;
buatedit;
isiedit;
end;

end.

[Delphi] Write to File (just for self documentation)

Here the code, the input method is still manual though, :)



unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Button6: TButton;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Button7: TButton;
procedure proses;
procedure simpanfile;
procedure simpanrecord;
procedure bacarecord;
procedure simpan;
procedure tampilkan;
procedure awal;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button7Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
tmahasiswa = record
nama,nim,alamat,offering,nhuruf:string[30];
umur:integer;
nilai:real;
end;
var
Form1: TForm1;
fileku:textfile;
files: file of tmahasiswa;
mahasiswa: tmahasiswa;
implementation

{$R *.dfm}
procedure tform1.awal;
begin
edit1.Text:='Nama';
edit2.Text:='NIM';
edit3.Text:='18';{umur}
edit4.Text:='Alamat';
edit5.Text:='Offering';
edit6.Text:='81';{nilai}
edit7.Text:='Nilai Huruf';

button6.Caption:='Simpan';
button7.Caption:='Tampilkan';
end;
procedure tform1.simpan;
begin
assignfile(files,'data.mp4');
reset(files);
mahasiswa.nama:=edit1.Text;
mahasiswa.nim:=edit2.Text;
mahasiswa.umur:=strtoint(edit3.Text);
mahasiswa.alamat:=edit4.Text;
mahasiswa.offering:=edit5.Text;
mahasiswa.nilai:=strtofloat(edit6.Text);
mahasiswa.nhuruf:=edit7.Text;

seek(files,filesize(files));
write(files,mahasiswa);
closefile(files);
end;
procedure tform1.tampilkan;
begin memo1.Text:='';bacarecord;end;
procedure TForm1.Button6Click(Sender: TObject);
begin simpan; end;
procedure TForm1.Button7Click(Sender: TObject);
begin tampilkan;end;

procedure tform1.bacarecord;
var text:string;
begin
assignfile(files,'data.mp4');
//filemode:=fmopenread;
reset(files);
while not eof(files) do begin
read(files,mahasiswa);
text:=mahasiswa.nama+' ('+inttostr(mahasiswa.umur)+') '+mahasiswa.nim+' '+mahasiswa.alamat+' '+mahasiswa.offering+' '+floattostr(mahasiswa.nilai)+' ('+mahasiswa.nhuruf+')';
memo1.Lines.Append(text);
end;

closefile(files);

end;
procedure tform1.simpanrecord;
begin
assignfile(files,'data.mp4');
rewrite(files);

mahasiswa.nama:='string';
mahasiswa.nim:='001';
mahasiswa.alamat:='malang';
mahasiswa.offering:='abc';
mahasiswa.nhuruf:='wow+';
mahasiswa.umur:=20;
mahasiswa.nilai:=60;
write(files,mahasiswa);

mahasiswa.nama:='qwerty';
mahasiswa.nim:='002';
mahasiswa.alamat:='malang';
mahasiswa.offering:='abc';
mahasiswa.nhuruf:='wow';
mahasiswa.umur:=22;
mahasiswa.nilai:=55;
write(files,mahasiswa);

mahasiswa.alamat:='tidak di malang';
mahasiswa.offering:='abc';
mahasiswa.nhuruf:='wow-';
mahasiswa.umur:=18;
mahasiswa.nilai:=55;
write(files,mahasiswa);

mahasiswa.nama:='dvorak';
mahasiswa.nim:='004';
mahasiswa.alamat:='batu';
mahasiswa.offering:='nyasar';
write(files,mahasiswa);

closefile(files);

end;
procedure tform1.simpanfile;
var i:integer;
begin
assignfile(fileku,'filesaya.txt');
rewrite(fileku);

write(fileku,'Hello ');
write(fileku,'world');

writeln(fileku);
for i:=1 to 10 do begin
write(fileku, i/2, ' ' );
//writeln(fileku);
end;

writeln(fileku);

for i:=1 to 10 do begin
write(fileku, i/2:5:1, ' ' );
//writeln(fileku);
end;


closefile(fileku);


end;

procedure tform1.proses;
var i:integer;
begin
memo1.Text:='';
for i:=1 to 10 do begin
memo1.Lines.Append('OK, ini adalah baris ke-'+inttostr(i));
end;
memo1.Lines.Strings[5-1]:='dengan';
{}
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
proses;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
simpanfile;
end;

procedure TForm1.Button3Click(Sender: TObject);
var text:string;
begin
assignfile(fileku,'filesaya.txt');
reset(fileku);
while not eof(fileku) do begin
readln(fileku,text);
memo1.Lines.Append(text);
end;
closefile(fileku);
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
simpanrecord;

end;

procedure TForm1.Button5Click(Sender: TObject);
begin
bacarecord;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
awal;
end;

end.

<\pre>
323f (5) amp (1) android (12) apple (7) arduino (18) art (1) assembler (21) astina (4) ATTiny (23) blackberry (4) camera (3) canon (2) cerita (2) computer (106) crazyness (11) debian (1) delphi (39) diary (286) flash (8) fortran (6) freebsd (6) google apps script (8) guitar (2) HTML5 (10) IFTTT (7) Instagram (7) internet (12) iOS (5) iPad (6) iPhone (5) java (1) javascript (1) keynote (2) LaTeX (6) lazarus (1) linux (29) lion (15) mac (28) macbook air (8) macbook pro (3) macOS (1) Math (3) mathematica (1) maverick (6) mazda (4) microcontroler (35) mountain lion (2) music (37) netbook (1) nugnux (6) os x (36) php (1) Physicist (29) Picture (3) programming (189) Python (109) S2 (13) software (7) Soliloquy (125) Ubuntu (5) unix (4) Video (8) wayang (3) yosemite (3)