Halaman

Minggu, 06 November 2011

ubuntu: Installing php apache mysql

Steps to install the webserver to your ubuntu ;)
  1. sudo apt-get install apache2
  2. sudo apt-get install mysql-server
  3. sudo apt-get install php5-mysql
  4. sudo /etc/init.d/apache2
  5. gksudo gedit /etc/apache2/httpd.conf
    insert this line(without the quotes) : "ServerName localhost"
  6. sudo apt-get install phpmyadmin
  7. If you do not specify password for your mysql installation, you need to modify the phpmyadmin config file. open gedit and edit the phpmyadmin configuration file "/etc/phpmyadmin/config.inc.php" and uncomment those line similar to this one :
    $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
Testing :
open firefox and type this address : http://localhost/phpmyadmin

Well done and congratulation, you basic server (local) configuration is ready! ;)

basic information :
your local website storage located in "/var/www" if you would like to configure for other location, you should do it within the apache virtual hosts.. and that's another topics i will try to cover next time..

Rabu, 02 November 2011

Packet Sniffer

When you are working with the internet / network, you need to make sure that the packet you sent/receive is what you are planning to get / send

This open source packet sniffer is a very great project. It could even sniff your password when you even though you send them using ssl/encryptions

Here is the link to that wonderfull project : http://code.google.com/p/ospy/

Very nice!!

Rabu, 26 Oktober 2011

Delphi : Working with path, file name, directory

From time to time, you would need file manipulations integrated with your software(s), and you usually needs the library for working with your directory, these are couples of directory routines which is very much usefull

  1. ExtractFilePath : this will returns the directory for a file, including a backslash("\" ~ Env. Windows) 
  2. ExpandFileName: Example : "c:\program files\yohan\is\cool\..\.." will returns "c:\program files\yohan\"
Two very handy functions! :)

Kamis, 20 Oktober 2011

Share : Palm Pre as a USB modem

Have the usb cable? have the data plan? have the thing to try out your palm pre as a modem? fear not as webosinternals once again provide us with the most sophisticated solution for Free, "Tethering" your palm pre as a modem..

you could tether using Wifi, Bluetooth, even USB connection..

without further ado.. let's get some do.., here is what you need to do..
cool rhyme isn't it? hehehe

  1. Download your driver, you could download it here.. (64bit driver) or (32bit driver)
    note : after you downloaded the file, remove the txt extension from the downloaded file
  2. Download FreeTether (look for it on preware, or using your webosquickinstall 4.x) or better yet, using google ;)
  3. Now plug your pre to the computer
  4. Open and run FreeTether, turn on the USB tethering
  5. Go to your windows device manager, look for the device.. something called "RNDIS gadget" with an exclamation mark on it's side
  6. Update your driver, navigate to where you store your download( ~ step 1 )
  7. Choose to manually look and install your driver
  8. After you install the driver, windows will automatically detected new network and tries to connect with it
  9. Wait for it..
  10. Enjoy surfing the internet :)
Have a great and blessed day everyone!

Selasa, 11 Oktober 2011

Sabtu, 24 September 2011

Delphi:runtime TDBGrid change default row height

type
  TyourHackGrid = class(TDBGrid);

TyourHackGrid(yourDBGrid).RowHeights[0] := 50;
Nice indeed ;)

Delphi : Load png to TBitmap

HI there good friends, for those of you who would like to get load a jpeg image and then load the data to a TBitmap object, here is a neat good trick to get it done :

procedure TForm1.btn1Click(Sender: TObject);
var
	bmp : TBitmap;
begin
    if(dlgOpenPic1.Execute()) then
    begin
        img1.Picture.LoadFromFile(dlgOpenPic1.FileName);

        bmp := TBitmap.Create;
        try
            bmp.Width := img1.Picture.Width;
            bmp.Height := img1.Picture.Height;

            bmp.Canvas.Draw(0, 0, img1.Picture.Graphic);

            Canvas.Draw(btn1.Left, btn1.Top + btn1.Height + 20, bmp);
        finally
            bmp.Free;
        end;
    end;
end;
Just dont forget to include the jpeg unit if you want to work with the jpegs, and for delphi 2009 and up you could add the PNGImage to work with png files on your delphi project

Have fun dear friends! ;)

Jumat, 23 September 2011

Playing with linux

