Archive for November, 2007

FileBrowser v0.3

fb-v03.pngfilebrowser-v03.tgz

Update, added Icons and Regular Expression matching of files. It takes a long time, due to Internet download of Icons.

No Comments

FileBrowser v0.2

Update now directories in bold and regular files normal font. Found a bug, when “cd forbidden_dir” cannot go back due to “cd forbidden_dir/..” cannot work have to fix this stupid thing. Added another class see attached archive. filebrowser.tgz

No Comments

Basic List

This is a basic List with menu and selector. TODO Add, switch to Help frame.

package fr.boucaron;

import java.util.ArrayList;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MyAdapterList extends BaseAdapter {
protected ArrayList<String> mArrayList;
protected Context mContext;
//MINE
public void add(String t) { mArrayList.add(t); }
public void remove(int position) { mArrayList.remove(position); }
public String get(int position) { return mArrayList.get(position); }

//TO DEFINE
public int getCount() {
return mArrayList.size();
}

public Object getItem(int position) {
return position;
}

public long getItemId(int position) {
return position;
}

public MyAdapterList(Context c) {
mContext = c;
mArrayList = new ArrayList<String>();
}

public View getView(int position, View convertView, ViewGroup parent) {
TextView t = new TextView(mContext);
t.setText(mArrayList.get(position));
return t;

}
}
package fr.boucaron;

import java.util.ArrayList;
import java.util.List;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.view.Menu.Item;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ActivityMyViewGroup extends ListActivity {

MyAdapterList myList;
int currentPosition;

public void initMyList() {
myList.add(“Abbaye de Belloc”); myList.add(“Abbaye du Mont des Cats”);
myList.add(“Abertam”); myList.add(“Abondance”);
myList.add(“Ackawi”); myList.add(“Acorn”);
myList.add(“Adelost”); myList.add(“Affidelice au Chablis”);
myList.add(“Afuega’l Pitu”); myList.add(“Airag”);
myList.add(“Airedale”); myList.add(“Aisy Cendre”);
myList.add(“Allgauer Emmentaler”); myList.add(“Alverca”);
myList.add(“Ambert”); myList.add(“American Cheese”);
}

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
super.setTitle(“MyViewGroup”);
myList = new MyAdapterList(this);
this.initMyList();
// this.setListAdapter(new ArrayAdapter<String>(this,
// android.R.layout.simple_list_item_1, myList));
this.setListAdapter(myList);
}

public boolean onKeyDown(int keyCode, KeyEvent event)
{
this.currentPosition = this.getSelection();
if ( keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
super.setTitle(“LEFT”);
return true;
}
else if ( keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
super.setTitle(“RIGHT”);
super.setTitle(“Selected ” + myList.get(this.getSelection()));
return true;
}
else if ( keyCode == KeyEvent.KEYCODE_BACK) {
super.setTitle(“BACK”);
return true;
}
else if ( keyCode == KeyEvent.KEYCODE_CALL) {
super.setTitle(“CALL”);
return true;
}
return false;
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
boolean result = super.onCreateOptionsMenu(menu);
menu.add(0, 0, “Find associations”);
menu.add(0, 1, “Remove this”);
menu.add(0, 2, “Help”);
menu.add(0, 3, “Add”);
return result;
}

@Override
public boolean onOptionsItemSelected(Item item) {
switch (item.getId()) {
case 0: //Find associations
super.setTitle(“Menu: Find association” + this.currentPosition);
break;
case 1: //Remove this
super.setTitle(“Menu: Remove this” + this.currentPosition);
myList.remove(this.currentPosition);
myList.notifyChange();
break;
case 2: //Help
super.setTitle(“Menu: Help”);
break;
case 3: //Add
super.setTitle(“Menu: Add” + this.currentPosition);
break;
default:
super.setTitle(“Menu: ” + item.getId() + ” ” + item.getTitle());
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id)
{
super.setTitle(“onListItemClick” + this.myList.get(position));
}

}

No Comments

Tonio’s code for creating db on android stuff

package marvin.pack;

import android.app.Activity;

