Warning: Cannot modify header information - headers already sent by (output started at /home/twocs/news.answers.tw/wp-content/themes/i7_0950b/functions.php:7) in /home/twocs/news.answers.tw/wp-includes/feed-atom.php on line 8
General news around the Internet Just another WordPress weblog 2010-12-29T10:13:28Z http://news.answers.tw/?feed=atom WordPress Tommy http://answers.tw <![CDATA[Writing a research article]]> http://news.answers.tw/?p=483 2010-12-29T10:13:28Z 2010-12-29T10:13:28Z When writing a research article, several steps can be followed. But when I’m writing for a journal, and is it any different than writing for a university course?

For ecample, and take the following guide.


He suggests that we do a literature review first, and write up the introduction. Then we design and conduct the experiment.

This guide is for biology, not computer science, and it is for university classes, not academic publication. Nonetheless, couldn’t there be such a streamlined procedure for doing academic research?

For example, after amassing 10 articles and one to two books, I’d write a literature review and then an introduction. Then I would design and conduct an experiment, write it up, and then write a conclusion. That would be that. I think we need to try it and see how it goes. Onwards and upwards, ignore the furnaces of the paper factory.

Tommy http://answers.tw <![CDATA[Handbook of Monte Carlo Methods]]> http://news.answers.tw/?p=480 2010-12-17T02:15:24Z 2010-12-17T02:07:35Z This book is going to be published in 2011. It explains in detail the theory and practice of Monte Carlo methods. For example, it will explain how to generate billions of random numbers and ensure that the numbers are really random. For example, MATLAB uses the Mersenne Twister algorithm by default, but in fact, this method is not suitable for Monte Carlo methods because of the fact that when you get an extremely low number from this algorithm, the next number will more likely be a low number as well. So, this book will teach us how to generate the random numbers appropriate to Monte Carlo methods.

The official citation for the book is:

D.P. Kroese, T. Taimre, Z.I. Botev (2011). Handbook of Monte Carlo Methods,
Wiley Series in Probability and Statistics, John Wiley and Sons, New York.

Currently, the site contains all the MATLAB code for the book. Although we don’t have the book yet, this means that we can still work through the problems. The site is at:

The book is currently listed at $127.72, but it looks like this price is including a 12% discount already. I suppose that after the preorder is finished, the price will go up to $145. You can preorder the book at Amazon.

admin <![CDATA[Recipes]]> http://news.answers.tw/?p=478 2010-12-13T02:04:41Z 2010-12-13T02:04:41Z Lots of great recipes available: doernerrecipes.blogspot.com

Tommy http://answers.tw <![CDATA[Edu account email on Android]]> http://news.answers.tw/?p=475 2010-11-29T07:02:29Z 2010-11-29T07:01:44Z

I’ve got a Nexus One, and I want to receive my Microsoft Live@Edu account on my phone.

It should be easy to do and it is except that there’s some information that is required to do this.
The main thing is the server address. It is listed at:

Mobile Device URLs
Your mobile device URL is determined by the storage location of your Microsoft Online Services data. To connect to Microsoft Exchange Online, your cellular service plan must support Windows Mobile.

Asia Pacific (APAC) https://red003.mail.apac.microsoftonline.com
Europe, the Middle East, and Africa (EMEA) https://red002.mail.emea.microsoftonline.com
North America https://red001.mail.microsoftonline.com

Select the correct server. For Australia, that’s then red003.mail.apac.microsoftonline.com

You also need your domain\username, where domain is nothing (“”), and username is your email. So you should get something like: \email.name@flinders.edu.au
Notice that backslash. You need it. On my phone on-screen keyboard, I needed to press the numbers button to bring up the numbers on-screen keyboard, and then press the symbols button to bring up the symbols on-screen keyboard.

So open up the Email Application, open the menu with the menu button, then fill in your email address and password. The easiest thing to do is select “Manual setup” where you can then select Microsoft Exchange ActiveSync. Now it’s time to enter the details we worked out above.

Domain\Username: \email.name@flinders.edu.au
Password: ***********
Server: red003.mail.apac.microsoftonline.com

That’s it! Press Next, and iff you’re lucky, you’re now the proud owner of a Microsoft Exchange Sync account that pushes to your mobile phone. In my experience the push delivers the mail almost instantly after it’s sent, but it doesn’t drain the battery like the Twitter push.