Downloading file : use wget http://blabla.com/bla.zip
working with a tar.gz : tar -zxvf arcieve.tar.gz

since i like to play with installing the development.. this will include the header file XLib.h, XUtil.h
apt-get install xorg-dev

finding some file?
find / -name filename.ext -print

Rabu, 14 September 2011

WEBOS : Google map doesn't recognize your location?

A simple solution to that but might be not permanent is because of the latitude mode problem on the native google map application, me too had those similar problem, and browsing the web give me one solution that worked like charm ;)

Open your browser, clear your cache
hen go to the following address : http://maps.google.com/maps/m?mode=latitude


Google map application will open automaticly
and voila..
we had our location detected flawlessly.


Hints for the geek :
our palm pre phone is very much capable of the gps
try running this..
##DEBUG and you will find numerous wonderfull information there :)


Nice..


I love this phone..

Kamis, 25 Agustus 2011

Delphi : Variable Parameters, Packed Records

Variable Parameters
taken from www.chami.com
//
// FunctionWithVarArgs()
//
// skeleton for a function that
// can accept vairable number of
// multi-type variables
//
// here are some examples on how
// to call this function:
//
// FunctionWithVarArgs(
//   [ 1, True, 3, '5', '0' ] );
//
// FunctionWithVarArgs(
//   [ 'one', 5 ] );
//
// FunctionWithVarArgs( [] );
//
procedure FunctionWithVarArgs(
  const ArgsList : array of const );
var
  ArgsListTyped :
    array[0..$FFF0 div SizeOf(TVarRec)]
      of TVarRec absolute ArgsList;
  n         : integer;
begin
  for n := Low( ArgsList ) to
           High( ArgsList ) do
  begin
    with ArgsListTyped[ n ] do
    begin
      case VType of
        vtInteger   : begin
          {handle VInteger here}      end;
        vtBoolean   : begin
          {handle VBoolean here}      end;
        vtChar      : begin
          {handle VChar here}         end;
        vtExtended  : begin
          {handle VExtended here}     end;
        vtString    : begin
          {handle VString here}       end;
        vtPointer   : begin
          {handle VPointer here}      end;
        vtPChar     : begin
          {handle VPChar here}        end;
        vtObject    : begin
          {handle VObject here}       end;
        vtClass     : begin
          {handle VClass here}        end;
        vtWideChar  : begin
          {handle VWideChar here}     end;
        vtPWideChar : begin
          {handle VPWideChar here}    end;
        vtAnsiString: begin
          {handle VAnsiString here}   end;
        vtCurrency  : begin
          {handle VCurrency here}     end;
        vtVariant   : begin
          {handle VVariant here}      end;
        else          begin
          {handle unknown type here} end;
      end;
    end;
  end;
end;
Packed Records
Packed records is a way to align Delphi records. Delphi variables usually aligned at 2, 4, or 8 byte to optimize access, to make things clear, take a look at following code (taken from delphibasic.co.uk)
type
  // Declare an unpacked record
  TDefaultRecord = Record
    name1   : string[4];
    floater : single;
    name2   : char;
    int     : Integer;
  end;

  // Declare a packed record
  TPackedRecord = Packed Record
    name1   : string[4];
    floater : single;
    name2   : char;
    int     : Integer;
  end;

var
  defaultRec : TDefaultRecord;
  packedRec  : TPackedRecord;

begin
  ShowMessage('Default record size = '+IntToStr(SizeOf(defaultRec)));
  ShowMessage('Packed record size = '+IntToStr(SizeOf(packedRec)));
end;
there is more advanced usage for the record type of delphi, such as this one :
type 
   TRect = packed record
     case Integer of
       0: (Left, Top, Right, Bottom: Integer);
       1: (TopLeft, BottomRight: TPoint);
   end; 
TRect.TopLeft will map to the TRect.Left and TRect.Top, TRect.BottomRight will map to the TRect.Right and TRect.Bottom, anoher usage would be like this one :
type
   // Declare a fruit record using case to choose the
   // diameter of a round fruit, or length and height ohterwise.
   TFruit = Record
     name : string[20];
     Case isRound : Boolean of // Choose how to map the next section
       True  :
         (diameter : Single);  // Maps to same storage as length
       False :
         (length   : Single;   // Maps to same storage as diameter
          width    : Single);
   end;
when isRound is true, you could define 1 more variable, and that is the diameter:Single, and if isRound is false, you could define 2 more variable, that is length, and width