public class marvin2 extends Activity
{
protected void onCreate(Bundle icicle)
{
super.onCreate(icicle);
//setContentView(new GLView(getApplication()));
setContentView(R.layout.main);
TextView tv = (TextView) findViewById(R.id.text);
try
{
SQLiteDatabase db = createDatabase(“test”, 1, MODE_PRIVATE, null);
db.execSQL(“CREATE TABLE IF NOT EXISTS table1 (champ1 INTEGER)”);
SQLiteCursor cursor = (SQLiteCursor) db.query(“SELECT * FROM sqlite_master”, null);

String test = “Structure :\n”;
for(int i = 0 ; i < cursor.getColumnNames().length ; ++i)
{
test += cursor.getColumnNames()[i] + ” ; “;
}
test += “\n”;
while(cursor.next())
{
for( int i = 0 ; i < cursor.getColumnNames().length ; ++i)
{
test += cursor.getString(i) + ” ; “;
}
test += “\n”;
}

tv.setText(test);

db.close();
}
catch(Exception e) {tv.setText(e.toString());}
}

protected void onResume()
{
super.onResume();
}

protected void onStop()
{
super.onStop();
}
}

No Comments

Marked Graph, Synchronous Data Flow (SDF) simulation library [TBB] v0.1

I wrote a simple library to simulate quickly Marked Graph, Synchronous Data Flow (under ASAP firing rule) in C++ while also having some fun with Intel’s Threading Building Blocks library to check how it works.

I enjoy very much this raising of abstraction for threads, however, my parallel code performs not well (too thin grain) but I did not build too big examples, and not enough testing. Nevertheless, this small code is memory-leak free and very fast. Moreover, it is also “data race” free, I will explain quickly the sketch of the algorithm and its threaded variations.

Basic sequential algorithm:

  1. Mark all nodes that can fire.
  2. Fire those nodes.
    • Update input arcs
    • Update output arcs
  3. Unmark all nodes.

Where there is parallelism here ?

  1. Mark all nodes that can fire.
    • Data parallelism, we can check each node in parallel
  2. Fire those nodes. Data parallelism, we can fire each node in parallel
    • Update input arcs
      • Data parallelism, we can do this for each node in parallel
    • Update output arcs
      • Data parallelism, we can do this for each node in parallel
  3. Unmark all nodes.
    • Data parallelism, we can do this for each node in parallel

The green one, is useful when there is a lot of nodes. The red one, when a node is having a lot of arcs (not really helpful in general, in my case).

Code source is available here and release under LGPL: http://julien.boucaron.free.fr/download/ (check tbb_simu*.tgz)

There is different Makefiles (.Java building JNI Wrapper using SWIG; .graph just build JNI Wrapper for my dummy graph lib)

There is also a JNI wrapper made with SWIG, which works has long has you do not call too much “get” method in vector*.java; each time there is a “get” there is a call to the constructor… (be careful, it does not scale). I will fix this when I will have enough time.

No Comments

Shelley on sourceforge !

Have a look on http://sourceforge.net/projects/shelley/

No Comments

Xemacs config file

Here is my configuration for Xemacs borrowed from another website (I forgot…) and done some minor modifications.
The configuration is there: http://julien.boucaron.free.fr/xemacs/

Here is a screenshot

No Comments

Jujump3

This is a simple player using FLTK and SDL_mixer. I developped this as a self tutorial to learn a little bit more about FLTK. There is a simple playlist management, a simple controller and a lot of work to have more features.

Have a look to the source there: http://julien.boucaron.free.fr/jujump3/

Here is a screenshot

No Comments

Linux Kernels for Titanium 2

Kernel 2.4.19 and Modules Binaries 2.4.19 : (works pretty well but lost the config)
RadeonFB, ADB, Airport, Firewire, IDE-SCSI , Sound, USB, PCMCIA, IRDA, Suspend.
Supported FS: ext2-3, reiserfs,hfs,nfs,ufs,udf,msdos,vfat,iso9660…etc…

X11 Xorg conf
Kernel 2.6.11.7 Configuration Same as 2.4.19, Apple agp_gart, hfs+ …etc…

Here is the 2.6.20 kernel for Ubuntu Feisty and Ubuntu Gutsy with config, debian package.

http://julien.boucaron.free.fr/apple_titanium/

No Comments

Magic Package

There is a preliminary package for Ubuntu, for Magic a VLSI layout tool. See there http://julien.boucaron.free.fr/magic/.

No Comments