It's summer time : let's code !
2013-08-18 18:42:49
Starting my new raytracer project, POV, Maya, 3D Studio Max, here I come !



http://www.nicolasmy.com/projects/65-Let's-code-a-raytracer-in-C
Droping an entire Oracle tablespace
2013-02-15 10:32:23
How to remove the entire content of an Oracle Database ?

Run this sequence :
 
select 'drop table ' || table_name || ' cascade constraints;' from user_tables;
select 'drop materialized view ' || table_name || ' ;' from user_tables;
select 'drop sequence ' || sequence_name || ' ;' from user_sequences;
select 'drop package ' || object_name || ';' from user_objects where object_type='PACKAGE';
 


Copy paste the result set and run it (ignoring all errors).
Getting started with Sd3d
2012-12-18 23:00:55
Sd3d is a simple library to use aiming at achieving 3D graphics with very few lines of code.

1. Start a new Android project, let say a simple Activity project.

2. Add Sd3d as a project library.

3. In the activity class file, replace the generated onCreate by the following code.
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
Sd3dRessourceManager.init(this);
 
if (GameHolder.mGame == null)
{
    GameHolder.mGame = new Sd3dGame();
    GameHolder.mGame.init(this);
}
        setContentView(R.layout.activity);
 
Sd3dGLSurfaceView mGLSurfaceView =
(Sd3dGLSurfaceView) findViewById(R.id.glsurfaceview);
 
 
mGLSurfaceView.setRendererGame(GameHolder.mGame.mRenderer, GameHolder.mGame);
 
 
GameHolder.mGame.setMGLSurfaceView(mGLSurfaceView);        
}
 

Ok the code is a bit ugly and not self explanatory but it'll do the job of initializing the project.

4. Edit the generated layout file in the "layout/" directory.
It should be something like that :
 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
 
<org.nicolasmy.sd3d.Sd3dGLSurfaceView android:id="@+id/glsurfaceview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
 
</RelativeLayout>
 


5. Copy the "config/" and "shaders/" directory that are in the "assets" directory of the sd3d project to the assets directory in your project directory.

VoilĂ  ! your application is ready to run, showing something like a black screen (not of death hopefully).
Chessmind3D to make it to Amazon App Store
2012-12-16 23:02:46


While releasing Chessmind 3D 1.8, I am trying to get thisversion to Amazon Appstore. Kindle Fire and Kindle Fire HD are a high percentage of Android Tablets market share that I can't miss.

I am taking quite a chance since I absolutely don't know whether it runs properly on any Kindle devices. Let's hope Amazon approval process isn't too restrictive.
Visual Studio Express : install shield color theme
2012-12-14 23:22:34
I've just installed Visual Studio Express 2012 on Windows 7 recently and I noticed that the install shield color theme : dark grey and blue, looks just like Android ICS theme, and...like the color theme of this site.

Chessmind3D version 1.7
2012-12-12 23:06:32
Major improvements in this version :
- Game setup !!! Ability to switch each side as human or cpu
- Pieces animation !!!!
- Textured board because it looks better !
- OpenGL ES 2.0 renderer although there's no visual differences albeit more controlled lighting!

Sadly picking is broken on my Galaxy S so I've decided to limit the new version to tablets at the moment.
I might try to push this version to Amazon App Market.

https://play.google.com/store/apps/details?id=org.nicolasmy.chessmind3d
BeanViewBuilder a tool for lazy Android programmer (like me !)
2012-12-08 17:00:49
Few months ago, I had to code a function that would count the number of field filled by the user. Trouble is they where about 30 fields and that fields changed on daily basis. I work this out by using reflection to count fields in very few line of code.

One of the great Java feature that shine above C++ is reflection.

It allows a very nice flexibility (for instance Spring use it to instantiate class from XML configuration without knowledge of the used class).