Sabtu, 20 Agustus 2011

Ubuntu : Adding new harddisk

First we need to list our hardware, is it detected yet by ubuntu? by using this command :
sudo lshw -C disk


make note of where your disk is, for example /dev/sdb


if you have gparted, then you got your self a rich partition manager, just go and choose your hardware (/dev/sdb in my example) and then new and then partition that disk

if you are using command line then there is the fdisk command

now to mount the device, simply create a new folder on your /media folder for the mount point example :
sudo mkdir /media/my_new_hd


and then to actualy mount it to the system :
sudo mount /dev/sdb /media/my_new_hd

now browse and get wild with nautilus

ah yes, to automatically mount the new HD, add the new hd to your your /etc/fstab file to something similar like this one liner :
/dev/sdb1 /media/mynewdrive ext3 defaults 0 2


**to launch editor, use sudo gedit /etc/fstab


I think i'm in love with ubuntu.. :D
unfortunately delphi is not there..
the games is not there..
but there is always lazarus ;)

ah yes, i currently running ubuntu 8.04, old i know, but that the only CD i had :D it's adequate for me to play aground with this powerful opensource OS

Have Fun everyone!

Solving Problem : using putty, connecting to Amazon EC2

There is a trick if your pem file converted to ppk (putty's private key) and the server respond is :
Server do not accept our key or something similar like that, server send public key etc..

On one blog i find that we need to open the pem file on a notepad and then add one line to the last line, so make sure you get your cursor under those texts..

One line is enough ;)

Now get to putty again, (i'm using ubuntu) so when the putty ask :"Login As" i answered Ubuntu and voila.. we get our self a great powerful cloud server

Kamis, 18 Agustus 2011

Playing with ubuntu

Playing with ubuntu fresh install, my target is to install indefero, mercurial to a vps, so i practice it using a virtual box.
the following is the commands for editing creating renaming file directory install etc, including installing the lamp and the pluf :)

  1. To rename dir or rename file using ubuntu comand line : mv
  2. To download file wget http://...
  3. To become a super user : sudo bash...
  4. To launch explorer along as super user : gksudo nautilus
  5. To restart apache : sudo /etc/init.d/apache2 restart
  6. To install sudo apt-get install package
  7. To upgrade apt : sudo apt-get upgrade
Ah yes, there are many more to explore!

Selasa, 16 Agustus 2011

Delphi : Dynamic object creation, Class Reference

A quick note for those delphi developer needs to use the dynamic object creation :
using the class reference is the good way to do it :)

a simple example :
procedure TForm1.Button1Click(Sender: TObject);
type
  CRForm = class of TForm;
var
  a: array[0..2] of CRForm;
  c: TForm;
begin
  a[0] := TForm2;
  a[1] := TForm3;
  a[2] := TForm4;

  c := TForm(a[2].Create(self));

  c.ShowModal;

  c.Free;
end;           
welcome to the power! :)
hope you could utilize this technique on your next application development adventure!

Rabu, 10 Agustus 2011

Solving : Windows Update Standalone Installer 0x80070422 The service cannot be started, either because it is disabled or because it has no enabled devices associated with it

If you stumbled that one,
you have accidentally disabled Windows Update Service, to enable the service again go to your Administrative Tools, and enables the Windows Update Service

Here is the step :
  1. Click on Windows Icon / Start Menu
  2. Administrative Tools
  3. Services
  4. Search for "Windows Update", double click on it, and then enable this service
hope this help! :)

Selasa, 09 Agustus 2011

Delphi XE : Out of memory

A great solution found by Giedrius Bauza
HKEY_CURRENT_USER – SOFTWARE – MICROSOFT – WINDOWS – INTERNET SETTINGS – ZONES
if you find Letter not Numbers, delete the Letter one.

Cheers! :)

Thank you mr. Bauza.

Rabu, 03 Agustus 2011

Delphi : Samples

Leverage your delphi skills by utilizing samples, read it, earn it, and sleep with it :D
http://www.torry.net/pages.php?id=352

regards everybody

Kamis, 28 Juli 2011

Delphi : Static variable

Static variable on a class :
type
  TMyClass = class(TObject)
  public
    class var X: Integer;
  end;

Selasa, 26 Juli 2011

Delphi : Invalid Pointer Operation

