HTTPS github access (repo with Curl)
Source: http://stackoverflow.com/questions/3777075/https-github-access
[Problem]
HTTPS github access (repo with Curl)
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:
[Summary] (i chose the way)
just set an environment variable to disable SSL verify.
$ export GIT_SSL_NO_VERIFY=true
that's it.
-----
Cheers,
June
월요일, 12월 05, 2011
금요일, 11월 25, 2011
x86 kernel build chain - how bzImage gets created
x86 kernel build chain - how bzImage gets created
Source: http://lists.kernelnewbies.org/pipermail/kernelnewbies/2011-November/003906.html
Graeme Russ graeme.russ at gmail.com
Tue Nov 22 05:46:31 EST 2011
-----
Cheers,
June
Source: http://lists.kernelnewbies.org/pipermail/kernelnewbies/2011-November/003906.html
Graeme Russ graeme.russ at gmail.com
Tue Nov 22 05:46:31 EST 2011
- Previous message: busybox utility
- Next message: x86 kernel build chain - how bzImage gets created
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi All, Hopefully this will help demystify the build process Notation:( ) | + | * | \->
-----
Cheers,
June
화요일, 10월 18, 2011
[CV] Cool tech demo: match 3D models into archive photos
Cool tech demo: match 3D models into archive photos
Source: http://www.cgchannel.com/2011/10/cool-tech-demo-match-3d-models-into-archive-photos/
Rendering Synthetic Objects into Legacy Photographs from Kevin Karsch on Vimeo.
Author:
Kevin Karsch
PhD Student, UIUC
karsch1 [at] uiuc [dot] edu
Source: http://kevinkarsch.com/publications/sa11.html
-----
wow, this is the best ever!!!
Cheers,
June
Source: http://www.cgchannel.com/2011/10/cool-tech-demo-match-3d-models-into-archive-photos/
Rendering Synthetic Objects into Legacy Photographs from Kevin Karsch on Vimeo.
Author:
Kevin Karsch
PhD Student, UIUC
karsch1 [at] uiuc [dot] edu
Source: http://kevinkarsch.com/publications/sa11.html
-----
wow, this is the best ever!!!
Cheers,
June
일요일, 5월 08, 2011
[CV] Cheap Motion Capture System (OpenCV Motion Capture)
Cheap Motion Capture System (OpenCV Motion Capture)
Source: http://www.motioncapturedata.com/2009/06/cheap-motion-capture-with-free-software.html
Project Home (Cheap Motion Capture System)
http://motion.capture.free.fr/
-----
Cheers,
June
Source: http://www.motioncapturedata.com/2009/06/cheap-motion-capture-with-free-software.html
Project Home (Cheap Motion Capture System)
http://motion.capture.free.fr/
-----
Cheers,
June
수요일, 10월 27, 2010
[Android] My Tip; RemoteService Example
RemoteService Example
Reference Source:
http://developer.android.com/guide/developing/tools/aidl.html
http://developer.android.com/reference/android/app/Service.html
http://www.androidpub.com/102370
// -----------------------------------------------
// more Activity
// AndroidManifest.xml
// -----------------------------------------------
<activity android:name=".MainActivity"
android:label="MainActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".anotherActivity"
android:label="anotherActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
// -----------------------------------------------
// RemoteService
// AndroidManifest.xml
// -----------------------------------------------
<service android:enabled="true" android:name=".testActivity">
</service>
// -----------------------------------------------
// RemoteService
// AndroidManifest.xml
// -----------------------------------------------
// -----------------------------------------------
// RemoteService
// Service.java
// -----------------------------------------------
package com.test.testActivity;
// Service
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteCallbackList;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.MediaController;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
/*
@Activity A (test)
startService( new Intent(test.testActivity, testService.class).putExtra("tag", "data") );
String[] strList = {
{"strList1"},
{"strList2"}
};
startService( new Intent(test.testActivity, testService.class).putExtra("tag2", strlist) );
@Service B (testService)
Bundle extras = getIntent().getExtras();
String[] strList = extras.getStringArray( "strlist" );
*/
public class testService extends Service {
private String TAG = "testService";
// Service
private NotificationManager mNM;
private Intent m_InvokeIntent;
private volatile Looper m_ServiceLooper;
private volatile ServiceHandler m_ServiceHandler;
public String m_Str = null;
final RemoteCallbackList m_Callbacks
= new RemoteCallbackList();
private final class ServiceHandler extends Handler {
public ServiceHandler(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
Bundle extras = (Bundle)msg.obj;
String strTagValue = null;
/*
{
// Broadcast
strTagValue = extras.getString( "command" );
if( strTagValue != null ) {
if( strTagValue.equals("pause") ) {
stopSelf( msg.arg1 );
return;
}
else if( strTagValue.equals("stop") ) {
stopSelf( msg.arg1 );
return;
}
}
}
*/
strTagValue = null;
strTagValue = extras.getString( "tag" );
Log.d( TAG, "Message: " + msg + ", tagValue = " + strTagValue );
if( strTagValue != null ) {
if( strTagValue.equals("data") ) {
}
else if( strTagValue.equals("strlist") ) {
m_strPlayList = extras.getStringArray( "strlist" );
}
else {
Log.d( TAG, "QUIT" );
stopSelf( msg.arg1 );
return;
}
}
else {
stopSelf( msg.arg1 );
return;
}
}
};
@Override
public void onCreate() {
mNM = (NotificationManager)getSystemService( NOTIFICATION_SERVICE );
HandlerThread thread = new HandlerThread( "MediaServiceStart" );
thread.start();
m_ServiceLooper = thread.getLooper();
m_ServiceHandler = new ServiceHandler( m_ServiceLooper );
}
@Override
public void onStart(Intent intent, int startId) {
Log.d( TAG, "ServiceStartArguments: Starting #" + startId + ": " + intent.getExtras() );
{
Message msg = m_ServiceHandler.obtainMessage();
msg.arg1 = startId;
msg.obj = intent.getExtras();
m_ServiceHandler.sendMessage( msg );
Log.d( TAG, "ServiceStartArguments: Sending: " + msg );
// Test: Broadcast
/*
final int n = m_Callbacks.beginBroadcast();
Log.d( TAG, "n = " + n );
for( int i = 0; i < n; i++ )
Log.d( TAG, "item = " + m_Callbacks.getBroadcastItem(i) );
m_Callbacks.finishBroadcast();
*/
}
}
@Override
public void onDestroy() {
m_ServiceLooper.quit();
}
@Override
public IBinder onBind(Intent intent) {
return m_Binder;
}
// The IRemoteInterface is defined through IDL
private final IRemoteService.Stub m_Binder = new IRemoteService.Stub() {
public void registerCallback(IRemoteServiceCallback cb) {
if (cb != null) m_Callbacks.register(cb);
}
public void unregisterCallback(IRemoteServiceCallback cb) {
if (cb != null) m_Callbacks.unregister(cb);
}
public String getInfo() {
String str = "i'm service";
return str;
}
public String setInfo(String str) {
Log.d( TAG, "RECEIVED From Activity: " + str );
return str;
}
};
}
// -----------------------------------------------
// testActivity.java
// -----------------------------------------------
// Service
import android.content.ServiceConnection;
import android.content.ComponentName;
import android.os.IBinder;
import android.os.RemoteException;
public class testActivity extends Activity implements {
// Service
private IRemoteService m_Service = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
//Intent(testActivity.this, testService.class)
//Intent intt = new Intent( testActivity.this, Activity2.class );
//startActivity( intt );
//bindService( new Intent(testService.class.getName()), m_Connection, Context.BIND_AUTO_CREATE );
bindService( new Intent(testActivity.this, testService.class), m_Connection, Context.BIND_AUTO_CREATE );
startService( new Intent(testActivity.this, testService.class).putExtra("tag", "quit") );
/*
if( m_Service != null ) {
try {
m_Service.unregisterCallback( m_Callback );
} catch (RemoteException e) {
}
}
// Detach our existing connection.
unbindService( m_Connection );
stopService( new Intent(testActivity.this, testService.class) );
*/
}
@Override
protected void onDestroy() {
if( m_Service != null ) {
try {
m_Service.unregisterCallback( m_Callback );
} catch (RemoteException e) {
}
}
if( m_Connection != null ) {
// Detach our existing connection.
unbindService( m_Connection );
}
stopService( new Intent(testActivity.this, testService.class) );
super.onDestroy();
}
// Service
private ServiceConnection m_Connection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
m_Service = IRemoteService.Stub.asInterface(service);
try {
m_Service.registerCallback(m_Callback);
Log.d( TAG, "RECEIVED From Service: " + m_Service.getInfo() );
m_Service.setInfo( "i'm activity" );
} catch (RemoteException e) {
}
Toast.makeText( testActivity.this, "Service Connected", Toast.LENGTH_SHORT ).show();
}
public void onServiceDisconnected(ComponentName className) {
m_Service = null;
Toast.makeText( testActivity.this, "Service Disconnected", Toast.LENGTH_SHORT ).show();
}
};
// This implementation is used to receive callbacks from the remote service.
private IRemoteServiceCallback m_Callback = new IRemoteServiceCallback.Stub() {
public void valueChanged(int value) {
//mHandler.sendMessage(mHandler.obtainMessage(BUMP_MSG, value, 0));
}
};
}
// -----------------------------------------------
// IRemoteService.aidl (default + method)
// Source (v1.6): C:/android-sdk-windows/platforms/android-4/samples/ApiDemos/src/com/example/android/apis/app
// -----------------------------------------------
package com.test.testActivity;
import com.test.testActivity.IRemoteServiceCallback;
interface IRemoteService {
void registerCallback(IRemoteServiceCallback cb);
void unregisterCallback(IRemoteServiceCallback cb);
// ADD
String getInfo();
String setInfo(String str);
}
// -----------------------------------------------
// IRemoteServiceCallback.aidl (default)
// Source (v1.6): C:/android-sdk-windows/platforms/android-4/samples/ApiDemos/src/com/example/android/apis/app
// -----------------------------------------------
default
-----
Cheers,
June
Reference Source:
http://developer.android.com/guide/developing/tools/aidl.html
http://developer.android.com/reference/android/app/Service.html
http://www.androidpub.com/102370
// -----------------------------------------------
// more Activity
// AndroidManifest.xml
// -----------------------------------------------
<activity android:name=".MainActivity"
android:label="MainActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".anotherActivity"
android:label="anotherActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
// -----------------------------------------------
// RemoteService
// AndroidManifest.xml
// -----------------------------------------------
<service android:enabled="true" android:name=".testActivity">
</service>
// -----------------------------------------------
// RemoteService
// AndroidManifest.xml
// -----------------------------------------------
// -----------------------------------------------
// RemoteService
// Service.java
// -----------------------------------------------
package com.test.testActivity;
// Service
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteCallbackList;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.MediaController;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
/*
@Activity A (test)
startService( new Intent(test.testActivity, testService.class).putExtra("tag", "data") );
String[] strList = {
{"strList1"},
{"strList2"}
};
startService( new Intent(test.testActivity, testService.class).putExtra("tag2", strlist) );
@Service B (testService)
Bundle extras = getIntent().getExtras();
String[] strList = extras.getStringArray( "strlist" );
*/
public class testService extends Service {
private String TAG = "testService";
// Service
private NotificationManager mNM;
private Intent m_InvokeIntent;
private volatile Looper m_ServiceLooper;
private volatile ServiceHandler m_ServiceHandler;
public String m_Str = null;
final RemoteCallbackList
= new RemoteCallbackList
private final class ServiceHandler extends Handler {
public ServiceHandler(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
Bundle extras = (Bundle)msg.obj;
String strTagValue = null;
/*
{
// Broadcast
strTagValue = extras.getString( "command" );
if( strTagValue != null ) {
if( strTagValue.equals("pause") ) {
stopSelf( msg.arg1 );
return;
}
else if( strTagValue.equals("stop") ) {
stopSelf( msg.arg1 );
return;
}
}
}
*/
strTagValue = null;
strTagValue = extras.getString( "tag" );
Log.d( TAG, "Message: " + msg + ", tagValue = " + strTagValue );
if( strTagValue != null ) {
if( strTagValue.equals("data") ) {
}
else if( strTagValue.equals("strlist") ) {
m_strPlayList = extras.getStringArray( "strlist" );
}
else {
Log.d( TAG, "QUIT" );
stopSelf( msg.arg1 );
return;
}
}
else {
stopSelf( msg.arg1 );
return;
}
}
};
@Override
public void onCreate() {
mNM = (NotificationManager)getSystemService( NOTIFICATION_SERVICE );
HandlerThread thread = new HandlerThread( "MediaServiceStart" );
thread.start();
m_ServiceLooper = thread.getLooper();
m_ServiceHandler = new ServiceHandler( m_ServiceLooper );
}
@Override
public void onStart(Intent intent, int startId) {
Log.d( TAG, "ServiceStartArguments: Starting #" + startId + ": " + intent.getExtras() );
{
Message msg = m_ServiceHandler.obtainMessage();
msg.arg1 = startId;
msg.obj = intent.getExtras();
m_ServiceHandler.sendMessage( msg );
Log.d( TAG, "ServiceStartArguments: Sending: " + msg );
// Test: Broadcast
/*
final int n = m_Callbacks.beginBroadcast();
Log.d( TAG, "n = " + n );
for( int i = 0; i < n; i++ )
Log.d( TAG, "item = " + m_Callbacks.getBroadcastItem(i) );
m_Callbacks.finishBroadcast();
*/
}
}
@Override
public void onDestroy() {
m_ServiceLooper.quit();
}
@Override
public IBinder onBind(Intent intent) {
return m_Binder;
}
// The IRemoteInterface is defined through IDL
private final IRemoteService.Stub m_Binder = new IRemoteService.Stub() {
public void registerCallback(IRemoteServiceCallback cb) {
if (cb != null) m_Callbacks.register(cb);
}
public void unregisterCallback(IRemoteServiceCallback cb) {
if (cb != null) m_Callbacks.unregister(cb);
}
public String getInfo() {
String str = "i'm service";
return str;
}
public String setInfo(String str) {
Log.d( TAG, "RECEIVED From Activity: " + str );
return str;
}
};
}
// -----------------------------------------------
// testActivity.java
// -----------------------------------------------
// Service
import android.content.ServiceConnection;
import android.content.ComponentName;
import android.os.IBinder;
import android.os.RemoteException;
public class testActivity extends Activity implements {
// Service
private IRemoteService m_Service = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
//Intent(testActivity.this, testService.class)
//Intent intt = new Intent( testActivity.this, Activity2.class );
//startActivity( intt );
//bindService( new Intent(testService.class.getName()), m_Connection, Context.BIND_AUTO_CREATE );
bindService( new Intent(testActivity.this, testService.class), m_Connection, Context.BIND_AUTO_CREATE );
startService( new Intent(testActivity.this, testService.class).putExtra("tag", "quit") );
/*
if( m_Service != null ) {
try {
m_Service.unregisterCallback( m_Callback );
} catch (RemoteException e) {
}
}
// Detach our existing connection.
unbindService( m_Connection );
stopService( new Intent(testActivity.this, testService.class) );
*/
}
@Override
protected void onDestroy() {
if( m_Service != null ) {
try {
m_Service.unregisterCallback( m_Callback );
} catch (RemoteException e) {
}
}
if( m_Connection != null ) {
// Detach our existing connection.
unbindService( m_Connection );
}
stopService( new Intent(testActivity.this, testService.class) );
super.onDestroy();
}
// Service
private ServiceConnection m_Connection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
m_Service = IRemoteService.Stub.asInterface(service);
try {
m_Service.registerCallback(m_Callback);
Log.d( TAG, "RECEIVED From Service: " + m_Service.getInfo() );
m_Service.setInfo( "i'm activity" );
} catch (RemoteException e) {
}
Toast.makeText( testActivity.this, "Service Connected", Toast.LENGTH_SHORT ).show();
}
public void onServiceDisconnected(ComponentName className) {
m_Service = null;
Toast.makeText( testActivity.this, "Service Disconnected", Toast.LENGTH_SHORT ).show();
}
};
// This implementation is used to receive callbacks from the remote service.
private IRemoteServiceCallback m_Callback = new IRemoteServiceCallback.Stub() {
public void valueChanged(int value) {
//mHandler.sendMessage(mHandler.obtainMessage(BUMP_MSG, value, 0));
}
};
}
// -----------------------------------------------
// IRemoteService.aidl (default + method)
// Source (v1.6): C:/android-sdk-windows/platforms/android-4/samples/ApiDemos/src/com/example/android/apis/app
// -----------------------------------------------
package com.test.testActivity;
import com.test.testActivity.IRemoteServiceCallback;
interface IRemoteService {
void registerCallback(IRemoteServiceCallback cb);
void unregisterCallback(IRemoteServiceCallback cb);
// ADD
String getInfo();
String setInfo(String str);
}
// -----------------------------------------------
// IRemoteServiceCallback.aidl (default)
// Source (v1.6): C:/android-sdk-windows/platforms/android-4/samples/ApiDemos/src/com/example/android/apis/app
// -----------------------------------------------
default
-----
Cheers,
June
월요일, 10월 04, 2010
[Android] My Tip; Android Resolution Problem
Android Resolution Problem
Your App resolution wil be fixed 320x480(Portrait) if you missed the minSdkVersion.
so, you should be set it to 4(Android SDK Version 1.6) or higher.
Adds this into your AndroidManifest.xml:
Note: Change "(" to "<" and ")" to ">"
(manifest)
...
(uses-sdk android:minSdkVersion="4")(/uses-sdk)
(/manifest)
I've tested on Samsung Galaxy Tab.
-----
Cheers,
June
Your App resolution wil be fixed 320x480(Portrait) if you missed the minSdkVersion.
so, you should be set it to 4(Android SDK Version 1.6) or higher.
Adds this into your AndroidManifest.xml:
Note: Change "(" to "<" and ")" to ">"
(manifest)
...
(uses-sdk android:minSdkVersion="4")(/uses-sdk)
(/manifest)
I've tested on Samsung Galaxy Tab.
-----
Cheers,
June
수요일, 9월 29, 2010
[Scheme] MIT/GNU Scheme
[Scheme] MIT/GNU Scheme
:: MIT/GNU Sceme
http://groups.csail.mit.edu/mac/projects/scheme/
http://www.gnu.org/software/mit-scheme/
:: SICP (Structure and Interpretation of Computer Programs)
http://mitpress.mit.edu/sicp/full-text/book/book.html
:: A Beginner's Guide to Using EMACS
http://xkahn.zoned.net/help/emacs.html
-----------------------------------------------------
:: Quick EMACS Commands
- Source: http://xkahn.zoned.net/help/emacs.html
---------------
[Quitting EMACS:]
Quit: Ctrl-x Ctrl-c
I pushed the wrong key. Help!: Ctrl-g
---------------
[Working with files:]
Load a file: Ctrl-x Ctrl-f
Load a directory: Ctrl-x Ctrl-f
New file: Ctrl-x Ctrl-f
Save a file: Ctrl-x Ctrl-s
Save all open files: Ctrl-x s
Save the file with a new name Ctrl-x Ctrl-w
---------------
[Dealing with Buffers]
Switch buffers: Ctrl-x b
Close buffer: Ctrl-x k
Split current buffer Ctrl-x 2
Make current buffer the only one on screen Ctrl-x 1
Switch between the buffers on-screen Ctrl-x o
---------------
[Cutting and pasting]
Set mark: Ctrl-[SPACE]
Cut and save text from here to mark: Ctrl-w
Paste saved text: Ctrl-y
Cut text from the cursor to the end of the line: Ctrl-k
---------------
-----
Cheers,
June
:: MIT/GNU Sceme
http://groups.csail.mit.edu/mac/projects/scheme/
http://www.gnu.org/software/mit-scheme/
:: SICP (Structure and Interpretation of Computer Programs)
http://mitpress.mit.edu/sicp/full-text/book/book.html
:: A Beginner's Guide to Using EMACS
http://xkahn.zoned.net/help/emacs.html
-----------------------------------------------------
:: Quick EMACS Commands
- Source: http://xkahn.zoned.net/help/emacs.html
---------------
[Quitting EMACS:]
Quit: Ctrl-x Ctrl-c
I pushed the wrong key. Help!: Ctrl-g
---------------
[Working with files:]
Load a file: Ctrl-x Ctrl-f
Load a directory: Ctrl-x Ctrl-f
New file: Ctrl-x Ctrl-f
Save a file: Ctrl-x Ctrl-s
Save all open files: Ctrl-x s
Save the file with a new name Ctrl-x Ctrl-w
---------------
[Dealing with Buffers]
Switch buffers: Ctrl-x b
Close buffer: Ctrl-x k
Split current buffer Ctrl-x 2
Make current buffer the only one on screen Ctrl-x 1
Switch between the buffers on-screen Ctrl-x o
---------------
[Cutting and pasting]
Set mark: Ctrl-[SPACE]
Cut and save text from here to mark: Ctrl-w
Paste saved text: Ctrl-y
Cut text from the cursor to the end of the line: Ctrl-k
---------------
-----
Cheers,
June
[Android] My Tip; Android ant release error (-dex: apply)
[Android] My Tip; Android ant release error (-dex: apply)
// ----------------------------------
// :: Preset
// ----------------------------------
- Source Path
C:/Program Files/MyAPKTest
- Android SDK Path
C:/android/android-sdk-windows
- Using Android SDK Version: 2.1
C:/android/android-sdk-windows/platforms/android-6/
// ----------------------------------
// :: Problem
//
// - Caused by this into dx.bat
// if "%params%"=="" goto endArgs
//
// - e.g.,
// set params = "--dex C:/Program Files/MyAPKTest/bin/classes.dex" "..." "..." "..."
// if "%params%" == ""
// - DOS Batch Interpreter does not parse duplicated double-quotation.
// ----------------------------------
C:/Program Files/MyAPKTest> ant clean [OK]
C:/Program Files/MyAPKTest> ant compile [OK]
C:/Program Files/MyAPKTest> ant release
...
-dex:
[echo] Converting compiled files and external libraries into C:/Program Files/MyAPKTest/bin/classes.dex...
[echo]
[apply] =C:/Files""은(는) 예상되지 않았습니다. (Korean)
or
[apply] =C:/Files"" was unexpected at this time. (English)
C:/Program Files/My APK Test>
// ----------------------------------
// :: Solution
// - Condition: Does not needs options
// ----------------------------------
// ----------------------------------
// 1. Open a dx.bat
// ----------------------------------
C:/android/android-sdk-windows/platforms/android-6/tools/dx.bat
// ----------------------------------
// 2. and Adds this in the above the ":nextArg"
// ----------------------------------
...
echo ***** SKIP check the parameter *****
set args=%params%
goto endArgs
:nextArg
if "%params%"=="" goto endArgs
...
// ----------------------------------
// 3. That's it, so now run clean & compile & release
// ----------------------------------
C:/Program Files/MyAPKTest> ant clean && ant compile && ant release
...
BUILD SUCCESSFUL
Total time: x seconds
C:/Program Files/MyAPKTest>
-----
Cheers,
June
// ----------------------------------
// :: Preset
// ----------------------------------
- Source Path
C:/Program Files/MyAPKTest
- Android SDK Path
C:/android/android-sdk-windows
- Using Android SDK Version: 2.1
C:/android/android-sdk-windows/platforms/android-6/
// ----------------------------------
// :: Problem
//
// - Caused by this into dx.bat
// if "%params%"=="" goto endArgs
//
// - e.g.,
// set params = "--dex C:/Program Files/MyAPKTest/bin/classes.dex" "..." "..." "..."
// if "%params%" == ""
// - DOS Batch Interpreter does not parse duplicated double-quotation.
// ----------------------------------
C:/Program Files/MyAPKTest> ant clean [OK]
C:/Program Files/MyAPKTest> ant compile [OK]
C:/Program Files/MyAPKTest> ant release
...
-dex:
[echo] Converting compiled files and external libraries into C:/Program Files/MyAPKTest/bin/classes.dex...
[echo]
[apply] =C:/Files""은(는) 예상되지 않았습니다. (Korean)
or
[apply] =C:/Files"" was unexpected at this time. (English)
C:/Program Files/My APK Test>
// ----------------------------------
// :: Solution
// - Condition: Does not needs options
// ----------------------------------
// ----------------------------------
// 1. Open a dx.bat
// ----------------------------------
C:/android/android-sdk-windows/platforms/android-6/tools/dx.bat
// ----------------------------------
// 2. and Adds this in the above the ":nextArg"
// ----------------------------------
...
echo ***** SKIP check the parameter *****
set args=%params%
goto endArgs
:nextArg
if "%params%"=="" goto endArgs
...
// ----------------------------------
// 3. That's it, so now run clean & compile & release
// ----------------------------------
C:/Program Files/MyAPKTest> ant clean && ant compile && ant release
...
BUILD SUCCESSFUL
Total time: x seconds
C:/Program Files/MyAPKTest>
-----
Cheers,
June
수요일, 9월 15, 2010
[Android] My Tip; Android and ProGuard
Android and ProGuard
How to set ProGuard to ANT script for Android
STEP #1
Create a build.xml for ANT
c:/> ant update project --path c:/my_src
Create a build.property for keystore
STEP #2
EDIT build.xml
STEP #3
SETS ProGuard
STEP #4
BUILD
STEP #5
TEST, that's it!
//
// build.property
//
#application-package=com.test.testApp
#sdk-location=C:/android/android-sdk-windows/platforms/android-6
# KeyStore/Alias
key.store=__MY_KEYSTORE__.keystore
key.alias=__MY_KETSTORE_ALIAS__
key.store.password=__PASSWORD__
key.alias.password=__PASSWORD__
//
// build.xml
//
// --------------------------------
// 1. replace <setup />
// --------------------------------
by
<!-- <setup /> -->
<setup import="false" />
// --------------------------------
// 2. Adds this in the below <setup import="false" />
// --------------------------------
<!-- ProGuard -->
<property name="proguard-dir" value="proguard"/>
<property name="unoptimized" value="${proguard-dir}/unoptimized.jar"/>
<property name="optimized" value="${proguard-dir}/optimized.jar"/>
<target name="optimize" unless="nooptimize">
<jar basedir="${out.classes.dir}" destfile="${unoptimized}"/>
<java jar="${proguard-dir}/proguard.jar" fork="true" failonerror="true">
<jvmarg value="-Dmaximum.inlined.code.length=16"/>
<arg value="@${proguard-dir}/config.txt"/>
<arg value="-injars ${unoptimized}"/>
<arg value="-outjars ${optimized}"/>
<!--<arg value="-libraryjars ${android.jar}"/>-->
<!-- ADDS Library -->
<arg value="-libraryjars ${android.jar}" />
<!-- <arg value="-libraryjars libs/xxx.jar; libs/yyy.jar"/> -->
<!-- ADDS Library -->
</java>
<!-- Delete source pre-optimized jar -->
<!--delete file="${unoptimized}"/-->
<!-- Unzip target optimization jar to original output, and delete optimized.jar -->
<delete dir="${out.classes.dir}"/>
<mkdir dir="${out.classes.dir}"/>
<unzip src="${proguard-dir}/optimized.jar" dest="${out.classes.dir}"/>
<!-- Delete optimized jar (now unzipped into bin directory) -->
<delete file="optimized.jar"/>
</target>
<!-- ProGuard -->
...
<!-- 3. Copy rule and paste into build.xml; see below -->
...
</project>
// --------------------------------
// 3. Copy rule and paste into build.xml
// --------------------------------
OPEN a rule xml file
<SDK_PATH>/platforms/<target_platform>/templates/android_rules.xml
COPY from in the below <project name="android_rules" default="debug">
to in the above </project>
then, PASTE this in the below ProGuard
// --------------------------------
// 4. Finds <target name="-dex" depends="compile">
// --------------------------------
then, adds ", optimize" beside "compile"
<!-- ProGuard -->
<target name="-dex" depends="compile, optimize">
<!-- ProGuard -->
...
//
// ProGuard
//
// --------------------------------
// 1. Get latest version
// --------------------------------
Download: http://sourceforge.net/project/showfiles.php?group_id=54750
// --------------------------------
// 2. Copy proguard.jar where into downloaded zip archive to my project directory
// --------------------------------
create a directory "proguard" into my project source directory
then, copy proguard/lib/proguard.jar to c:/my_src/proguard
// --------------------------------
// 3. Create a config.txt into "my_src_dir/proguard"
// --------------------------------
# --------------------------------------------------
# ProGuard:
# http://proguard.sourceforge.net/
# ProGuard Download:
# http://sourceforge.net/project/showfiles.php?group_id=54750
#
# config.txt Source:
# http://www.androidengineer.com/2010/07/optimizing-obfuscating-and-shrinking.html
# --------------------------------------------------
-target 1.6
-optimizationpasses 2
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
#-verbose
#-dump class_files.txt
#-printseeds seeds.txt
#-printusage unused.txt
#-printmapping mapping.txt
# The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle.
-optimizations !code/simplification/arithmetic
-keep public class * extends android.app.Activity
#-keep public class * extends android.app.Application
#-keep public class * extends android.app.Service
#-keep public class * extends android.content.BroadcastReceiver
#-keep public class * extends android.content.ContentProvider
#-keep public class * extends View {
#public <init>(android.content.Context);
#public <init>(android.content.Context, android.util.AttributeSet);
#public <init>(android.content.Context, android.util.AttributeSet, int);
#public void set*(...);
#}
# --------------------------------------------------
// --------------------------------
// build
// --------------------------------
c:/my_src> ant compile
c:/my_src> ant release
-----
Cheers,
June
How to set ProGuard to ANT script for Android
STEP #1
Create a build.xml for ANT
c:/> ant update project --path c:/my_src
Create a build.property for keystore
STEP #2
EDIT build.xml
STEP #3
SETS ProGuard
STEP #4
BUILD
STEP #5
TEST, that's it!
//
// build.property
//
#application-package=com.test.testApp
#sdk-location=C:/android/android-sdk-windows/platforms/android-6
# KeyStore/Alias
key.store=__MY_KEYSTORE__.keystore
key.alias=__MY_KETSTORE_ALIAS__
key.store.password=__PASSWORD__
key.alias.password=__PASSWORD__
//
// build.xml
//
// --------------------------------
// 1. replace <setup />
// --------------------------------
by
<!-- <setup /> -->
<setup import="false" />
// --------------------------------
// 2. Adds this in the below <setup import="false" />
// --------------------------------
<!-- ProGuard -->
<property name="proguard-dir" value="proguard"/>
<property name="unoptimized" value="${proguard-dir}/unoptimized.jar"/>
<property name="optimized" value="${proguard-dir}/optimized.jar"/>
<target name="optimize" unless="nooptimize">
<jar basedir="${out.classes.dir}" destfile="${unoptimized}"/>
<java jar="${proguard-dir}/proguard.jar" fork="true" failonerror="true">
<jvmarg value="-Dmaximum.inlined.code.length=16"/>
<arg value="@${proguard-dir}/config.txt"/>
<arg value="-injars ${unoptimized}"/>
<arg value="-outjars ${optimized}"/>
<!--<arg value="-libraryjars ${android.jar}"/>-->
<!-- ADDS Library -->
<arg value="-libraryjars ${android.jar}" />
<!-- <arg value="-libraryjars libs/xxx.jar; libs/yyy.jar"/> -->
<!-- ADDS Library -->
</java>
<!-- Delete source pre-optimized jar -->
<!--delete file="${unoptimized}"/-->
<!-- Unzip target optimization jar to original output, and delete optimized.jar -->
<delete dir="${out.classes.dir}"/>
<mkdir dir="${out.classes.dir}"/>
<unzip src="${proguard-dir}/optimized.jar" dest="${out.classes.dir}"/>
<!-- Delete optimized jar (now unzipped into bin directory) -->
<delete file="optimized.jar"/>
</target>
<!-- ProGuard -->
...
<!-- 3. Copy rule and paste into build.xml; see below -->
...
</project>
// --------------------------------
// 3. Copy rule and paste into build.xml
// --------------------------------
OPEN a rule xml file
<SDK_PATH>/platforms/<target_platform>/templates/android_rules.xml
COPY from in the below <project name="android_rules" default="debug">
to in the above </project>
then, PASTE this in the below ProGuard
// --------------------------------
// 4. Finds <target name="-dex" depends="compile">
// --------------------------------
then, adds ", optimize" beside "compile"
<!-- ProGuard -->
<target name="-dex" depends="compile, optimize">
<!-- ProGuard -->
...
//
// ProGuard
//
// --------------------------------
// 1. Get latest version
// --------------------------------
Download: http://sourceforge.net/project/showfiles.php?group_id=54750
// --------------------------------
// 2. Copy proguard.jar where into downloaded zip archive to my project directory
// --------------------------------
create a directory "proguard" into my project source directory
then, copy proguard/lib/proguard.jar to c:/my_src/proguard
// --------------------------------
// 3. Create a config.txt into "my_src_dir/proguard"
// --------------------------------
# --------------------------------------------------
# ProGuard:
# http://proguard.sourceforge.net/
# ProGuard Download:
# http://sourceforge.net/project/showfiles.php?group_id=54750
#
# config.txt Source:
# http://www.androidengineer.com/2010/07/optimizing-obfuscating-and-shrinking.html
# --------------------------------------------------
-target 1.6
-optimizationpasses 2
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
#-verbose
#-dump class_files.txt
#-printseeds seeds.txt
#-printusage unused.txt
#-printmapping mapping.txt
# The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle.
-optimizations !code/simplification/arithmetic
-keep public class * extends android.app.Activity
#-keep public class * extends android.app.Application
#-keep public class * extends android.app.Service
#-keep public class * extends android.content.BroadcastReceiver
#-keep public class * extends android.content.ContentProvider
#-keep public class * extends View {
#public <init>(android.content.Context);
#public <init>(android.content.Context, android.util.AttributeSet);
#public <init>(android.content.Context, android.util.AttributeSet, int);
#public void set*(...);
#}
# --------------------------------------------------
// --------------------------------
// build
// --------------------------------
c:/my_src> ant compile
c:/my_src> ant release
-----
Cheers,
June
목요일, 9월 02, 2010
[Android] My Tip; How to increase Android Emulator's Internal Phone Storage and RAM ?
How to increase Android Emulator's Internal Phone Storage and RAM ?
Usage:
-partition-size [Sizeo of the Internal Phone Storage; MB]
-qemu -m [Sizeo of the Physical RAM; MB]
Run:
- Internal Phone Storage: 512MB
- Physical RAM: 128MB (default)
C:/android-sdk-windows/tools> emulator -partition-size 512 -avd MyAVDname -qemu -m 128
-----
Cheers,
June
Usage:
-partition-size [Sizeo of the Internal Phone Storage; MB]
-qemu -m [Sizeo of the Physical RAM; MB]
Run:
- Internal Phone Storage: 512MB
- Physical RAM: 128MB (default)
C:/android-sdk-windows/tools> emulator -partition-size 512 -avd MyAVDname -qemu -m 128
-----
Cheers,
June
목요일, 8월 26, 2010
[Android] QAEP (MSM/QSD Android Enablement Project)
QAEP (MSM/QSD Android Enablement Project)
Source: https://www.codeaurora.org/wiki/QAEP#Branch_Releases
-----
Cheers,
June
Source: https://www.codeaurora.org/wiki/QAEP#Branch_Releases
-----
Cheers,
June
[CV][IP] DICOM
DICOM (Digital Imaging and Communications in Medicine)
[Link]
* DICOM@OFFIS
http://dicom.offis.de/dcmintro.php.en
* Sample DICOM (.dcm) file
http://filmandpaperdigitizers.com/samples/DICOM/
* Medical Image Samples
http://barre.nom.fr/medical/samples/
-----
Cheers,
June
[Link]
* DICOM@OFFIS
http://dicom.offis.de/dcmintro.php.en
* Sample DICOM (.dcm) file
http://filmandpaperdigitizers.com/samples/DICOM/
* Medical Image Samples
http://barre.nom.fr/medical/samples/
-----
Cheers,
June
[Algorithm][AI][Genetic]
AI: Genetic Algorithm
[Link]
* Genetic-Programming by John R. Koza
http://www.genetic-programming.com/johnkoza.html
* Father of the Genetic Programming, John R. Koza (Written in Korean)
http://popsci.hankooki.com/popsci_news/view.php?news1_id=2506&cate=14&page=78&keyword=
-----
Cheers,
June
[Link]
* Genetic-Programming by John R. Koza
http://www.genetic-programming.com/johnkoza.html
* Father of the Genetic Programming, John R. Koza (Written in Korean)
http://popsci.hankooki.com/popsci_news/view.php?news1_id=2506&cate=14&page=78&keyword=
-----
Cheers,
June
목요일, 8월 19, 2010
[Android] Android
Android
* Android Open Source Project
Source: http://android.git.kernel.org/
* Android x86 Project (Porting Android to x86)
Source: http://www.android-x86.org/
* Content Provider
Reference: http://www.devx.com/wireless/Article/41133
{ // CContentProvider Example
http://code.google.com/p/listenmystory/source/browse/
//
// CContentProvider Example
//
#DB: DB_CPtest
#TABLE NAME: info
#TABLE DESCRIPTION:
_id | title | data | data2 (extra)
// Get all of data
Uri allTitles = Uri.parse( "content://com.android.myTest1/db_cptest" );
Cursor c = managedQuery( allTitles, null, null, null, "_id asc" );
if( c.moveToFirst() ) {
do {
//Toast.makeText(this,
// c.getString(c.getColumnIndex(CContentProvider._ID)) + ", " +
// c.getString(c.getColumnIndex(CContentProvider.TITLE)) + ", " +
// c.getString(c.getColumnIndex(CContentProvider.DATA)) + ", " +
// c.getString(c.getColumnIndex(CContentProvider.DATA2)),
//Toast.LENGTH_LONG).show();
String strId = c.getString( c.getColumnIndex(CContentProvider._ID) );
String strTitle = c.getString( c.getColumnIndex(CContentProvider.TITLE) );
String strData = c.getString( c.getColumnIndex(CContentProvider.DATA) );
String strData2 = c.getString( c.getColumnIndex(CContentProvider.DATA2) );
Log.d( TAG, "id = " + strId + ", title = " + strTitle + ", data = " + strData + ", data2 = " + strData2 );
} while( c.moveToNext() );
}
// INSERT
ContentValues values = new ContentValues();
values.put( "title", "title1" );
values.put( "data", "data" );
values.put( "data2", "extra" );
Uri uri = Uri.parse( "content://com.android.myTest1/db_cptest" );
Uri resUri = getContentResolver().insert( uri, values );
// UPDATE #1
ContentValues values = new ContentValues();
values.put( "data", "data" );
Uri uri = Uri.parse( "content://com.android.myTest1/db_cptest/1" );
int resRowCount = getContentResolver().update( uri, values, null, null );
if( resRowCount > 0 )
Log.d( TAG, "Updated [TRUE]" );
else
Log.d( TAG, "Updated [FALSE]" );
// UPDATE #2
ContentValues values = new ContentValues();
values.put( "data", "data" );
Uri uri = Uri.parse( "content://com.android.myTest1/db_cptest" );
String[] strParam = { "title1" };
int resRowCount = getContentResolver().update( uri, values, "title=?", strParam );
if( resRowCount > 0 )
Log.d( TAG, "Updated [TRUE]" );
else
Log.d( TAG, "Updated [FALSE]" );
} // end of CContentProvider Example
// -----------------------------------------------------------
-----
Cheers,
June
* Android Open Source Project
Source: http://android.git.kernel.org/
* Android x86 Project (Porting Android to x86)
Source: http://www.android-x86.org/
* Content Provider
Reference: http://www.devx.com/wireless/Article/41133
{ // CContentProvider Example
http://code.google.com/p/listenmystory/source/browse/
//
// CContentProvider Example
//
#DB: DB_CPtest
#TABLE NAME: info
#TABLE DESCRIPTION:
_id | title | data | data2 (extra)
// Get all of data
Uri allTitles = Uri.parse( "content://com.android.myTest1/db_cptest" );
Cursor c = managedQuery( allTitles, null, null, null, "_id asc" );
if( c.moveToFirst() ) {
do {
//Toast.makeText(this,
// c.getString(c.getColumnIndex(CContentProvider._ID)) + ", " +
// c.getString(c.getColumnIndex(CContentProvider.TITLE)) + ", " +
// c.getString(c.getColumnIndex(CContentProvider.DATA)) + ", " +
// c.getString(c.getColumnIndex(CContentProvider.DATA2)),
//Toast.LENGTH_LONG).show();
String strId = c.getString( c.getColumnIndex(CContentProvider._ID) );
String strTitle = c.getString( c.getColumnIndex(CContentProvider.TITLE) );
String strData = c.getString( c.getColumnIndex(CContentProvider.DATA) );
String strData2 = c.getString( c.getColumnIndex(CContentProvider.DATA2) );
Log.d( TAG, "id = " + strId + ", title = " + strTitle + ", data = " + strData + ", data2 = " + strData2 );
} while( c.moveToNext() );
}
// INSERT
ContentValues values = new ContentValues();
values.put( "title", "title1" );
values.put( "data", "data" );
values.put( "data2", "extra" );
Uri uri = Uri.parse( "content://com.android.myTest1/db_cptest" );
Uri resUri = getContentResolver().insert( uri, values );
// UPDATE #1
ContentValues values = new ContentValues();
values.put( "data", "data" );
Uri uri = Uri.parse( "content://com.android.myTest1/db_cptest/1" );
int resRowCount = getContentResolver().update( uri, values, null, null );
if( resRowCount > 0 )
Log.d( TAG, "Updated [TRUE]" );
else
Log.d( TAG, "Updated [FALSE]" );
// UPDATE #2
ContentValues values = new ContentValues();
values.put( "data", "data" );
Uri uri = Uri.parse( "content://com.android.myTest1/db_cptest" );
String[] strParam = { "title1" };
int resRowCount = getContentResolver().update( uri, values, "title=?", strParam );
if( resRowCount > 0 )
Log.d( TAG, "Updated [TRUE]" );
else
Log.d( TAG, "Updated [FALSE]" );
} // end of CContentProvider Example
// -----------------------------------------------------------
-----
Cheers,
June
목요일, 8월 12, 2010
[Android] Android Coverflow Widget
Android Coverflow Widget
http://www.inter-fuser.com/2010/01/android-coverflow-widget.html
Android Coverflow Widget V2
http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.html
Android Coverflow Widget V2
It's been a while now and I've been pretty busy with life, work, and other things, but at last here's a new version of the coverflow widget that I released a while back. There's not really much new functionality here, but I have cut down the amount of code needed by a lot. Gone are the CoverAbsSpinner and the CoverAdapterView classes and now we are left with just the CoverFlow class weighing in at less than 200 lines of code. Of course, you still have to instantiate it and populate it using an ImageAdapter so I'll also include the activity class for doing those tasks as well.
Background
The basic idea is that the Coverflow widget works very much like the standard Android Gallery widget, but with the addition of the rotation of the images. For more background information on the Coverflow widget see my original post here.
How to use
In your Android project create a package called com.example.coverflow, and in this place the CoverFlow class. Now all you need is an activity to instantiate the Coverflow widget in this example the activity class is called CoverflowExample. CoverFlowExample simply extends Activity and instantiates a Coverflow class in it's onCreate method. It also has an internal Class, ImageAdapter which we use as the adapter for the Coverflow widget, much as we would for a Gallery widget. It is also possible to use the Coverflow widget when it is specified in an XML layout file.
The CoverFlow and CoverflowExample classes are here:
/*
* Copyright (C) 2010 Neil Davies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This code is base on the Android Gallery widget and was Created
* by Neil Davies neild001 'at' gmail dot com to be a Coverflow widget
*
* @author Neil Davies
*/
package com.example.coverflow;
import android.content.Context;
import android.graphics.Camera;
import android.graphics.Matrix;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Transformation;
import android.widget.Gallery;
import android.widget.ImageView;
public class CoverFlow extends Gallery {
/**
* Graphics Camera used for transforming the matrix of ImageViews
*/
private Camera mCamera = new Camera();
/**
* The maximum angle the Child ImageView will be rotated by
*/
private int mMaxRotationAngle = 60;
/**
* The maximum zoom on the centre Child
*/
private int mMaxZoom = -120;
/**
* The Centre of the Coverflow
*/
private int mCoveflowCenter;
public CoverFlow(Context context) {
super(context);
this.setStaticTransformationsEnabled(true);
}
public CoverFlow(Context context, AttributeSet attrs) {
super(context, attrs);
this.setStaticTransformationsEnabled(true);
}
public CoverFlow(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.setStaticTransformationsEnabled(true);
}
/**
* Get the max rotational angle of the image
* @return the mMaxRotationAngle
*/
public int getMaxRotationAngle() {
return mMaxRotationAngle;
}
/**
* Set the max rotational angle of each image
* @param maxRotationAngle the mMaxRotationAngle to set
*/
public void setMaxRotationAngle(int maxRotationAngle) {
mMaxRotationAngle = maxRotationAngle;
}
/**
* Get the Max zoom of the centre image
* @return the mMaxZoom
*/
public int getMaxZoom() {
return mMaxZoom;
}
/**
* Set the max zoom of the centre image
* @param maxZoom the mMaxZoom to set
*/
public void setMaxZoom(int maxZoom) {
mMaxZoom = maxZoom;
}
/**
* Get the Centre of the Coverflow
* @return The centre of this Coverflow.
*/
private int getCenterOfCoverflow() {
return (getWidth() - getPaddingLeft() - getPaddingRight()) / 2 + getPaddingLeft();
}
/**
* Get the Centre of the View
* @return The centre of the given view.
*/
private static int getCenterOfView(View view) {
return view.getLeft() + view.getWidth() / 2;
}
/**
* {@inheritDoc}
*
* @see #setStaticTransformationsEnabled(boolean)
*/
protected boolean getChildStaticTransformation(View child, Transformation t) {
final int childCenter = getCenterOfView(child);
final int childWidth = child.getWidth() ;
int rotationAngle = 0;
t.clear();
t.setTransformationType(Transformation.TYPE_MATRIX);
if (childCenter == mCoveflowCenter) {
transformImageBitmap((ImageView) child, t, 0);
} else {
rotationAngle = (int) (((float) (mCoveflowCenter - childCenter)/ childWidth) * mMaxRotationAngle);
if (Math.abs(rotationAngle) > mMaxRotationAngle) {
rotationAngle = (rotationAngle < 0) ? -mMaxRotationAngle : mMaxRotationAngle;
}
transformImageBitmap((ImageView) child, t, rotationAngle);
}
return true;
}
/**
* This is called during layout when the size of this view has changed. If
* you were just added to the view hierarchy, you're called with the old
* values of 0.
*
* @param w Current width of this view.
* @param h Current height of this view.
* @param oldw Old width of this view.
* @param oldh Old height of this view.
*/
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
mCoveflowCenter = getCenterOfCoverflow();
super.onSizeChanged(w, h, oldw, oldh);
}
/**
* Transform the Image Bitmap by the Angle passed
*
* @param imageView ImageView the ImageView whose bitmap we want to rotate
* @param t transformation
* @param rotationAngle the Angle by which to rotate the Bitmap
*/
private void transformImageBitmap(ImageView child, Transformation t, int rotationAngle) {
mCamera.save();
final Matrix imageMatrix = t.getMatrix();;
final int imageHeight = child.getLayoutParams().height;;
final int imageWidth = child.getLayoutParams().width;
final int rotation = Math.abs(rotationAngle);
mCamera.translate(0.0f, 0.0f, 100.0f);
//As the angle of the view gets less, zoom in
if ( rotation < mMaxRotationAngle ) {
float zoomAmount = (float) (mMaxZoom + (rotation * 1.5));
mCamera.translate(0.0f, 0.0f, zoomAmount);
}
mCamera.rotateY(rotationAngle);
mCamera.getMatrix(imageMatrix);
imageMatrix.preTranslate(-(imageWidth/2), -(imageHeight/2));
imageMatrix.postTranslate((imageWidth/2), (imageHeight/2));
mCamera.restore();
}
}
// -----------------------------------------
/*
* Copyright (C) 2010 Neil Davies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This code is base on the Android Gallery widget and was Created
* by Neil Davies neild001 'at' gmail dot com to be a Coverflow widget
*
* @author Neil Davies
*/
package com.example.coverflow;
import java.io.FileInputStream;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuffXfermode;
import android.graphics.Bitmap.Config;
import android.graphics.PorterDuff.Mode;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
public class CoverFlowExample extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CoverFlow coverFlow;
coverFlow = new CoverFlow(this);
coverFlow.setAdapter(new ImageAdapter(this));
ImageAdapter coverImageAdapter = new ImageAdapter(this);
//coverImageAdapter.createReflectedImages();
coverFlow.setAdapter(coverImageAdapter);
coverFlow.setSpacing(-25);
coverFlow.setSelection(4, true);
coverFlow.setAnimationDuration(1000);
setContentView(coverFlow);
}
public class ImageAdapter extends BaseAdapter {
int mGalleryItemBackground;
private Context mContext;
private FileInputStream fis;
private Integer[] mImageIds = {
R.drawable.kasabian_kasabian,
R.drawable.starssailor_silence_is_easy,
R.drawable.killers_day_and_age,
R.drawable.garbage_bleed_like_me,
R.drawable.death_cub_for_cutie_the_photo_album,
R.drawable.kasabian_kasabian,
R.drawable.massive_attack_collected,
R.drawable.muse_the_resistance,
R.drawable.starssailor_silence_is_easy
};
private ImageView[] mImages;
public ImageAdapter(Context c) {
mContext = c;
mImages = new ImageView[mImageIds.length];
}
public boolean createReflectedImages() {
//The gap we want between the reflection and the original image
final int reflectionGap = 4;
int index = 0;
for (int imageId : mImageIds) {
Bitmap originalImage = BitmapFactory.decodeResource(getResources(),
imageId);
int width = originalImage.getWidth();
int height = originalImage.getHeight();
//This will not scale but will flip on the Y axis
Matrix matrix = new Matrix();
matrix.preScale(1, -1);
//Create a Bitmap with the flip matrix applied to it.
//We only want the bottom half of the image
Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0, height/2, width, height/2, matrix, false);
//Create a new bitmap with same width but taller to fit reflection
Bitmap bitmapWithReflection = Bitmap.createBitmap(width
, (height + height/2), Config.ARGB_8888);
//Create a new Canvas with the bitmap that's big enough for
//the image plus gap plus reflection
Canvas canvas = new Canvas(bitmapWithReflection);
//Draw in the original image
canvas.drawBitmap(originalImage, 0, 0, null);
//Draw in the gap
Paint deafaultPaint = new Paint();
canvas.drawRect(0, height, width, height + reflectionGap, deafaultPaint);
//Draw in the reflection
canvas.drawBitmap(reflectionImage,0, height + reflectionGap, null);
//Create a shader that is a linear gradient that covers the reflection
Paint paint = new Paint();
LinearGradient shader = new LinearGradient(0, originalImage.getHeight(), 0,
bitmapWithReflection.getHeight() + reflectionGap, 0x70ffffff, 0x00ffffff,
TileMode.CLAMP);
//Set the paint to use this shader (linear gradient)
paint.setShader(shader);
//Set the Transfer mode to be porter duff and destination in
paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
//Draw a rectangle using the paint with our linear gradient
canvas.drawRect(0, height, width,
bitmapWithReflection.getHeight() + reflectionGap, paint);
ImageView imageView = new ImageView(mContext);
imageView.setImageBitmap(bitmapWithReflection);
imageView.setLayoutParams(new CoverFlow.LayoutParams(120, 180));
imageView.setScaleType(ScaleType.MATRIX);
mImages[index++] = imageView;
}
return true;
}
public int getCount() {
return mImageIds.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
//Use this code if you want to load from resources
ImageView i = new ImageView(mContext);
i.setImageResource(mImageIds[position]);
i.setLayoutParams(new CoverFlow.LayoutParams(130, 130));
i.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
//Make sure we set anti-aliasing otherwise we get jaggies
BitmapDrawable drawable = (BitmapDrawable) i.getDrawable();
drawable.setAntiAlias(true);
return i;
//return mImages[position];
}
/** Returns the size (0.0f to 1.0f) of the views
* depending on the 'offset' to the center. */
public float getScale(boolean focused, int offset) {
/* Formula: 1 / (2 ^ offset) */
return Math.max(0, 1.0f / (float)Math.pow(2, Math.abs(offset)));
}
}
}
Code explanation
The CoverflowExample Code contains some extra code for creating reflections of the images, but apart from this is a standard activity class of the kind used with the Gallery widget.
The CoverFlow class extends the Gallery widget , but now we override a few methods to allow us to transform the images before they are displayed. The most important method that we override is the getChildStaticTransformation method. Here I have to say thank you to a user called Nerdrow on the Android developers group who first showed me an example of overriding this method. By setting setStaticTransformationsEnabled in the constructors, we are telling the parent ViewGroup of the Coverflow class to invoke getChildStaticTransformation every time one of our images in drawn. In getChildStaticTransformation we simply calculate and apply a rotation and scale to the ImageView depending on it's position relative to the centre of the Coverflow widget. We also override the onSizeChanged method. This method is called every time the widget changes size e.g. when we change the orientation of the phone from portrait to landscape. In the onSizeChanged method we just get the centre position of the coverflow widget. There are also a few parameters that we can set, mZoomMax controls the maximum zoom of the central image and mMaxRotationAngle sets the maximum rotation angle of each image.
Thanks
Lastly, I just wanted to say thanks to everyone who has commented and given me feedback on the coverflow widget. It's be really positive and great to hear that people have got it working successfully on a range of devices such as the HTC magic , Motorolla droid and Nexus 1. There's still more to do for the coverflow widget and I'll release new version as and when I make updates. If anyone has anymore suggests for cool widgets or enhancements to this Coverflow widget then please do get in touch.
-----
Great work!
Cheers,
June
http://www.inter-fuser.com/2010/01/android-coverflow-widget.html
Android Coverflow Widget V2
http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.html
Android Coverflow Widget V2
It's been a while now and I've been pretty busy with life, work, and other things, but at last here's a new version of the coverflow widget that I released a while back. There's not really much new functionality here, but I have cut down the amount of code needed by a lot. Gone are the CoverAbsSpinner and the CoverAdapterView classes and now we are left with just the CoverFlow class weighing in at less than 200 lines of code. Of course, you still have to instantiate it and populate it using an ImageAdapter so I'll also include the activity class for doing those tasks as well.
Background
The basic idea is that the Coverflow widget works very much like the standard Android Gallery widget, but with the addition of the rotation of the images. For more background information on the Coverflow widget see my original post here.
How to use
In your Android project create a package called com.example.coverflow, and in this place the CoverFlow class. Now all you need is an activity to instantiate the Coverflow widget in this example the activity class is called CoverflowExample. CoverFlowExample simply extends Activity and instantiates a Coverflow class in it's onCreate method. It also has an internal Class, ImageAdapter which we use as the adapter for the Coverflow widget, much as we would for a Gallery widget. It is also possible to use the Coverflow widget when it is specified in an XML layout file.
The CoverFlow and CoverflowExample classes are here:
/*
* Copyright (C) 2010 Neil Davies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This code is base on the Android Gallery widget and was Created
* by Neil Davies neild001 'at' gmail dot com to be a Coverflow widget
*
* @author Neil Davies
*/
package com.example.coverflow;
import android.content.Context;
import android.graphics.Camera;
import android.graphics.Matrix;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Transformation;
import android.widget.Gallery;
import android.widget.ImageView;
public class CoverFlow extends Gallery {
/**
* Graphics Camera used for transforming the matrix of ImageViews
*/
private Camera mCamera = new Camera();
/**
* The maximum angle the Child ImageView will be rotated by
*/
private int mMaxRotationAngle = 60;
/**
* The maximum zoom on the centre Child
*/
private int mMaxZoom = -120;
/**
* The Centre of the Coverflow
*/
private int mCoveflowCenter;
public CoverFlow(Context context) {
super(context);
this.setStaticTransformationsEnabled(true);
}
public CoverFlow(Context context, AttributeSet attrs) {
super(context, attrs);
this.setStaticTransformationsEnabled(true);
}
public CoverFlow(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.setStaticTransformationsEnabled(true);
}
/**
* Get the max rotational angle of the image
* @return the mMaxRotationAngle
*/
public int getMaxRotationAngle() {
return mMaxRotationAngle;
}
/**
* Set the max rotational angle of each image
* @param maxRotationAngle the mMaxRotationAngle to set
*/
public void setMaxRotationAngle(int maxRotationAngle) {
mMaxRotationAngle = maxRotationAngle;
}
/**
* Get the Max zoom of the centre image
* @return the mMaxZoom
*/
public int getMaxZoom() {
return mMaxZoom;
}
/**
* Set the max zoom of the centre image
* @param maxZoom the mMaxZoom to set
*/
public void setMaxZoom(int maxZoom) {
mMaxZoom = maxZoom;
}
/**
* Get the Centre of the Coverflow
* @return The centre of this Coverflow.
*/
private int getCenterOfCoverflow() {
return (getWidth() - getPaddingLeft() - getPaddingRight()) / 2 + getPaddingLeft();
}
/**
* Get the Centre of the View
* @return The centre of the given view.
*/
private static int getCenterOfView(View view) {
return view.getLeft() + view.getWidth() / 2;
}
/**
* {@inheritDoc}
*
* @see #setStaticTransformationsEnabled(boolean)
*/
protected boolean getChildStaticTransformation(View child, Transformation t) {
final int childCenter = getCenterOfView(child);
final int childWidth = child.getWidth() ;
int rotationAngle = 0;
t.clear();
t.setTransformationType(Transformation.TYPE_MATRIX);
if (childCenter == mCoveflowCenter) {
transformImageBitmap((ImageView) child, t, 0);
} else {
rotationAngle = (int) (((float) (mCoveflowCenter - childCenter)/ childWidth) * mMaxRotationAngle);
if (Math.abs(rotationAngle) > mMaxRotationAngle) {
rotationAngle = (rotationAngle < 0) ? -mMaxRotationAngle : mMaxRotationAngle;
}
transformImageBitmap((ImageView) child, t, rotationAngle);
}
return true;
}
/**
* This is called during layout when the size of this view has changed. If
* you were just added to the view hierarchy, you're called with the old
* values of 0.
*
* @param w Current width of this view.
* @param h Current height of this view.
* @param oldw Old width of this view.
* @param oldh Old height of this view.
*/
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
mCoveflowCenter = getCenterOfCoverflow();
super.onSizeChanged(w, h, oldw, oldh);
}
/**
* Transform the Image Bitmap by the Angle passed
*
* @param imageView ImageView the ImageView whose bitmap we want to rotate
* @param t transformation
* @param rotationAngle the Angle by which to rotate the Bitmap
*/
private void transformImageBitmap(ImageView child, Transformation t, int rotationAngle) {
mCamera.save();
final Matrix imageMatrix = t.getMatrix();;
final int imageHeight = child.getLayoutParams().height;;
final int imageWidth = child.getLayoutParams().width;
final int rotation = Math.abs(rotationAngle);
mCamera.translate(0.0f, 0.0f, 100.0f);
//As the angle of the view gets less, zoom in
if ( rotation < mMaxRotationAngle ) {
float zoomAmount = (float) (mMaxZoom + (rotation * 1.5));
mCamera.translate(0.0f, 0.0f, zoomAmount);
}
mCamera.rotateY(rotationAngle);
mCamera.getMatrix(imageMatrix);
imageMatrix.preTranslate(-(imageWidth/2), -(imageHeight/2));
imageMatrix.postTranslate((imageWidth/2), (imageHeight/2));
mCamera.restore();
}
}
// -----------------------------------------
/*
* Copyright (C) 2010 Neil Davies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This code is base on the Android Gallery widget and was Created
* by Neil Davies neild001 'at' gmail dot com to be a Coverflow widget
*
* @author Neil Davies
*/
package com.example.coverflow;
import java.io.FileInputStream;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuffXfermode;
import android.graphics.Bitmap.Config;
import android.graphics.PorterDuff.Mode;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
public class CoverFlowExample extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CoverFlow coverFlow;
coverFlow = new CoverFlow(this);
coverFlow.setAdapter(new ImageAdapter(this));
ImageAdapter coverImageAdapter = new ImageAdapter(this);
//coverImageAdapter.createReflectedImages();
coverFlow.setAdapter(coverImageAdapter);
coverFlow.setSpacing(-25);
coverFlow.setSelection(4, true);
coverFlow.setAnimationDuration(1000);
setContentView(coverFlow);
}
public class ImageAdapter extends BaseAdapter {
int mGalleryItemBackground;
private Context mContext;
private FileInputStream fis;
private Integer[] mImageIds = {
R.drawable.kasabian_kasabian,
R.drawable.starssailor_silence_is_easy,
R.drawable.killers_day_and_age,
R.drawable.garbage_bleed_like_me,
R.drawable.death_cub_for_cutie_the_photo_album,
R.drawable.kasabian_kasabian,
R.drawable.massive_attack_collected,
R.drawable.muse_the_resistance,
R.drawable.starssailor_silence_is_easy
};
private ImageView[] mImages;
public ImageAdapter(Context c) {
mContext = c;
mImages = new ImageView[mImageIds.length];
}
public boolean createReflectedImages() {
//The gap we want between the reflection and the original image
final int reflectionGap = 4;
int index = 0;
for (int imageId : mImageIds) {
Bitmap originalImage = BitmapFactory.decodeResource(getResources(),
imageId);
int width = originalImage.getWidth();
int height = originalImage.getHeight();
//This will not scale but will flip on the Y axis
Matrix matrix = new Matrix();
matrix.preScale(1, -1);
//Create a Bitmap with the flip matrix applied to it.
//We only want the bottom half of the image
Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0, height/2, width, height/2, matrix, false);
//Create a new bitmap with same width but taller to fit reflection
Bitmap bitmapWithReflection = Bitmap.createBitmap(width
, (height + height/2), Config.ARGB_8888);
//Create a new Canvas with the bitmap that's big enough for
//the image plus gap plus reflection
Canvas canvas = new Canvas(bitmapWithReflection);
//Draw in the original image
canvas.drawBitmap(originalImage, 0, 0, null);
//Draw in the gap
Paint deafaultPaint = new Paint();
canvas.drawRect(0, height, width, height + reflectionGap, deafaultPaint);
//Draw in the reflection
canvas.drawBitmap(reflectionImage,0, height + reflectionGap, null);
//Create a shader that is a linear gradient that covers the reflection
Paint paint = new Paint();
LinearGradient shader = new LinearGradient(0, originalImage.getHeight(), 0,
bitmapWithReflection.getHeight() + reflectionGap, 0x70ffffff, 0x00ffffff,
TileMode.CLAMP);
//Set the paint to use this shader (linear gradient)
paint.setShader(shader);
//Set the Transfer mode to be porter duff and destination in
paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
//Draw a rectangle using the paint with our linear gradient
canvas.drawRect(0, height, width,
bitmapWithReflection.getHeight() + reflectionGap, paint);
ImageView imageView = new ImageView(mContext);
imageView.setImageBitmap(bitmapWithReflection);
imageView.setLayoutParams(new CoverFlow.LayoutParams(120, 180));
imageView.setScaleType(ScaleType.MATRIX);
mImages[index++] = imageView;
}
return true;
}
public int getCount() {
return mImageIds.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
//Use this code if you want to load from resources
ImageView i = new ImageView(mContext);
i.setImageResource(mImageIds[position]);
i.setLayoutParams(new CoverFlow.LayoutParams(130, 130));
i.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
//Make sure we set anti-aliasing otherwise we get jaggies
BitmapDrawable drawable = (BitmapDrawable) i.getDrawable();
drawable.setAntiAlias(true);
return i;
//return mImages[position];
}
/** Returns the size (0.0f to 1.0f) of the views
* depending on the 'offset' to the center. */
public float getScale(boolean focused, int offset) {
/* Formula: 1 / (2 ^ offset) */
return Math.max(0, 1.0f / (float)Math.pow(2, Math.abs(offset)));
}
}
}
Code explanation
The CoverflowExample Code contains some extra code for creating reflections of the images, but apart from this is a standard activity class of the kind used with the Gallery widget.
The CoverFlow class extends the Gallery widget , but now we override a few methods to allow us to transform the images before they are displayed. The most important method that we override is the getChildStaticTransformation method. Here I have to say thank you to a user called Nerdrow on the Android developers group who first showed me an example of overriding this method. By setting setStaticTransformationsEnabled in the constructors, we are telling the parent ViewGroup of the Coverflow class to invoke getChildStaticTransformation every time one of our images in drawn. In getChildStaticTransformation we simply calculate and apply a rotation and scale to the ImageView depending on it's position relative to the centre of the Coverflow widget. We also override the onSizeChanged method. This method is called every time the widget changes size e.g. when we change the orientation of the phone from portrait to landscape. In the onSizeChanged method we just get the centre position of the coverflow widget. There are also a few parameters that we can set, mZoomMax controls the maximum zoom of the central image and mMaxRotationAngle sets the maximum rotation angle of each image.
Thanks
Lastly, I just wanted to say thanks to everyone who has commented and given me feedback on the coverflow widget. It's be really positive and great to hear that people have got it working successfully on a range of devices such as the HTC magic , Motorolla droid and Nexus 1. There's still more to do for the coverflow widget and I'll release new version as and when I make updates. If anyone has anymore suggests for cool widgets or enhancements to this Coverflow widget then please do get in touch.
-----
Great work!
Cheers,
June
Win32-GuiTest - Perl GUI Test Utilities
Win32-GuiTest - Perl GUI Test Utilities
Source: http://search.cpan.org/~karasik/Win32-GuiTest-1.57/
SYNOPSIS
use Win32::GuiTest qw(FindWindowLike GetWindowText
SetForegroundWindow SendKeys);
$Win32::GuiTest::debug = 0; # Set to "1" to enable verbose mode
my @windows = FindWindowLike(0, "^Microsoft Excel", "^XLMAIN\$");
for (@windows) {
print "$_>\t'", GetWindowText($_), "'\n";
SetForegroundWindow($_);
SendKeys("%fn~a{TAB}b{TAB}{BS}{DOWN}");
}
DESCRIPTION
Most GUI test scripts I have seen/written for Win32 use some variant of
Visual Basic (e.g. MS-VB or MS-Visual Test). The main reason is the
availability of the SendKeys function.
...
-----
This is a great utilities. we can handling a win32 app GUI as a perl script.
This means you don't need to yourself test anymore for app test (i.e., in QA).
Just make a script then do the test. easy ?
visit above the site.
Cheers,
June
Source: http://search.cpan.org/~karasik/Win32-GuiTest-1.57/
SYNOPSIS
use Win32::GuiTest qw(FindWindowLike GetWindowText
SetForegroundWindow SendKeys);
$Win32::GuiTest::debug = 0; # Set to "1" to enable verbose mode
my @windows = FindWindowLike(0, "^Microsoft Excel", "^XLMAIN\$");
for (@windows) {
print "$_>\t'", GetWindowText($_), "'\n";
SetForegroundWindow($_);
SendKeys("%fn~a{TAB}b{TAB}{BS}{DOWN}");
}
DESCRIPTION
Most GUI test scripts I have seen/written for Win32 use some variant of
Visual Basic (e.g. MS-VB or MS-Visual Test). The main reason is the
availability of the SendKeys function.
...
-----
This is a great utilities. we can handling a win32 app GUI as a perl script.
This means you don't need to yourself test anymore for app test (i.e., in QA).
Just make a script then do the test. easy ?
visit above the site.
Cheers,
June
수요일, 8월 11, 2010
[Android] MediaPlayer Time Format
MediaPlayer Time Format
// See below site
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/widget/MediaController.java;hb=71beeab14a891297b6658c4aeb47557083091aa1
int position = mediaPlayer.getCurrentPosition();
int duration = mediaPlayer.getDuration();
int timeMs = position;
or
int timeMs = duration;
int totalSeconds = timeMs / 1000;
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
int hours = totalSeconds / 3600;
-----
Cheers,
June
// See below site
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/widget/MediaController.java;hb=71beeab14a891297b6658c4aeb47557083091aa1
int position = mediaPlayer.getCurrentPosition();
int duration = mediaPlayer.getDuration();
int timeMs = position;
or
int timeMs = duration;
int totalSeconds = timeMs / 1000;
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
int hours = totalSeconds / 3600;
-----
Cheers,
June
금요일, 8월 06, 2010
[Android] Resize SurfaceView
Android Resize SurfaceView
:: in Activity Java Source Code
// Get SurfaceView LayoutParams info
android.view.ViewGroup.LayoutParams lp = m_SurfaceView.getLayoutParams();
// Set to params
lp.width = 320;
lp.height = 240;
// Apply to new dimension
m_SurfaceView.setLayoutParams( lp );
// Set left, top margin
int l = (getWindowManager().getDefaultDisplay().getWidth() - lp.width) / 2;
int t = (getWindowManager().getDefaultDisplay().getHeight() - lp.height) / 2;
((android.widget.RelativeLayout.LayoutParams)m_SurfaceView.getLayoutParams()).setMargins( l, t, 0, 0 );
// Restore to Full size
/*
lp.width = getWindowManager().getDefaultDisplay().getWidth();
lp.height = getWindowManager().getDefaultDisplay().getHeight();
m_SurfaceView.setLayoutParams( lp );
((android.widget.RelativeLayout.LayoutParams)m_SurfaceView.getLayoutParams()).setMargins( 0, 0, 0, 0 );
*/
-----
Cheers,
June
:: in Activity Java Source Code
// Get SurfaceView LayoutParams info
android.view.ViewGroup.LayoutParams lp = m_SurfaceView.getLayoutParams();
// Set to params
lp.width = 320;
lp.height = 240;
// Apply to new dimension
m_SurfaceView.setLayoutParams( lp );
// Set left, top margin
int l = (getWindowManager().getDefaultDisplay().getWidth() - lp.width) / 2;
int t = (getWindowManager().getDefaultDisplay().getHeight() - lp.height) / 2;
((android.widget.RelativeLayout.LayoutParams)m_SurfaceView.getLayoutParams()).setMargins( l, t, 0, 0 );
// Restore to Full size
/*
lp.width = getWindowManager().getDefaultDisplay().getWidth();
lp.height = getWindowManager().getDefaultDisplay().getHeight();
m_SurfaceView.setLayoutParams( lp );
((android.widget.RelativeLayout.LayoutParams)m_SurfaceView.getLayoutParams()).setMargins( 0, 0, 0, 0 );
*/
-----
Cheers,
June
목요일, 8월 05, 2010
[Android] Show or Hide Panel layout on SurfaceView such as MediaController layout
Show or Hide Panel layout on SurfaceView such as MediaController layout
// NOTE: You have to simple layout that
// LinearLayout_MyPanel(layout_width="fill_parent", layout_height="50dp", ...) or whatever
// in order to applying below code.
// Show Panel layout on SurfaceView
private boolean ShowMyPanel(boolean isRunnable) {
Log.d( "FUNC", "ShowMyPanel()" );
boolean ret = true;
android.widget.LinearLayout rl = (android.widget.LinearLayout)findViewById( R.id.LinearLayout_MyPanel );
if( rl.getVisibility() != rl.VISIBLE ) {
if( isRunnable )
return false;
rl.setVisibility( 0 );
ret = true;
Log.d( "LOG", "Show" );
}
else {
rl.setVisibility( 4 );
ret = false;
Log.d( "LOG", "Hidden" );
}
//rl.invalidate();
return ret;
}
// SurfaceView Touch Event
// Show or Hide the Panel layout on SurfaceView after 3 seconds
View.OnClickListener surfaceViewListener = new View.OnClickListener() {
Handler handlerMyPanel = null;
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//Toast.makeText( myClass.this, "SurfaceView...", Toast.LENGTH_LONG ).show();
Log.d( "LOG", "SurfaceView Touch Event" );
/*
android.widget.LinearLayout rl = (android.widget.LinearLayout)findViewById( R.id.LinearLayout_MyPanel );
if( rl.getVisibility() != rl.VISIBLE )
rl.setVisibility( 0 );
else
rl.setVisibility( 4 );
//rl.invalidate();
*/
if( !ShowMyPanel(false) )
return;
if( handlerMyPanel != null ) {
Log.d( "LOG", "handlerMyPanel != null" );
handlerMyPanel.removeCallbacksAndMessages( null );
handlerMyPanel = null;
}
handlerMyPanel = new Handler();
handlerMyPanel.postDelayed( new Runnable() {
public void run() {
Log.d( "RUNNABLE", "MyPanel start" );
ShowMyPanel(true);
Log.d( "THREAD", "MyPanel finish" );
}
}, 3000
);
}
};
m_SurfaceView.setOnClickListener( surfaceViewListener );
-----
Cheers,
June
// NOTE: You have to simple layout that
// LinearLayout_MyPanel(layout_width="fill_parent", layout_height="50dp", ...) or whatever
// in order to applying below code.
// Show Panel layout on SurfaceView
private boolean ShowMyPanel(boolean isRunnable) {
Log.d( "FUNC", "ShowMyPanel()" );
boolean ret = true;
android.widget.LinearLayout rl = (android.widget.LinearLayout)findViewById( R.id.LinearLayout_MyPanel );
if( rl.getVisibility() != rl.VISIBLE ) {
if( isRunnable )
return false;
rl.setVisibility( 0 );
ret = true;
Log.d( "LOG", "Show" );
}
else {
rl.setVisibility( 4 );
ret = false;
Log.d( "LOG", "Hidden" );
}
//rl.invalidate();
return ret;
}
// SurfaceView Touch Event
// Show or Hide the Panel layout on SurfaceView after 3 seconds
View.OnClickListener surfaceViewListener = new View.OnClickListener() {
Handler handlerMyPanel = null;
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//Toast.makeText( myClass.this, "SurfaceView...", Toast.LENGTH_LONG ).show();
Log.d( "LOG", "SurfaceView Touch Event" );
/*
android.widget.LinearLayout rl = (android.widget.LinearLayout)findViewById( R.id.LinearLayout_MyPanel );
if( rl.getVisibility() != rl.VISIBLE )
rl.setVisibility( 0 );
else
rl.setVisibility( 4 );
//rl.invalidate();
*/
if( !ShowMyPanel(false) )
return;
if( handlerMyPanel != null ) {
Log.d( "LOG", "handlerMyPanel != null" );
handlerMyPanel.removeCallbacksAndMessages( null );
handlerMyPanel = null;
}
handlerMyPanel = new Handler();
handlerMyPanel.postDelayed( new Runnable() {
public void run() {
Log.d( "RUNNABLE", "MyPanel start" );
ShowMyPanel(true);
Log.d( "THREAD", "MyPanel finish" );
}
}, 3000
);
}
};
m_SurfaceView.setOnClickListener( surfaceViewListener );
-----
Cheers,
June
피드 구독하기:
글 (Atom)