In Android building button, textview and listenerfor each end every possible action is a pain, especially when we are only accessing bean setters/getters. Thanks to reflection it is possible automatically create a control panel from a bean.

 
package com.innovativesoftware.menufactory;
 
import android.util.Log;
 
public class BattleStarBean {
    String music;
    int number = 1;
    float position[] = new float[3];
    boolean cheched;
    boolean ftlReady = true;
    public boolean isFtlReady() {
        return ftlReady;
    }
 
    public void setFtlReady(boolean ftlReady) {
        this.ftlReady = ftlReady;
    }
 
    public BattleStarBean() {
        music = "It's in the frakking ship !";
    }
 
    public String getMusic() {
        return music;
    }
 
    public void setMusic(String s) {
        Log.d("MonBean","setIts "+s);
        music = s;
    }
 
    public int getNumber() {
        return number;
    }
 
    public void setNumber(int value) {
        number = value;
    }
 
    public float[] getPosition() {
        return position;
    }
 
    public boolean isCheched() {
        return cheched;
    }
 
    public void setCheched(boolean cheched) {
        this.cheched = cheched;
    }
 
}
 


Then using BeanViewBuilder class will give you this menu :

No code needed, the change are automatically applied to the backing bean (but not the other way....)
Roboguice : dependency injection in Android
2012-12-01 18:44:00
Expressing the maximum amount of concept with the minimal amount of hand-written code while retaining code safety and non-ambiguity has always been a major goal in programming language design.

Dependecy injection takes a part in this goal by removing code instantiation from execution and relocating it in contained area. That would be xml configuration files for Spring and Java annotations for Guice.

Spring is quite heavy weight so not very mobile device friendly but Roboguice (http://code.google.com/p/roboguice/) which is Guice for Android offers an interesting solution :

The following code:
 
class AndroidWay extends Activity {
TextView name;
ImageView thumbnail;
LocationManager loc;
Drawable icon;
String myName;
 
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
name = (TextView) findViewById(R.id.name);
thumbnail = (ImageView) findViewById(R.id.thumbnail);
loc = (LocationManager) getSystemService(Activity.LOCATION_SERVICE);
icon = getResources().getDrawable(R.drawable.icon);
myName = getString(R.string.app_name);
name.setText( "Hello, " + myName );
}
}
 



Is replaced by:
 
class RoboWay extends RoboActivity {
@InjectView(R.id.name) TextView name;
@InjectView(R.id.thumbnail) ImageView thumbnail;
@InjectResource(R.drawable.icon) Drawable icon;
@InjectResource(R.string.app_name) String myName;
@Inject LocationManager loc;
 
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
name.setText( "Hello, " + myName );
}
}
 
Nicuga an open source shmup engine
2012-11-15 00:23:59


If Ikaruga mean something to you, then this could be worthy of attention. Libbulletml was kind of an unfinished business since no shoot'em up ever used this library (except on forgotten part of my hard-drive), so I just started a shmup engine from scratch, ultimately aiming at Android and IOS but now runnign on Windows...

This engine relies heavily on xml for configuration. I think it can be the starting point of a stripped down shump : very basic graphics, bullet everywhere, challenging.

Anyway, this project is open source and available here:
https://github.com/kobr4/Nicuga/
#pragma once vs include guards
2012-10-30 14:21:40
Sometime by using new tools, you'll learn new things about programming even on some very basic principles.

I started using Visual C++ in Visual Studio 2010 a few weeks ago and noticed that on adding new class header, Visual Studio would generate the processor directive "#pragma once" instead of the good old traditionnal header guards :
 
#ifndef MYCLASS_H
#define MYCLASS_H
 
class MyClass
{
};
 
#endif
 


Is replaced by a plain and simple :
 
#pragma once
 
class MyClass
{
};
 

This is so much simpler and less error-prone(forgot the #endif, anyone ?) ! Actually this directive is not part of the C++ standard but well supported by Visual Studio and GCC, which is what matters the most for me.
See 10 older news | Back to the top