owhh my!! what a...
what is this invalid pointer operation, where could i trace the source of the bug??

:D

Do not mend my friend for there is a will there is a way..

first you will need this wonderful project :
http://sourceforge.net/projects/fastmm/
  1. Do not forget to set the "FASTMM4Options.inc" on your directory of units and looks for the line that says FullDebugMode
  2. Go to your project options : set linker map to "Detailed"
  3. Include the "FastMM_FullDebugMode.dll" to where your binary is executed
now.. when there is memory leaks detected, you will get a full detailed causes and stacks trace

Woow....
just Wow.. 
:)

Productivity : Using bookmark on CodeGear

You can mark a location in your code with a bookmark and jump directly to it from anywhere in the file. You can set up to ten bookmarks. Bookmarks are preserved when you save the file and available when you reopen the file in the Code Editor.

  1. To set a bookmark
    In the Code Editor, right-click the line of code where you want to set a bookmark. The Code Editor context menu is displayed.
    Choose Toggle BookmarksBookmark n, where n is a number from 0 to 9. A bookmark icon  is displayed in the left gutter of the Code Editor.
    Tip: To set a bookmark using the shortcut keys, press CTRL+SHIFT and a number from 0 to 9.

  2. To jump to a bookmark
    In the Code Editor, right-click to display the context menu.
    Choose GoTo BookmarksBookmark n, where n is a number from 0 to 9.
    Tip: To jump to a bookmark using the shortcut keys, press CTRL and the number of the bookmark. For example, CTRL+1 will jump you to the line of code set at bookmark 1.

  3. To remove a bookmark
    In the Code Editor, right-click to display the context menu.
    Choose Toggle BookmarksBookmark n, where n is the number of the bookmark you want to remove. The bookmark icon is removed from the left gutter of theCode Editor.
Tip: To remove all bookmarks from a file, choose Clear Bookmarks


Reference : Embarcadero

Senin, 25 Juli 2011

I am Blessed!

Have you look at your mother eyes lately?
Have you hold Her hand and say thank you deep from your hearth?

How's your Father, the one who protects you from everything? putting roof on your head? giving beds to your sleep, giving good dreams everyday?

Your Parents are your heaven, remember that always! though some times it could be hard to understand them, it's actually harder for them to understand yours, but they always tried to understand yours, have you tried to understand theirs? :D

My mother approach me today and said she had the money to help me buy the house, i have 21 mil in my hand, and she said she could help me with another 40 mil, i know that she don't have that much of money, i'm really confused why she told me that.. maybe someday i will understand what's the meaning of her words..

My mother always told me not to give up on everything, not to scare on anything except the Lord ;)
she is not only told me, but she is showing it to me each and every day

she told me to believe the good Lord with every breath, expects everything good in the future

She is the most optimistic person i ever met :) Thank you mom.. thank you dad, thank you big sister

a taste of heaven on earth.. thank you Lord

So.. i will not give up! never!

My mother is my role model my father is my guardian and my sister is my guidance and so my friends, what more could i ask for?

Thank you Lord, i'm very grateful

Minggu, 24 Juli 2011

Delphi : How to rotate bits?

Rotating bits using delphi is not directly supported
here is a function i found searching the internet to rotate the bits :
function JHROR32(Value : dword ; N : integer) : dword ;
begin
  Result := (Value shr N) + (Value shl (32-N));
end;

function JHROL32(Value : dword ; N : integer) : dword ;
begin
  Result := (Value shl N) + (Value shr (32-N));
end;
Hope you find it usefully! ;)

Source : http://www.merlyn.demon.co.uk/del-bits.htm

C++ and Delphi bitwise operator

Converting Eh?
Operator name Syntax in C
Bitwise NOT ~a Yes
Bitwise AND a & b Yes
Bitwise OR a | b Yes
Bitwise XOR a ^ b Yes
Bitwise left shift a << b Yes
Bitwise right shift a >> b Yes
Hmm.. not a pretty sight :D
but there it is :
note : delphi shifting : "shl" and "shr"

Delphi Variable sizes

