Wednesday, June 06, 2012

Change Language of an Entire PPT presentation

Here goes the macro code where you can convert the language of PPT presentation into UK English. I found this code from here.

Sub LangInFrames()
scount = ActivePresentation.Slides.Count
For j = 1 To scount
fcount = ActivePresentation.Slides(j).Shapes.Count
For k = 1 To fcount
If ActivePresentation.Slides(j).Shapes(k).HasTextFrame Then
ActivePresentation.Slides(j).Shapes(k).TextFrame.TextRange _
.LanguageID = msoLanguageIDEnglishUK
End If
Next k
Next j
End Sub

Wednesday, March 14, 2012

How to create your Database in an accessible folder in Android

When you run your codes in Android, you really cant access the DB files created automatically inside Android. So here is how to save it on your SDcard.

Override the following method in your activity class.
 public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory){
  File externalFilesDir = Environment.getExternalStorageDirectory();
   if(externalFilesDir == null) 
          return null;
   File dbFile = new File(externalFilesDir, DBConstant.DATABASE_NAME);
   return SQLiteDatabase.openDatabase(dbFile.getAbsolutePath(), null, SQLiteDatabase.CREATE_IF_NECESSARY);

Now you are good to go. I used SQLiteOpenHelper to manage my insertion of data. What i did can found below. You change it for your use.

public class MyDataHelper extends SQLiteOpenHelper{
 private static final String DATABASE_NAME = "events.db" ;
 private static final int DATABASE_VERSION = 1;
 /** Create a helper object for the Events database */
 public DBgpsDataHelper(Context ctx) {
 public void onCreate(SQLiteDatabase db) {
  db.execSQL("CREATE TABLE " + TABLE_NAME + " (" + 
    TIME + " INTEGER, " + ");

 public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  // TODO Auto-generated method stub