Tommy http://answers.tw <![CDATA[MATLAB: converting rgb images into a map of indexed colors and those indexes]]> http://news.answers.tw/?p=468 2010-11-11T10:33:27Z 2010-11-11T10:20:16Z Here is a handy MATLAB function for converting a M*N*3 dimensional RGB image into an M*N dimensional array of indexes and a P*3 dimensional map. This is interesting because it’s lossless, unlike the MATLAB function rgb2ind, which has a low maximum number of colors.
function [ ind, map ] = myrgb2ind( rgb )
%MYRGB2IND Converts an RGB image into an index array and a map of colors
% make a map of all color values in rgb
% map = 3 columns, index of and the second is the color[rgb_width,rgb_height,channels] = size(rgb); % W*H*channels matrix
% don't use the rectangular shape of the image, just use one long column
[rgb_width,rgb_height,rgb_channels] = size(rgb);
index_all = reshape(rgb,rgb_width*rgb_height,rgb_channels);
% sort the image so all the colors are in order
index_all_sorted = sortrows(index_all);
% remove all colors that are duplicates
map = unique(index_all_sorted,'rows');
% assign index values of the map to each pixel position where the color occurred
% and the reshaped image is index_all;
[NULL,ind_reshaped] = ismember(index_all,map,'rows'); % ind_reshaped holds the row number of the corresponding color
ind = reshape(ind_reshaped, rgb_width,rgb_height); % reshape ind to the size of the image

And then for converting back:
function [ rgb ] = myind2rgb( ind, map )
%MYIND2RGB converts from lossless index to uint8 rgb
% determine the sizes, NULL can be ~ in 2009b and beyond
[NULL,rgb_channels] = size(map);
[rgb_width,rgb_height] = size(ind);
% reshape ind to the size of the image
ind_reshaped = reshape(ind, rgb_width, rgb_height);
% assign the colors via the index of each color in map
rgb_reshaped = map(ind_reshaped,:);
% get the picture to the right dimensions
rgb = reshape(rgb_reshaped, rgb_width, rgb_height, rgb_channels);

To test this I created the .m file program:
close all; clear all
%read in the image and show it
me_rgb = imread('../me.jpg');
%convert from rgb into an index
[me_ind, me_map] = myrgb2ind(me_rgb);
% and back again
new_rgb = myind2rgb(me_ind,me_map);
%check that the two images are the same == lossless
assert (isequal(me_rgb, new_rgb), '@ta: matrix going in doesnt equal the one coming out');
%display the outputted image

Here, the assert function demonstrates that the rgb image coming out is the same as the one going in. If you tried this with the MATLAB function for rgb2ind and ind2rgb, you will not get the two to be equal unless there are less than 65536 colors (which is the max number of colors defined for rgb2ind).

Tommy http://answers.tw <![CDATA[Parallel points cloud]]> http://news.answers.tw/?p=467 2010-11-04T22:08:56Z 2010-11-04T22:08:56Z here is a better way to thread particles than the simple fork-and-join approach of OpenMP’s parallel for. It’s very simple to divide the work to run as tasks. Using tasks provides several benefits. Once you have a tasking system set up, it’s easier to add new tasks to increase parallelism throughout the code. Also, it’s easier to load balance and be platform-agnostic. If the task scheduler manages all parallel tasks, the program will avoid oversubscription. In this example, we don’t have to wait for all the particles for a given emitter to finish before moving to the next emitter and scheduling more tasks.

Tommy http://answers.tw <![CDATA[Virtual clothing can wrinkle]]> http://news.answers.tw/?p=464 2010-10-27T20:55:27Z 2010-10-27T20:55:27Z Even the clothing of animated characters can attract wrinkles. The system works by detecting areas of a person’s shape that move or deform more than others. Then those areas are assumed to be clothing,  and with comparison to a predictive model of the underlying skeleton, the analysis concludes how the fabric moves on the body.


Tommy http://answers.tw <![CDATA[Silverlight vs. Flash]]> http://news.answers.tw/?p=459 2010-06-22T10:26:58Z 2010-06-22T10:26:58Z A handy SDK for Facebook apps: www.microsoft.com/facebooksdk

In my Master’s thesis I used Adobe Flash (AS3) and creating games is quite easy in Flash. It’s an ECMA language as is Java, so it’s easy to work with. On the other hand the backend integration is quite tricky. Adobe Flash Media Server is not free, and the universities don’t have licenses for it either. That caused me a lot of problems which were learning experiences for me, but figuring out which open source projects would work was not related to the learning goals I had been trying to achieve with my interactive educational platform. It would be much easier to use .NET development through the entire project than try to provide Bridges between different programming languages through socket programming.

Since there is already guides about ASP.NET development and Facebook, in my opinion it will be easiest to integrate Silverlight with that. Microsoft provides a number of free downloads and free licenses for university students including Visual Studio, Windows Server 2008 R2, SQL Server 2008, etc. through the official Microsoft student website www.dreamspark.com, so it’s easy for student projects to get access to their products. Also, the really interesting thing about using Silverlight for your Facebook project would be that it would also work with the new Windows Phone 7 platform that will be released later in 2010.

Tommy http://answers.tw <![CDATA[Compiling OpenCV 2.0 with Visual Studio 2010]]> http://news.answers.tw/?p=457 2010-06-19T10:24:31Z 2010-06-19T10:24:31Z I had a couple of troubles setting up OpenCV 2.0 in Microsoft Visual Studio 2010. I simply updated the working build from VS 2008. It had been working fine. So the first thing I found out that there was an error with “std::back_inserter”. The problem is that it was part of the standard package, but now it’s not. This trouble affects two files: “cvmodelest.ccp” and cvhog.cpp” so it’s easily cured by adding 