Although we are on a high programming language, the size of variables is very important when you are working with untyped / binary files and also socket programming, here is the basic types and also their sizes
Type  Storage size                        Range            
 
 Byte       1                             0 to 255
 ShortInt   1                          -127 to 127
 Word       2                             0 to 65,535
 SmallInt   2                       -32,768 to 32,767
 LongWord   4                             0 to 4,294,967,295
 Cardinal   4*                            0 to 4,294,967,295
 LongInt    4                -2,147,483,648 to 2,147,483,647
 Integer    4*               -2,147,483,648 to 2,147,483,647
 Int64      8    -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
 
 Single     4     7  significant digits, exponent   -38 to +38
 Currency   8    50+ significant digits, fixed 4 decimal places
 Double     8    15  significant digits, exponent  -308 to +308
 Extended  10    19  significant digits, exponent -4932 to +4932
 
 * Note : the Integer and Cardinal types are both 4 bytes in size at present (Delphi release 7), but are not guaranteed to be this size in the future. All other type sizes are guaranteed.
This table is pasted from the original source at http://www.delphibasics.co.uk/Article.asp?Name=Numbers a great website for leaning delphi language

Have a good and nice day everyone.

I'm trying to leaving my traces for anyone who would venture the world of programming

hehehehe :D

Source Code

Looking for a fast way to accomplish your programming task?

search here! :)
http://koders.com/info.aspx?page=LanguageReport&la=delphi

a very great source code resource for your repetitive job
do not, re-invent the wheel  dear friend..

Jumat, 22 Juli 2011

C++ Xml Processing

Looking for components to utilize the power of xml to your applicaitons?

here is the two major xml library that i find to be simple and portable (linux, windows, mac)
http://xerces.apache.org/xerces-c/
http://www.grinninglizard.com/tinyxml/

Free Fonts Resource

Cool fonts for your project :
FontSquirel absolutely free for commercial
Dafont - some free for commercial,some are not..
fonts4free.net - some free for commercial some are not

Selasa, 19 Juli 2011

Clearing the screen "CLS" command on Linux

you can use the clear command or the cntrl+l

:D Enjoy..

Linux environtment on Windows system?

The answer is Cygwin!
as a developer, you would need the gcc compiler at the minimum ;)

Neat project!

Senin, 04 Juli 2011

Catatan Penting Developing App for palm pre

Just a simple reminder to my self :

  1. Never forget to destroy textures
  2. add virtual to your destructors
  3. check and re-check if you are comparing floating value
  4. memory management for palm pre
  5. debugging a palm pre app
  6. for memory leak detector, use VLD
  7. https://developer.palm.com/content/api/dev-guide/pdk.html
that's it and you are good to go

Senin, 27 Juni 2011

Aku bersyukur

Doa bukan kata-kata yang indah, tapi doa datang dari lubuk hati yang paling dalam
yap, aku manusia yang penuh dosa, dosa-ku yang membuat Mu sulit untuk mendekatiku
namun aku tahu ya Bapa, engkau selalu ada disana dan melihat keluargaku

Namun Roh Kudus yang sungguh mulia, selalu bisa menembus bata yang kubangun sendiri
Dia menuntunku untuk masuk hadirat Mu, Bapa.

Aku bersyukur.

Ayah yang selalu melindungiku
Ibu yang selalu mengasihiku
Kakak yang selalu ada untukku

dan berkat yang ter-indah yang Engkau berikan untuk hidupku :

Pandewi, istri yang selalu setia, mendoakan suaminya, menjaga anaknya, tidak pernah merasa lelah dalam apapun untuk keluarganya
Nadiva, anak yang cantik, penuh kasih, lembut, pintar dan selalu dikelilingi oleh penjaga-penjaga Mu yang mulia

Bapa,

Aku sungguh bersyukur..
Tidak ada lagi yang bisa aku minta daripada Mu, aku hanya ingin mengucapkan ini ya Bapa.

Aku sungguh, sungguh bersyukur..

Engkau selalu baik.

Tuhan Yesus.

maafkan kelancanganku ya Bapa, aku ingin menghancurkan hati yang keras.

Amin.

Bandung,
My Child Hood Home
Boko 2

27 Juni 2011

Minggu, 26 Juni 2011

Delphi : Tips on Retrieving/Storing Pointer/Objects/Clasess to/from a variant

