Halaman

Jumat, 30 November 2012

[Debian VPS]Installing lamp, till bind9

Edited: 29 Jan 2015
To manage this kind of things, let's use a more powerfull thing which is called Webmin. Download the debian package, and then setup Apache Virtual Hosts, and Bind Configuration from there.

side note: when installing bind to the VPS, we should set the DNS Server to 127.0.0.1 (localhost) and then set the bind dns forwarding accordingly.

-----------OLD ARTICLE STARTING-------->>

I was tempted with the low price on vps these days, and it's my goal someday to create a multiplayer game.. err not multiplayer.. but online where people could play and compete with each other online.. ;)

any whoo..

the steps..

  1. After you receive your username, password, and ip address, log in to you vps SSH by ussing putty
  2. Start by upgrading.. aptitude update && aptitude upgrade
  3. Next, install mysql aptitude install mysql-server mysql-client
  4. Enter you mysql username and password, don't lose it
  5. install the server aptitude install apache2 apache2-doc

Minggu, 25 November 2012

[c++]Void Ptr storing your pointer to classes

A quick note, if you do store your inherited class, and then store them to a void pointer. Later on you call a method which is "public" from the parent class, please remember to static cast your void ptr to the parent class because:

DerivedClass *dc = new DerivedClass();
void *ptr = dc;

..
..
some mumbo jumbo.. :)
..
..

void SomeFunction(void *ptr)
{
BaseClass *base = (BaseClass*)ptr;
//this will give you access violation which willl gives you a head scratcher.. i've been there.. :'(
}

to fix above situation, you should

BaseClass *dc = new DerivedClass();
void *ptr = dc

//.. now it is safe to use
//that SomeFunction

..why?? dunno.. but it worth as a note.. well at least for me that is.. hehe ;) Cheers!

Jumat, 02 November 2012

[c++] Function Pointers Snippet

Hi there, let the code speaks for it self.. ;)


// funtors.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

typedef float (*MyFuncPtrType)(int, char *);
MyFuncPtrType my_func_ptr;

float test_func(int a, char *c)
{
 fprintf(stderr, "in a function with argument: %d, %s\n", a, c);
 fflush(stderr);

 return a + 10.123f;
}

class functors;

typedef float (functors::*ClassMemFuncPtr)(int, char *);
// For const member functions, it's declared like this:
typedef float (functors::*ClassConstMemFuncPtr)(int, char *) const;

class functors
{
public:
 virtual ~functors()
 {
  obj = 0;
 }

 void invoke()
 {
  (obj->*memx)(10, "Yeah!!");
 }

 void bind_x(MyFuncPtrType funcPtr)
 {
  x = funcPtr;
 }

 float invoke_x(int a, char* c)
 {
  return x(a, c);
 }

 void bind_memx(functors *obj, ClassMemFuncPtr mem_func)
 {
  this->obj = obj;
  memx = mem_func;
 }

 float invoke_memx()
 {
  return (obj->*memx)(11, "Uh yeahh.. i'm invoked!!");
 }


private:
 MyFuncPtrType x;
 ClassMemFuncPtr memx;

 functors *obj;
};

class derived: public functors
{
public:
 float derived_func(int a, char *c)
 {
  fprintf(stderr, "I got called with the following params: %d, %s", a, c);
  return 1.01111f;
 }
};

int _tmain(int argc, _TCHAR* argv[])
{
 my_func_ptr = test_func;

 float a = my_func_ptr(10, "yohan");
 fprintf(stderr, "%f\n", a);
 fflush(stderr);

 functors *base = new functors();

 base->bind_x(test_func);

 a = base->invoke_x(11, "pandewi");
 fprintf(stderr, "%f\n", a);
 fflush(stderr);

 //testing member function..
 derived *the_derived = new derived();

 base->bind_memx(the_derived, static_cast(&derived::derived_func));

 base->invoke_memx();

 delete the_derived;

 base->invoke_memx();

 delete base;

 return 0;
}

Kamis, 25 Oktober 2012

[Irrlicht]Working with files:Intro