#include <iterator> 

to cv.h. somewhere around line 60.

Another problem I encountered was a crash with videoInput.lib. It seems that it’s been compiled with VS2005 and it’s source code is not included. So with a bit of research I found that it’s not exactly a necessary thing to include anyway, so I followed the instructions:


# On Windows: enabling the VideoInput library:

The libvideoInput.a library file provided by Willow Garage was built with the old SJLJ exception handling method. Therefore, you cannot link against it using compilers that use the new DWARF-2 exception handling method like MinGW 4.4.x, unless you rebuild the libvideoInput.a file using MinGW. The best bet for compilers using DWARF-2 is not to use VideoInput at all. This can be done by taking the following step:

1. Comment the line containing “#define HAVE_VIDEOINPUT 1″ (i.e. near line 101 or 105), in file src/highgui/_highgui.h.

In contrast, for old compilers using SJLJ like TDM, to have VideoInput included in OpenCV 2.0:

1. Edit file src/highgui/CMakeLists.txt
2. At line 199, insert ” ole32 oleaut32 uuid” at the end of the list of libraries to be linked against (i.e. after “videoInput strmiids”). The developers have forgotten to insert them.

Tommy http://answers.tw <![CDATA[Create new Froyo Virtual Device for Nexus One]]> http://news.answers.tw/?p=450 2010-05-29T14:32:23Z 2010-05-29T14:07:05Z  

So it’s time to start developing Android apps, but you have a Nexus One running Froyo 2.2. What are you supposed to do at the stage “Create new Android Virtual Device (AVD)”? That’s exactly the question I was tackling today. In fact it’s not too important, since you would be developing for all types of Android phones, not just Nexus One, but in principle it seems right to set up the emulator exactly for the Nexus One.

So the first thing to do when creating a new virtual device is to give it a name. I was thinking about calling mine “NexusOne” but then I thought I should add a little more detail. However, there is a restriction in the naming policy: you are only allowed to include letters and numbers, no spaces or decimal points (but yes to underscores). This means the logical name “Nexus One Froyo 2.2” is no good. Finally I settled on “Nexus_One_Froyo_2-2”. I selected Target: “Android 2.2 – API Level 8”. If you don’t have it as an option, you need to run the Android SDK updater.

Next select the size of the SD card. I put 2000 MiB.

And the skin of the Nexus One would correctly be WVGA800, which corresponds to 800 x 480 resolution. Technically it’s a slightly different since the particular screen used, but it’s effectively the WVGA800.

Next there’s a bunch of settings to add. I’ve seen some people suggest you need to add all the hardware components manually, but according to the following chart most of the stuff is there by default. (Chart is from http://www.51testing.com/?uid-49689-action-viewspace-itemid-212142)

Characteristic Description Property
Device ram size The amount of physical RAM on the device, in megabytes. Default value is “96”. hw.ramSize
Touch-screen support Whether there is a touch screen or not on the device. Default value is “yes”. hw.touchScreen
Trackball support Whether there is a trackball on the device. Default value is “yes”. hw.trackBall
Keyboard support Whether the device has a QWERTY keyboard. Default value is “yes”. hw.keyboard
DPad support Whether the device has DPad keys. Default value is “yes”. hw.dPad
GSM modem support Whether there is a GSM modem in the device. Default value is “yes”. hw.gsmModem
Camera support Whether the device has a camera. Default value is “no”. hw.camera
Maximum horizontal camera pixels Default value is “640”. hw.camera.maxHorizontalPixels
Maximum vertical camera pixels Default value is “480”. hw.camera.maxVerticalPixels
GPS support Whether there is a GPS in the device. Default value is “yes”. hw.gps
Battery support Whether the device can run on a battery. Default value is “yes”. hw.battery
Accelerometer Whether there is an accelerometer in the device. Default value is “yes”. hw.accelerometer
Audio recording support Whether the device can record audio. Default value is “yes”. hw.audioInput
Audio playback support Whether the device can play audio. Default value is “yes”. hw.audioOutput
SD Card support Whether the device supports insertion/removal of virtual SD Cards. Default value is “yes”. hw.sdCard
Cache partition support Whether we use a /cache partition on the device. Default value is “yes”. disk.cachePartition
Cache partition size Default value is “66MB”. disk.cachePartition.size

Thus according to the chart we should add “Camera” and the 5.0 megapixel camera on the Nexus One corresponds to 2592 Maximum Horizontal Camera Pixels and 1944 Maximum Vertical Camera Pixels (The exact number of pixels is a guess of mine based on the 5.0 Megapixels, but unless you’re doing some hardcore testing I think it will be fine). Set the Device RAM Size to 512 MB for the Nexus One.

Ok, that’s about it. Now click “Create AVD” and the program will appear to freeze for a while. Finally, the AVD will be created and Nexus_One_Froyo_2-2 is located in the .android\avd folder.