Hello there! this really is a lovely day isn't it? :)
I come accross another great tips for you using variants object types and also how to use them with pointers and objects
for a little note, objects are classes, and objects and classes ARE pointers
  1. Storing pointers objects / classes / pointers to a variant
    1. cast the objects / classes / pointers to a native int : NativeInt(aPointer);
    2. store the NativeInt to the variant variable
  2. Retrieve stored pointers / objects / classes from a variant
    1. preapare a NativeInt variabele, and assign the variant containing objects / classes / pointers to the NativeInt variable
    2. cast the NativeInt variable to the pointer type, classes that you need TObject(the_NativeInt_variable).className;
Voila! another neat trick which will do the rest :) God bless you everyone!

Sabtu, 25 Juni 2011

Web Application using Pascal Language??

Yes!! This is indeed possible
ever wanted to create web apps using our favorit language (Pascal)??
you could do it using WebSnap, building web apps in a snap! hehe

here is a step by step guide for you to run and build a simple hello world application using CodeGear 2007 + websnap.
  1. Using wizzard, create a websnap application : file >> New >> Other >> Websnap Application
  2. Select  Web app debugger executable
  3. Enter your Class name and Page name
  4. Hit that OK Button
  5. Important, websnap use Indy9 instead of Indy10 so you should point your project search path to Indy9 Lib, on my computer it is in C:\Program Files\CodeGear\RAD Studio\5.0\lib\Indy9
  6. Now click on Run
  7. After the project compiles and runs, go to the IDE, Tools >> Web App Debugger
  8. On the Web App Debugger form, click on the Start button, now click on the default address http://localhost:8081/ServerInfo.ServerInfo
  9. Important, if you are on Window 7, or if you encounter an 404 Page you need to allow all of the firewalls permissions, go to the CodeGear installation directory(on my computer it is in C:\Program Files\CodeGear\RAD Studio\5.0\bin) and then run serverinfo.exe, try again that http://localhost:8081/ServerInfo.ServerInfo
  10. Congratulations!! this is your first WebSnap applications (Web app built on pascal language). Now.. go wild! :)
Have a great day everyone! This should revolutionize RAD WEB APP

Kamis, 16 Juni 2011

I Love it!! just love it!

Ahaha, yesss, right now is maybe the worst position i've ever had..

  1. Sisa uang tinggal 4.1jt, mudah-mudahan tahan buat 2~3 bulan
  2. Belum punya pekerjaan (ada tawaran dari pak. Priyatna, yippeee!! thank you Lord)
  3. Game Pipe The Mob belum selesai-selesai, susah di bagian assetsnya.. ternyata mengembangkan asset sungguh butuh banyak modal.. but i will not go down
  4. Swamped with projects!..Jo, Hen, Personal (can i pull them off together??)
  5. Musti kudu wajib selesaikan akte lahir diva, no matter wot!!
Hmmh, but truly said, by looking at those lists, i'm doin just great! i'm not in trouble at all ;)

listening to the song..
MySpace, Forever and ever, ameen ~ Randy Travis

I will not fail my family

Rabu, 25 Mei 2011

Trying to install iAtkos 10.6.3 on my PC

Owhh nnno... the dvdrom is very much exhausted,
hmmph, i need to get another target..

my laptop??

ehehehe
now i tried to install iAtkos to my Lenovo G450

first atempt is failed

now i tried to enter "-f -v" without the quote to the boot
yes it's booting up..

now for the fun part..
should i erase all of my data? hmmh...

Senin, 16 Mei 2011

Hints : jangan pernah membandingkan float dan integer

Yapp!!
Walaupun  kelihatan sederhana, namun untuk dunia programming, sungguh sangat di-'haram' kan untuk membanding kan integer dan float dalam conditional..

hari ini dalam pembuatan game pipe the mob, saya mencari bug yang ternyata di akibatkan oleh variable-variable inih!! menghabiskan waktu cukup lumayan.. ~12 jam di depan komputer hanya untuk menemukan kesalahan ternyata ada pada pembandingan float dan integer..

hixs..

Lesson learned! :D

Kamis, 05 Mei 2011

Alpha channel di SDL dan OpenGL

Ini suatu trick yang penting namun sering dilupakan, misalkan kamu pengen menduplikasi SDL_Surface dan preserve alpha channel nya sebab hendak digunakan fungsi alpha blending OpenGL, sebelum di SDL_BlitSurface sebaiknya matikan dulu alpha blending dari source nya dengan cara sebagai berikut :

SDL_SetAlpha(src, 0, src->format->alpha);

ini dilakukan supaya blitting dilakukan penuh (pixel information attached)

semoga membantu! :)