Hi there! if any of you need a quick code snippet to work with file in Irrlicht:

//Reading file sample
io::IReadFile *f = App::Instance()->GetDevice()->getFileSystem()->createAndOpenFile("didum/dadam/anykindoffile.ext");

//this is how you get actual path (physical/not relative), it will return the input given to it if no actual path was found
io::path p = App::Instance()->GetDevice()->getFileSystem()->getAbsolutePath("didum/dadam/anykindoffile.ext");

//preparing a buffer to save the file contents
char *buffer = new char[f->getSize()];
long fl = f->getSize();

//read that file to the buffer
f->read(buffer, f->getSize());

//writing file sample
io::IWriteFile *wf = App::Instance()->GetDevice()->getFileSystem()->createAndWriteFile("savedname.saved");
wf->write(buffer, f->getSize());
wf->drop();
f->drop();

delete [] buffer;
Fair warning though.. i did not included the safe checking for the file exists etc.. i guess you know where to put them right ;) Cheer!

Minggu, 21 Oktober 2012

[Irrlicht]Blender 2.6X as your game scenes editor?

Just a quick note for me to implement scene / level editor in the future,
You could generate your UVs, Images, Vertices, Faces (even triangulates them) through the python scripting library..

And by using blender's "Append / Link" along with "Custom Properties" , we should be able to load / re-use and do almost everything to compose our game world. Wouldn't it be great to have msvc express for the IDE, angelscript / lua as the scripting interface, and Blender as your modeler and game scene editor?

For the 'future me" here is a list of scripts function which will help you.. :p
  1. dont forget the 'dir' command! example: dir(bpy.data.meshes['mesh_id']
  2. bpy.data.images['IMAGE_ID'].filepath for retrieving physical location of the image file used as the texture
  3. bpy.data.libraries['LIB_ID'] for your external files..
  4. list(bpy.data.meshes["YOUR_MESH_ID'].vertices) this is an array of your vertices
  5. list(bpy.data.meshes[' YOUR_MESH_ID '].faces[1].vertices) this is the face, and the indexs of your vertices
  6. it is a bit longer to get this one.. but here it is.., to get the texture coordinates: bpy.data.meshes["YOUR_MESH_ID"].uv_textures['UVMap'].data[1].uv# with # being 1 to 4..
  7. a simple tutorial on wikibook : exporting scene!
Now there you have it.. a complete arsenal to represent a 3d world (vertices, faces, textures, texture coordinates, and transforms..) what? owh yes.. what about animation you asked? well.. for the time being, if you need an animated mesh, you should consider manually add them to your 'static' world ;)

cheers!

Kamis, 06 September 2012

XNA, .NET: Solving The located assembly's manifest definition does not match the assembly reference

Yup, ran across this one, which to the popular believe as the errors which every .net programmer should face. The problem arise when i tried to compile a new assembly version, and then when i compile/build old project, the project complains about The located assembly's manifest definition does not match the assembly reference. Tried to delete the assemblies, removing the references but to no avail.
Finally, i tried to modify app.config and then changes this line (yours might be similar)

<bindingRedirect oldVersion="0.0.0.0-1.4.0.0" newVersion="1.2.0.0"/>

Now the program compiles successfully. Hope to help someone else ;)

Ciaoo!

Selasa, 04 September 2012

Win7 XAMPP, port 80 problem. Could not start xampp

I could not start xampp on my computer, i think i need to put the findings here. Just in case i need them again, or someone else having the same problem as i had
  1. Open your comand prompt and type netstat -ano
  2. Search for the line which is listening to port 80, note the PID
  3. If the PID is not 4 then you may have the solution right away. Go back to command and type tasklist
  4. Search for the PID, if it's Skype, you need to change the port by using the advanced configuration panel, if any other program, re-check if you need the program, if you don't need it, you may simply do a taskkill -pid [pid]
  5. You may restart your xampp now.
  6. Other area you might want to check :
    - Disable IIS Service: World Wide Web Publishing
    - Disable BranchCache Service
    - SQL Server 2008 R2, turn of the Error Reporting Feature
  7. If the PID mentioned earlier was 4, as the last resort you might want to do the following
    - Open Device Manager
    - View » Show hidden devices
    - Under the tree-view, Expand Non - Plug and Play Drivers
    - Search for HTTP and then disable it
    - Do a reboot
    **If you have trouble with printer spooling after this steps, you might want to change the default port by modifying the httpd.conf file and change the port 80 to something more unique to yourself , but after you change the port, say for example port 98 you need to access the local site using this : "http://localhost:98"
Update:
another way to try which one is using the port 80, use telnet
  1. If telnet client is not installed, install it by opening cmd prompt and then run it as administrator then type "optionalfeatures" without the quotes, and then find telnet client and then install it.
  2. Run telnet 
  3. open host: o 127.0.0.1 80
  4. type : GET
  5. read the information there

Good luck All!! :)

