There are two ways to develop software: the wrong way and the fun way.
Saturday, June 26, 2010
Android LightMeter update
It seems that at least on EVO, the light meter reading is unstable, it could vary up to two steps in the same light situation. Also without the integration sphere the reading is too directional, which could also introduce an error of 1-2 steps. Other than calibration, some sort of alternative approach is needed. I am thinking about giving a guidance EV value table to assist.
Tuesday, June 22, 2010
MacPorts selfupdate not working behind firewall?
Here is the solution:
Modify the last part of /opt/local/etc/macports/sources.conf as follows
# To get the ports tree from the master MacPorts server in California, USA use:
# rsync://rsync.macports.org/release/ports/
# To get it from the mirror in Trondheim, Norway use:
# rsync://trd.no.rsync.macports.org/release/ports/
# A current list of mirrors is available at http://trac.macports.org/wiki/Mirrors
http://www.macports.org/files/ports.tar.gz [default]
Modify the last part of /opt/local/etc/macports/sources.conf as follows
# To get the ports tree from the master MacPorts server in California, USA use:
# rsync://rsync.macports.org/release/ports/
# To get it from the mirror in Trondheim, Norway use:
# rsync://trd.no.rsync.macports.org/release/ports/
# A current list of mirrors is available at http://trac.macports.org/wiki/Mirrors
http://www.macports.org/files/ports.tar.gz [default]
Monday, June 21, 2010
Android Light Meter App
After one day of spiking, I now know that a light meter app is possible on Android (at least on EVO). I wrote an app that can display illumination value on screen. The next step will be adding an exposure value calculator to do aperture priority calculation.
Although it's kind of using the same mechanism as incident light meter, the accuracy of the light sensors on normal smart phones is probably not good enough to replace a professional incident light meter such as Sekonic ones. I haven't done a lot of testing yet but I already noticed that the accuracy is certainly not good enough for low light situations. On my HTC EVO, the accuracy below EV 6 is doubtful and it certainly can't tell anything below EV 2.
With that in mind, I still think it could be helpful for day light metering especially for those who are using mechanic film cameras without any built-in light metering.
I will keep everyone posted here.
Although it's kind of using the same mechanism as incident light meter, the accuracy of the light sensors on normal smart phones is probably not good enough to replace a professional incident light meter such as Sekonic ones. I haven't done a lot of testing yet but I already noticed that the accuracy is certainly not good enough for low light situations. On my HTC EVO, the accuracy below EV 6 is doubtful and it certainly can't tell anything below EV 2.
With that in mind, I still think it could be helpful for day light metering especially for those who are using mechanic film cameras without any built-in light metering.
I will keep everyone posted here.
Saturday, June 19, 2010
UI testing on Android 2.1 - an simple example
This tests a simple button click action that sets the text of a TextView to "1".
Several things were done in the following code to make it work 1) set focus on the button in the UIThread, 2) disable keyguard so that you can send the keyEvent
in the AndroidManifest.xml you also need to have the following code under the tag manifest
<uses-permission name="android.permission.DISABLE_KEYGUARD" />
Several things were done in the following code to make it work 1) set focus on the button in the UIThread, 2) disable keyguard so that you can send the keyEvent
public class MainWindowTest extends
ActivityInstrumentationTestCase2 {
private Instrumentation mInstrumentation;
private MainWindow mActivity;
private Button mButton;
private TextView mSensorReadView;
public MainWindowTest() {
super("com.kaipic.lightmeter", MainWindow.class);
}
protected void setUp() throws Exception {
super.setUp();
mInstrumentation = getInstrumentation();
setActivityInitialTouchMode(false);
mActivity = getActivity();
mButton = (Button) mActivity.findViewById(R.id.read_button);
mSensorReadView = (TextView) mActivity.findViewById(R.id.sensor_read_text_view);
}
public void testClickButton() {
assertEquals("", mSensorReadView.getText());
mActivity.runOnUiThread(new Runnable() {
public void run() {
mButton.requestFocus();
}
});
mInstrumentation.waitForIdleSync();
this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
assertEquals("1", mSensorReadView.getText());
}
}
...
public class MainWindow extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
disableKeyGuardForTesting();
setContentView(R.layout.main);
Button readButton = (Button) findViewById(R.id.read_button);
readButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TextView sensor_read_text_view = (TextView) findViewById(R.id.sensor_read_text_view);
sensor_read_text_view.setText("1");
}
});
}
private void disableKeyGuardForTesting() {
KeyguardManager keyGuardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
keyGuardManager.newKeyguardLock("com.kaipic.lightmeter.MainWindow").disableKeyguard();
}
}
in the AndroidManifest.xml you also need to have the following code under the tag manifest
<uses-permission name="android.permission.DISABLE_KEYGUARD" />
Tuesday, June 15, 2010
Email productivity trick - display the "important" Emails on the top
Gmail has a multi-inbox feature in the lab (you can enable it in settings-lab and then go to settings-multiinbox to configure).
With this feature you can setup your own search query to display Emails in groups in the inbox.
For example, in my inbox now, I display the unread, non-spam and non-project-team-group Emails in the top pane, all the unread project-team-group Email in the second pane, and then everything else in the bottom pane.
This way, all the "importantly" Emails will mostly likely always show up on the top.
Here is the query string I am using if you are interested:
pane 0: -label:project_name in:inbox is:unread -subject:([All ThoughtWorks]) -subject:([spam])
pane 1: label:project_name is:unread
"project_name" is the label I am using for my project-team-group emails. I have filter that automatically apply that label to Emails sent to that group.
I hope this helps.
With this feature you can setup your own search query to display Emails in groups in the inbox.
For example, in my inbox now, I display the unread, non-spam and non-project-team-group Emails in the top pane, all the unread project-team-group Email in the second pane, and then everything else in the bottom pane.
This way, all the "importantly" Emails will mostly likely always show up on the top.
Here is the query string I am using if you are interested:
pane 0: -label:project_name in:inbox is:unread -subject:([All ThoughtWorks]) -subject:([spam])
pane 1: label:project_name is:unread
"project_name" is the label I am using for my project-team-group emails. I have filter that automatically apply that label to Emails sent to that group.
I hope this helps.
Thursday, June 10, 2010
The concept of contributing
Every developer should work in a self-governed open source project team for at least 3 months to understand the concept of contributing, which has the following two sides:
- Ownership: in an self-governed open source project, every team member share the ownership of the whole project. If you want a new feature, you shall be able to add/modify any code any where to implement that without impacting other features.
- Accountability: You are responsible to make sure every piece of the code you are going to commit is readable, tested. Because other people could work on your code, or has code change that might impact your code at any time.
Subscribe to:
Posts (Atom)