Archive for November, 2010
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: \firstname.lastname@example.org
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.
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.
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).
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.