Selasa, 03 Mei 2011

Memory leaks! help!

Buat yang suka coding pake c++ tentu memory leaks sudah bukan hal yang asing lagi khann?
nah untuk mendeteksi memory leaks di visual studio 2008 bisa dibantu dengan suatu library yang sungguh mempesona dengan nama "Visual Leak Detector" yang bisa didapatkan di http://vld.codeplex.com/releases/view/63238

untuk menggunakannya cukup mudah, bisa mengikuti dokumentasi yang ada di web itu, namun untuk yang menemui kendala mungkin bisa dicoba dengan cara dibawah ini :
  1. Install Visual Leak Detectornya
  2. Tambahkan included files ke visual studio
  3. kopikan file dll visual leak detector ke direktori project (debug direktorinya)
  4. include kan "vld.h" di main entry program kamu
  5. coba run dengan konfigurasi debug
  6. nah lihat di output console nya, kalau ada output visual leak detector maka selamat :D anda sudah menginstall visual leak detector dengan baik dan benar
untuk membantu memberantas memory leak, berikut ini adalah beberapa kesalahan yang sering dilakukan terhadap pointer
  1. lupa mengalokasikan memory untuk pointer
  2. re-lokasi memory kepada pointer yang sudah dialokasikan
  3. pada destructor yang menggunakan polymorphism, lupa mencantumkan virtual pada destructornya
  4. hmm apa lagi yah.. kayaknya segitu dulu, nanti kalo ada inpoh lagi saya akan masukkan lagi ;)
owhh, ada referensi yang bagus mengenai management memory disini

happy leak hunting!

Begin to program - part 1

jadi? sudah siapkan jadi programmer?? mau jadi programmer yang seperti apakah coba? yang bisa baca koding doanks atau memang bisa desain program? atau yang multi fungsi? hhe apapun pilihan anda dan dimanapun anda sekarang, sudah merupakan posisi yang terbaik dari diri anda sendiri.

i love to program, but that doesn't means all of my live relies on it. ;)

okeh, sekarang tentang programming itu sendiri, buat saya pribadi untuk belajar programming secara otodidak, saya bagi pemahaman saya sendiri jadi 4 bagian penting untuk bisa membuat program, yakni :
  1. Variables
  2. Looping
  3. Conditional
  4. Functions / Sub-routines
cuman empot??? emapt??? whatt??
hhe iyah, inih menurut saya lho yah, belum tentu kata orang lain demikian, anywey.. mari kita mulai..

Variables

Variables apa yak? sederhana koqs, variabel adalah tempat kita menyimpan data-data yang kita perlukan, secara teknis, komputer itu adalah tempat untuk menyimpan data, mengolah data, kemudian menampilkannya, ini ide kenapa sampai disebut sebagai compute-er, yang melakukan komputasi, begitu..

nah variable ini sendiri bertugas untuk memetakan data kedalam dunia digital komputer, anggaplah variable ini sebagai sebuah piring, dan meja makan adalah komputernya, nah kalo piring isinya kan bisa macem-macem? ada yang isi kuah, ada yang isi gorengan, dan lain-lain, bahkan ada piring yang tujuannya hanya untuk sebagai alas saja, yakni alas untuk cangkir :)

Penuhnya piring di meja sudah menunjukkan bahwasanya ada pembatasan jumlah variable

pada saat artikel ini dibuat ada beberapa satuan untuk satuan memory, berikut ini adalah satuan-satuan untuk memory :
  1. bit
  2. byte
  3. page
lha memory?? tadi variable?? iyups, variabel adalah representasi manusia terhadap memory. contohnya, variabel bilangan bulat (seringkali disebut sebagai integer) dengan skala nilai mulai dari 0 sampai dengan 65535 menempati memory sebesar 2 byte

kalo dianalogikan kedalam meja dan piring tadi, variabel ini adalah piring, luasan piring adalah memory, dan meja sendiri adalah komputernya, got it? ;)

data di dunia komputer selalu diglobalisasi / di generalisasi dalam angka 0 dan 1, (bilangan biner yang itu tea..)

nah, demikianlah tentang variable, semoga ada kawan-kawan yang terbantu sedikit mengenai variable ini pada kesempatan berikutnya saya akan mengupas tiga hal berikutnya (looping, conditional, dan functions) ;)

have a great and blessed day everyone!
JLU!