Selasa, 26 Juni 2012

Some Library to ease your web-app development

I read some website, and i think i'm going to make my own note here, hope someone or someday we will find this usefull. This is a list of 'commonly' used javascript library when developing business application
  1. jQuery
    Yep.. the famous jQuery.. hhe
  2. jQuery treeTable plugin
    A plugin which will render a tree-like table, table rows which have child for them.. that's a tree-table
  3. jQuery contextMenu
    Just do a "right click", and there you have it, a customized contextMenu for your web app
  4. BeutyTips
    The name says it all.. i guess..
  5. Editable and AutoComplete
    Editable : any area of your web page is editable by clicking them. AutoComplete : FB/twitter like auto complete when you tag your friend
  6. Color Picker
  7. jQuery numberFormatter
    Entering the edit box makes the number goes normal, and leaving the edit box makes the number pretty.. 60000 => 60,000
  8. iScroll
    IOS like scrolling? hmm eye candy..
  9. Mustache
    Template-ing by using Javascript
  10. Quicksand
    Another eye candy.. i think iOS made some revolution here!! Shuffling ordering the divs!
  11. JQGRID
    Yep.. the mighty grid we all see everyday on our business application
  12. Hotkeys
    If you are here.. you should press cntrl-d (bookmark cubei pleaseee.. hhe)
  13. jsTree
  14. Raphael
    Small but powerful library to help you working with your vector drawings
  15. gRaphael
    do you need some chart? :)
That's it guys.. now go and invent an app! :D
c ya and God Bless!

Sabtu, 09 Juni 2012

KPR Bank Jabar :)

Tanggal 8 Juni 2012 merupakan tanggal akad kredit saya di Bank JABAR :) saya sungguh bersyukur karena 1 dari 3 dari target janji saya(Atap, Kendaraan, Tabungan) bisa saya penuhi buat keluarga saya.. hoho..

Nah, yang menjadi kejutan untuk saya adalah perhitungan bunga (walaupun sy tahu bahwa perhitungan bunga "floating" merupakan salah satu perhitungan yang cukup 'mengerikan') karena di tahun ke-2 cicilan KPR saya adalah (mungkin) sebesar 13.5%, dan lonjakan kredit bulanan menjadi agak sedikit 'lumayan besar' oleh karena itu, saya membuat sebuah excell spereadsheet yang mungkin bisa membantu rekan-rekan sekalian yang ingin menghitung  cicilan KPR rekan (dikhususkan untuk bank JABAR)

Download file excell untuk menghitung KPR Bank Jabar - Prime Lending Rate (metode anuitas bulanan) bersangkutan, rekan-rekan bisa mendownload dari link berikut ini :


Semoga bermanfaat :D

Kamis, 29 Maret 2012

Win7: Virus cause the folders to be hidden

Yep, a virus attacked my USB drive, it hide the folders, and replace them to a link which execute the naughty virus, using AV program, i manage to clean the virus, now the problem would be removing hidden attribute on the hidden folder..

I manage to enter the hidden folder using the path, but right-clicking and entering the properties doesn't allow me to change the hidden attribute for the folder

Fortunately, i come across this post here is a step by step guide :

  1. Open your command prompt, enter your path, as for my case it's H:
  2. run the command "attrib /s /d -r -s -h" without the double quotes
  3. wait for it..
