Nugroho's blog.

Thursday, March 14, 2019

Create Res2DMod File from Delphi

I post the full source code below

 
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    Edit11: TEdit;
    Edit12: TEdit;
    Edit13: TEdit;
    Edit14: TEdit;
    Edit15: TEdit;
    Edit16: TEdit;
    Edit17: TEdit;
    Button1: TButton;
    StringGrid1: TStringGrid;
    procedure FormCreate(Sender: TObject);
    procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
      var CanSelect: Boolean);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var i,j:integer;
begin
  edit1.Text:='Fault Model';
  edit2.Text:='51';
  edit3.Text:='15';
  edit4.Text:='0';
  edit5.Text:='1.0';
  edit6.Text:='2';
  edit7.Text:='0,200,3';
  edit8.Text:='4';
  edit9.Text:='200.0, 350.0, 175.0';
  edit10.Text:='14';
  edit11.Text:='0.2500, 0.5000, 0.7125, 1.1875, 1.6875, 2.3125,'+
                '3.1875, 4.4375, 6.4375, 10.4375, 18.4375, 34.4375,'+
                '66.4375, 130.4375 ';
  edit12.Text:='3';
  edit13.Text:='0';
  edit14.Text:='0';
  edit15.Text:='0';
  edit16.Text:='0';
  edit17.Text:='0';
  for i:=0 to 13 do begin
    for j:=0 to 209 do begin
      stringgrid1.Cells[j,i]:='0';
    end;
  end;
end;

procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
  if stringgrid1.Cells[ACol,Arow]='0' then
    stringgrid1.Cells[ACol,Arow]:='1' else
      stringgrid1.Cells[ACol,Arow]:='0';
end;

procedure TForm1.Button1Click(Sender: TObject);
var f:textfile;
    s:string;
    i,j:integer;
begin
  assignfile(f,'data.mod');
  rewrite(f);
  writeln(f,edit1.text);
  writeln(f,edit2.text);
  writeln(f,edit3.text);
  writeln(f,edit4.text);
  writeln(f,edit5.text);
  writeln(f,edit6.text);
  writeln(f,edit7.text);
  writeln(f,edit8.text);
  writeln(f,edit9.text);
  writeln(f,edit10.text);
  writeln(f,edit11.text);
  for i:=0 to 13 do begin
    s:='';
    for j:=0 to 209 do begin
      s:=s+stringgrid1.Cells[j,i];
    end;
    writeln(f,s);
  end;
  writeln(f,edit12.text);
  writeln(f,edit13.text);
  writeln(f,edit14.text);
  writeln(f,edit15.text);
  writeln(f,edit16.text);
  writeln(f,edit17.text);

  closefile(f);
end;

end.

.

Parsing a String to Get a certain Substring (Serial Number, Product Keys, etc)

I have a question from a new friend on my instagram

Basically, he needs only certain substring.

Here's my code to parse the string.

 

The main code is

s          := edit1.text;
p          := pos('ME',s);
edit2.text := copy(s,p+2,13);
.

Wednesday, September 27, 2017

Not Enough Disk Space to Install High Sierra?

Just move the installation file to flash drive.

It's on Application folder. Just drag it to flash drive.

Just make sure that it have ntfs or hfs or Mac OS Extended format. FAT will not be able to copy it since it's more than 4GB.



Monday, July 3, 2017

Adding a Comma between Author and Year on Biblatex?


Simple, just add this line at preamble.

\usepackage[style=authoryear]{biblatex}
\renewcommand{\nameyeardelim}{\addcomma\addspace}

.

Monday, June 12, 2017

Change '1st Edition' into 'Edisi 1' in LaTeX.

My LaTeX document on Indonesian language has had proper citation style on bibliography using biblatex; the ''disitasi pada halaman" instead of "cited on page".

Of course the new problem arise. Like this.




Look that I have "1st Edition" or "2nd Edition" here and there. It supposed to have "Edisi 1" or "Edisi 2" form respectively.

Okay, thats not new problem (it's the kind of the last minute problem before the show, :D ).

So I add this line at the preamble.
\DefineBibliographyStrings{english}{
 backrefpage = {disitasi pada halaman},
 backrefpages = {disitasi pada halaman-halaman},
 edition = {edisi},
 in = {dalam},
 and = {dan},
 urlseen = {diakses pada}
}
\DeclareFieldFormat{edition}{\ifinteger{#1}{\bibstring{edition}~\mkbibordedition{#1}}{#1\isdot}}
.

Looks good.

Change the "Cited on Page" Strings in LaTeX.

I have LaTeX document written in Indonesian and it's nice and yada yada. The minuscule problem is the bibliography. I used biblatex and it look like this.





The problem is "cited on page" and "cited on pages" string. It's supposed to be "disitasi pada halaman" and "disitasi pada halaman-halaman".

What I need is add this lines to preamble.

\DefineBibliographyStrings{english}{
 backrefpage={disitasi pada halaman},
 backrefpages={disitasi pada halaman-halaman}
}


And I got this, :)

All was well, :)



HyperRef and Bookmark Combo in LaTeX.


I use this preamble in order to show bookmarks on PDF generated from my .tex file.

This way, we could navigate through part, chapter, section and subsection (depending on our depth setting) using table of content sidebar of PDF reader.

code

\usepackage{hyperref}
\hypersetup{hidelinks,backref=true,pagebackref=true,hyperindex=true,colorlinks=false,breaklinks=true,urlcolor= ocre,bookmarks=true,bookmarksopen=true,bookmarksdepth=3,pdftitle={Title},pdfauthor={Author}}
\usepackage{bookmark}
\bookmarksetup{
open,
numbered,
addtohook={%
\ifnum\bookmarkget{level}=0 % chapter
\bookmarksetup{bold}%
\fi
\ifnum\bookmarkget{level}=-1 % part
\bookmarksetup{color=ocre,bold}%
\fi
}
}
.
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)