Tuesday, December 15, 2009

Using Outlook's After Sending rules

Found this interesting post to configure Outlook to complete the thread view. By default the thread does not show your mails. So in effect it has a lot of information missing.

Using Outlook's After Sending rules

Friday, May 8, 2009

Improve Microsoft Outlook Performance

I have been facing a big slowdown in performing any actions in MS Outlook - be it reading mails, trying to reply. Then I found that my personal mail folder was around 3.5GB and I have only 512MB of RAM on my laptop (I know its primitive) so most of time Windows was doing paging.
Then I found this brilliant article Improve Microsoft Outlook Performance on how to have more than one personal mail folders. Ever since I created a new data file, using Outlook is much less painful.

Saturday, April 25, 2009

Ways to extract data from a space delimited string

Ways to tokenize a string if you cannot use the space character as a field delimiter in an input where the fields can have spaces:

1. create the input with the delimiter as some other character as the delimiter. The delimiter character should be non-printable. This would reduce its chances of occuring in the input and thus reduce handling of special cases.

2. If the input was generated with space as the delimiter then we have a problem at hand. For such cases there are two approaches and both require the knowledge of the format of the input.

If the format of the input is known then one can use regular expressions to search for the tokens in the string. (Typical scripting languages, like Perl, TCL support regular expressions. C++ user can use the Boost library for regular expression support).

However using regular expressions can be expensive if the number of searches during the program execution are large. So these can be used only when the number of searches are small.

For programs that do such search more often, let us understand the other approach using an example:

// input format:

char* inputStr = "12 abc def 14";
char* firstSpaceChar = strchr(inputStr, ' ');
int firstInt = 0;
int lastInt = 0;
string midStr = "";
if (firstSpaceChar != NULL) {
*firstSpaceChar = '\0';
firstInt = atoi(inputStr);
char* lastSpaceChar = strrchr(firstSpaceChar+1, ' ');
if (lastSpaceChar != NULL) {
lastInt = atoi(lastSpaceChar+1);
*lastSpaceChar = '\0';
}
midStr = firstSpaceChar+1;
} else {
midStr = inputStr;
}



Friday, October 31, 2008

Tech: How to find the existence of a thread

To find if a thread created using pthread_create exists or not use phread_kill with signal number 0
on the thread that needs to be tested. If the return value is 0, then the thread is alive.
If the return value is ESRCH, then the thread is not alive in the system.

Sample code may look like:

bool is_thread_alive(pthread_t thread_id)
{
int status = pthread_kill(thread_id, 0);
if (status == ESRCH)
return true;
else
return false;
}

Tuesday, March 25, 2008

STL: find in a list of pointers

Most STL tutorials will not help you solve this problem:
How to search in a list of pointers?
e.g vector<'obj*'>myList;
The find alogrithm on this will match only the pointer address and if you do not share your objects between classes then your find will always fail as it matches only the pointer addresses and not the value to which it points.
To fix this problem, the solutions that can be considered are:
1. store objects instead of pointers in the list. (huge memory overhead!!)
2. use find_if instead of find and write a functor which compares value instead of pointer address
3. Overload find and implement your own comparator in it. This comparator again compares the value instead of pointer address.

Saturday, March 8, 2008

The basics of Technology Mapping in Digital Circuits

1. Generate the truth table of a given boolean expression
2. Represent the expression in terms of minterms
3. Convert each component into one of the cells of technology map.

Example 1:
a 8x1 multiplexer using a 2x1 mux:
8x1 --> a'b'c'I0 + a'b'cI1 +a'bc'I2 + a'bcI3 + ab'c'I4 + ab'cI5 + abc'I6 + abcI7
==> a'(b'c'I0 + b'cI1 + bc'I2 + bcI3) + a(b'c'I4 + b'cI5 + bc'I6 + bcI7)
==> a'(b'(c'I0 + cI1) + b(c'I2 + cI3)) + a(b'(c'I4 + cI5) + b(c'I6 + cI7))
==> a'(b'M1 + bM2) + a(b'M3 + bM4)
==> a'M5 + aM6
==> M7

Example 2:
AND gate using a 2x1 mux:
AB --> AB + A'0
So the mux will have A as the select line and B on select 1 and tie 0 on select 0

Example 3:
OR gate using a 2x1 mux:
A + B ==> 1(A + B)
==> (A + A')(A + B)
==> AA + AB + A'A + A'B
==> A + AB + A'B
==> A(1 + B) + A'B
==> A1 + A'B
So the mux will have A as the select line and tie 1 on select 1 and B on select 0

Wednesday, March 5, 2008

the awesome GoogleLookUp function

Got this from a ReadWriteWeb:
Try the following on a google spreadsheet
1. Create a Google Spreadsheet
2. Tape "bmw" in A2, "mercedes" in A3 and "nissan" in A4
3. Select A2:A4 and, while holdind the Ctrl key, expand your selection until A50.
4. Say "wow"
5. Tape "employees" from B2 to B50.
6. Enter "=googlelookup(A2; B2)" in C2 and expand the formula until C50
7. "wow", again
8. Take a look at other Google functions in the "Google" tab of this page: http://documents.google.com/support/spreadsheets/bin/answer.py?answer=82712&ctx=
10. "wow", again and again