A little explanation from the original author :
  • /s apply the command to all files
  • /d apply the command to all folders
  • -h will clear the hidden attribute
  • -s will clear the system file attribute
  • -r will clear the read only attribute
Hope this helps someone ;)

Rabu, 28 Maret 2012

c++: Boost "Bind" and "Functions" snippet

This is a personal note on using the boost library, since i come from a Delphi background, been trying to figure out the callback method which is simple to use in c++.. and then i come across useful boost library functions.. well the code should tell you more.. so here is the snippet :
//Using bind with Boost.Function
class button
{
public:

    boost::function onClick;
};

class player
{
public:

    void play();
    void stop();
};

button playButton, stopButton;
player thePlayer;

void connect()
{
    playButton.onClick = boost::bind(&player::play, &thePlayer);
    stopButton.onClick = boost::bind(&player::stop, &thePlayer);
}

pretty neat doesn't it? :)

Selasa, 27 Maret 2012

3d: Rotations, Axes, Local Space, Parent Space, World Space

The biggest factor i need to overcome with 3d programming was the math-side of 3d programming, there are many terms, such as vector, matrix, gimbals, local space, world space, projections, quaternions, euclidean, eulers etc.. We need to understand those terms so that i could position my objects correctly

If you are like me, you will be thrilled to read this page : opengl transforms, great article, made me understand the concept of local space and the world space

If you work with 3dsmax, blender, autocad, lightwave, etc you will likely works with axes, you use this axes to translate, rotate, scale your models, even per-element base(vertices, faces, polygons, edges).

There is a concept which helps me a lot to program transformation, and that is the local axes, the forward, up, and left axes which is locally for our object. If you put your matrix data using OpenGL conventions (column major) and you save your transformation to your object, then the elements :

  • local-x (default 1,0,0) would be (m0, m1, m2) 
  • local-y (default 0,1,0) would be (m4, m5, m6)
  • local-z (default 0,0,1) would be (m8, m9, m10)
  • and your object translation would be (m12, m13, m14)

But remember this matrix represents your modelview (that is your model matrix * view matrix)
okayh, now, what is this model matrix, and view matrix?

Rabu, 21 Maret 2012

Cygwin Note: Accessing your local drive

cygwin is a project where you will feel the linux-like environment, you could compile using makefiles using the command make..

This is a note to my self, to access your drive, type cd cygdrive/e/...
nice..

Minggu, 18 Maret 2012

ProtonSDK: Having trouble with the 2d coordinates?

Err.. this post would be some kind of my own personal notes..

I had trouble tracking the TouchHandler component, there's something that i could not understand, why does when we setup the screen to become 320(width) * 420(height) - in pixels, when i click on the bottom of the screen, the point interpreted by TouchHandler component is larger than 420..

Tracking through the source code, i found that we should be cautious when choosing the video mode, locked landscape, setup fake screen procedures

You could trace that problem on file "RenderUtils.cpp" the procedure "ConvertCoordinatesIfRequired" .. this would be a good place for your breakpoints :)

You haven't tried ProtonSDK? developed by Seth. A. Robinson - www.protonsdk.com try them! they are free and powerful!

If you stumbled across problems, there is the IRC channel, and the forum.. the creator (Seth) actively maintains and answer your question..

Kudos to you Seth! ;)

Owkayh.. untill next time

Senin, 12 Maret 2012

Exporting Blender file(Collada) for Irrlicht

I'm using the built-in Collada exporter for the time being, and i have never face any trouble of doing so

For those of you who are like me, which is a beginner to blender, this guide might help you a bit :)
  1. When you export a model and load it from your Irrlicht Project, but it did not show the dimension (width, height, length bounding box aabb) which you designed, go back to blender, try to open up the transform panel (using the n key on your blender's 3d view), check if you have a rotation / scale which is applied at the object level? if yes,press ctrl+a and apply those transformation
  2. Dunno if i'm doing this right, but to compose your scene, you need to benchmark / do a repeat trial to compose(positioning, scaling, targeting) your scene, your camera, etc 
  3. You need to assign material(s) and texture(s) if you need to colorize / make something out of that 'clay' look.. 
There is this one thread which gives a good general guideline exporting your 3d model to irrlicht.. i think i had it..

ah yes, here it is :

**** Source : Irrlicht Forum

posted by Mel :

Basically, whatever you export from 3DSMAX (it may be extended to other software as well):
  • It should be either an editable mesh or editable poly without modifiers. You should collapse the stack of modifiers. At most, the only modifier supported is the skin modifier, for skinned objects. 
  • It should be a single object, as it will be loaded as a single object by the engine. For instance, the wheels and the body of a car should be 2 different exported objects. 
  • place the object, so its pivot is on the origin of coordinates. Again, to export a wheel correctly, it should have the origin of coordinates at the center. 
  • Use at most 2 channels of UVW mapping coordinates, and make sure that the exporter will write both correctly. For this is good that you understand how to use the unwrap uvw modifier. And for most models, use just one channel of mapping coordinates, The usage of 2 channels is more for the stage models. 
  • Vertex colors are supported by irrlicht, and they help a lot, learn how to use the vertex paint utilities. -Use square textures with power of 2 resolutions, or at least, textures whose dimensions are power of 2. (1024x1024, 512x1024, 64x256...) 
  • Use the least material ID's posible, those translate almost directly into meshbuffers, you want to have the least meshbuffers posible. -
  • Skinned objects are supported, Use Skin instead of Physique, not that physique won't work, but the Skin modifier behaves closer to what Irrlicht does. And export just a single skinned mesh. Irrlicht only supports displacement mapping via geometry shaders, and those are only supported in Open GL,discard the modifier or collapse the mesh, and export the high resolution object. 
And that more or less, sums up all the precautions you should take when exporting models from max or other packages.

********** Ent of Message *********

Hmm.. do i need to add something more.. i will post when found something useful hehehe that's a promise.. i guess.. Err... i wanted to make a game, yet i stumbled learning things, let's enjoy the ride shall we?

Jumat, 24 Februari 2012

Bermain dengan Irrlicht 1.71, Blender 2.6x = Game 3D

Akhirnya, sya mulai merujuk pada game 3d, setidaknya mulai untuk bermain-main dengan coding 3d.
  1. Sebagai engine playground saya, saya memilih irrlicht 1.71 
  2. Untuk mengenal tentang transformasi, maupun pergerakan dalam dunia 3d, saya memilih menggunakan Blender 2.62 sebab kebenaran.. tutorial yang banyak saya temukan adalah tutorial untuk blender.. dan ada satu proyek add-on "irrb 0.6" yang bisa meng-export dari blender ke file "irr"
Beberapa istilah :
  • Irr merupakan file yang berisi layouting dari object-object untuk game yang kita rancang
  • Irrmesh merupakan file xml berbentuk text yang mendefinisikan suatu benda (mesh, cube, sphere, dst)
  • Irrbmesh, sama dengan irrmesh, hanya bentuknya adalah binary, menurut sang pembuat library ini, loading time irrbmesh dibanding dengan yang lain adalah yang paling cepat.. konon katanya demikian :)
Ok, untuk post ke depan, mungkin saya akan mulai posting tentang game programming (yep, my passion..) untuk bisa game programming ada baiknya kita menguasai dulu editor 3d, setidaknya menguasai basic dari editor yang kita pilih, untuk mengenal apa itu vertex, vertices, cull, depth of field, face, edge, concave, polygon, normals, vectors, global coordinate, local coordinate, physics, soft body, rigid, static, dand seterusnya.. untungnya mas brow.. :) ini semua bisa kita temukan di software tangguh nan open-source bernama blender, dan blender yang saya gunakan adalah versi 2.62 dan sesuatu yang bisa di kagumi, renderer engine codename : cycles (bila dipergunakan dengan baik dan benar) akan memberikan suatu hasil yang fantastis gituu.. reality..

Dibawah ini adalah skill2 dasar yang saya kejar sebagai arsenal untuk 3d game programming