Site hosted by Angelfire.com: Build your free website today!

Administrator's Request:

Till date we have received 239 Subscription confirmations out of the 294 odd posts (Current). From MSF#15 no more Posts to the Non Subscribers will be sent. To save our time and effort please send in ur Subscriptions at the Earliest. All those who have already sent the Subscriptions should also send the Confirmations. The inconvenience (!?!) caused is Regretted.

GAG- BAG

TechnicalZone

DevSeries

Techies

NEW Programmers Section

What is MSF all about?

As is evident from the Mails received most of the subscribers' fall in the "Software Developers Category". So we are starting a column in this MSF which will contain some useful and Technical Information for the Developers.

Kindly send in Mails indicating the intents to receive such articles (Others WILL NOT receive any such articles). In these mails please send in ur main Interest Language/Environment to Help us categorize this Section further.

 

Friends here is the 14th MSF (Most Selected Forwards):


MSF#14


Poland Air Disaster

Poland's Worst Air Disaster occurred today when a small two-seater Cessna 152 plane crashed into a cemetery early this afternoon in central Poland.

Polish search and rescue workers have recovered 384 bodies so far and expect that number to climb as digging continues into the evening.

Arguments

A man was celebrating his 80th birthday and his 50th wedding anniversary. A reporter asked, "Sir, how do you account for looking so fit?"

"Well," the old-timer told him, "when we got married, my wife and I made an agreement that any time we saw an argument coming on, I would grab my hat and walk three times around the block. You'd be surprised what 50 years of outdoor exercise will do for your health!"

Scientists versus God

One day a group of scientists got together and decided that man had come a long way and no longer needed God. So they picked one scientist to go and tell Him that they were done with Him.

The scientist walked up to God and said, "God, we've decided that we no longer need you. We're to the point that we can clone people and do many miraculous things, so why don't you just go on and get lost."

God listened very patiently and kindly to the man and after the scientist was done talking, God said, "Very well, how about this, let's say we have a man making contest."

To which the scientist replied, "OK, great!"

But God added, "Now, we're going to do this just like I did back in the old days with Adam."

The scientist said, "Sure, no problem" and bent down and grabbed himself a handful of dirt.

God just looked at him and said, "No, no, no. You go get your own dirt!"

Magic Mirror

A blonde, a brunette, and a red head all went to an antiques store and saw a mirror.

The lady working at the store said, "This is a magic mirror, you must say something true and if it's true you can make a wish and it will come true. If it's not true you will disappear."

The blonde, red head, and brunette bought the mirror and brought it home with them.

First the red head walked up to the mirror and said, "I think I'm the most beautiful girl in the world."

Poof, she vanished.

Then the brunette walked up to the mirror and said, "I think I'm the smartest girl in the world."

Poof, she disappeared.

Then the blonde walked up to the mirror and said, "I think...."

Then Poof, she disappeared.

 

~~~ I think the boat was "Best Actor" ~~~

Things I learned from seeing "Titanic"

* A music score of ten notes will win an Academy Award.

* People will pay to see a movie about a boat that left dock once.

* You can actually win a transatlantic boat ticket in a bar card game without getting killed.

* No one thinks anything less of you if you wear the same clothes throughout the entire movie.

* Just about anyone can do a bad Italian accent and get away with it.

* If you really love each other you can run anywhere on a ship and not get caught.

* How to spit.

* That you can hang off the railings of a ship and not get caught.

* That you have to be wheel-chaired around deck but still can manage to hang off the rails and not get caught.

* That the guy who played Dr. M'Benga from Bewitched is still around.

* That History is not as important as a chick-flick story.

* Looking young and straight teeth are good substitutes for quality acting.

* A sinking ship will throw off your aim while firing a .45 at point blank range.

 

* Titanic morals:

  1. Gamble
  2. cheat on your husband
  3. pose nude for pictures
  4. premarital sex is OK if you're infatuated
  5. let undesirables drown.

 

From Admin’s Mouth:

I had liked Titanic very much, but after READING above thingees...

...I think I still like it !!!

 

 

U.S. finds malicious code changes in Y2K "fixes"

Malicious changes to computer code under the guise of Year 2000 software fixes have begun to surface in some U.S. work undertaken by foreign contractors, the top U.S. cybercop said yesterday. "We have some indications that this is happening" in a possible foreshadowing of economic and security headaches stemming from Y2K fixes, Michael Vatis of the Federal Bureau of Investigation told Reuters. Vatis heads the interagency National Infrastructure Protection Center (NIPC), responsible for detecting and deterring cyberattacks on networks that drive U.S. finance, transport, telecommunications, and other vital sectors. A Central Intelligence Agency officer assigned to the NIPC said recently that India and Israel appeared to be the "most likely sources of malicious remediation" of U.S. software.

http://news.cnet.com/news/0-1009-200-428804.html?dd.wf..1004.05

 

From Admin’s Mouth: That’s really very Nice to hear, A Tit for Tat !?!

 


NEWGAG-Bag 

 

Geeky: If nothing ever sticks to TEFLON, how do they make TEFLON stick to the pan?

Please send in ur answers to msfca@hotmail.com with Subject as "GAG-BAG" (Exactly and nothing else)

 

Answers to Previous GAG Bags:

Geeky: "I went to a job interview the other day, the guy asked if I had any questions.  I said yes, just one, if you're in a car traveling at the speed of light and you turn your headlights on, does anything happen?  He said he couldn't answer that. I told him sorry, but I couldn't work for him then."

Freeky: (Sender: Sangeetha <sangeetha@wipsys.soft.net>)

* You wake up with a start !
(You only be dreaming - travelling in a car at the speed of light !!!)

Cheeky: (Sender: NONE)

Techie: (Sender: NONE)


Technical Zone

  

NEW In this Series the First Article that we are covering is:

DevSeries File Compression

TOC

What Compression is? (MSF#12)
Code Table Optimizations (MSF#13)

Huffman Encoding (Current Issue)
LZW
RLE
Arithmetic

 

Three of Seven…

 

III) Huffman Compression

A) Encoding Using Huffman

Huffman compression is very much an extension of the previous algorithm, as it has a dynamic code table.. Only the interesting part about huffman is that each character is not necessarily 6-bits or 7-bits.. The more frequently the symbol occurs, the SHORTER it's code is.. Here's an example, take the phrase "The ends justifies the mends.", there is:

Symbol

e

s

t

n

h

i

m

f

u

j

d

Weight

5

4

3

2

2

2

1

1

1

1

1

As you can see, it would be advantageous to make the most used symbol 'e' the shortest adapted code, and 'd' the (one of) least used symbol the longest. But how do I generate this translation table.. Well that in its self is more complicated than the algorithm so here I go (bare with my bad explanations):

First we generate a tree that looks like (I will explain how to do it later on):

0 e5 s4 t3 n2 h2 i2 m1 f1 u1 j1 d1
/ \
1 t3 s4 e5 n2 h2 i2 m1 f1 u1 j1 d1
/ \ / \
2 t3 s4 e5 n2 h2 i2 m1 f1 u1 j1 d1
/ \ / \ / \
3 s4 t3 n2 h2 i2 m1 f1 u1 j1 d1
/ \ / \ / \
4 h2 i2 m1 f1 u1 j1 d1
/ \
5 f1 u1

This binary tree is the basis for the encoding process. In order to create, I cut each node (or sublist) in half trying to keep the sums of the coefficients (in h2, 2 is the coefficient) as EQUAL as possible. If I could not get them equal, you then make the LEFT side have the larger count. The lower the differences between the sub nodes (or the 2 splits) the BETTER the tree. But now I hear you asking, what good does the lousy tree do? Well it allows of to generate the code translation table. The table generated looks like this (Again, I will explain this afterwards):

Symbol

e

s

t

n

h

i

m

d

u

j

f

Weight

5

4

3

2

2

2

1

1

1

1

1

Code

10

111

110

011

0101

0100

0011

0000

0011

00100

00101

In this code tree you'll notice that the Letters with the higher weight (or occurrence) also have the shorter code.. Interesting huh? To generate the table, I simply looked at the letter F. I went to line #1 (we really don't use line 0), I looked for F. It was on the right side(anything on the right side gets a zero, and anything on the left gets a 1) so I wrote 0 for bit #1. Next I looked for F on line #2, it was on the right side again so I wrote another 0 for bit #2. I again looked on line #3 for an F, this time it was on the left side so I wrote down a 1 for bit #3, and so on until I hit the last line. I came up with "00101"..

The last step to our final output is to substitute our Letter with our new shorthand (note that I did not count the spaces as letters so they will be ignored during the encoding process). We get: 1100101101001100001110001001001111100100001010100101111100101100011100110000111. This is 79bits our original was 24 bytes or 192bits so we got 59% compression (meaning we lost 59%), not bad! But don't forget to save the shorthand table to the output file too!

But why couldn't you just make up random codes..? You can't just make up any code you like. For instance if you set a to 01 and b to 0101 (2 random #'s you made up) and you tried to encode bab -> 0101010101.. Well, where are the breaks? It looks like aaaaa to the decoder but really WAS bab.. This is why we use these trees to generate the output code.

B) Decoding using Huffman

To decode our beautiful little binary sequence, we look at the encoding table (that we saved to our output file) again, but we rewrite it: (Filling in an X to make each 5 long)

Symbol

e

s

t

n

h

i

m

d

u

j

f

Code

10xxx

111xx

110xx

011xx

0101x

0100x

0011x

0000x

0011x

00100

00101

Then to decode we simply look at the first couple of bits and set our counter to 1: 1100101101001100001110001001...etc.. , now what symbol matches the first 5 bits 11001? T does with 110xx. So our first letter is "T" then we increment the counter by 3 since T only had 3 DEFINED bits (counter=4 now), now we read the 5 bits starting with bit #4 (since counter=4) (we do this because each symbol is not fixed) so we get 01011.. The symbol that matches this is H with 0101x.. So now we have "TH", so we increment our counter again by 4 (since H has 4 defined bits, Counter=8). We again read 5bits starting with Counter and get 10100. Symbol E matches this with 10xxx so now we have "THE" and we increment the counter by 2(counter=10), and so on until we recover the original string which was "The ends justifies the mends" (it is not a typo!)

C) Optimizations for your code:

Looking at this algorithm, you'll notice that if you play the decoding process word for word, it could be quite slow.. So here is an optimization you can make.. Create an array from 00000b to 11111b (2^5 or 32 entries) and then pre-match those numbers with the letter so you get something like 32 bytes for: "DDJ....." and then All you have to do is read the five bit #, saying it was 00001b, so you read entry #2 (a D, also it is #2 since 00000b would be the FIRST #) and simply write that to the stream . This will save a lot of time in bit shifts.

As for compression, it is straightforward, 2 passes(1st pass to count the # of occurrences of each letter, and the 2nd to encode). After the first pass you calculate the tree (I will get some code to show you later), then you proceed to pass 2, and substitute the characters for the shorthand..

Also you must note, that if all the symbols occur about the same amount of times, it is best NOT to use huffman and to use something like code table optimizations(yuck). Once you have analyzed your files simply:

Q=log (total # symbols)/ log 2
and set R to equal the total # of bits required for huffman (remember to add the size of the data tables). This can be derived by simply looking at each letter. Say there were 21-A's and it's shorthand became 11.. Then we do 21*2=42, and keep on adding on to the counter to get the total bits for the entire file. If Q<R then use Code Table, is Q>R then use Huffman! (Also be sure to store in your output which algorithm you used)

D) Example Code

Huffman Encoding Example


 

IV) LZW(Lempel Ziv Welch)

(To Be Continued…)


NEW Programmers' Section

If u're EXPERT! in VB (though Non Experts also may TRY it out), try to send me the

VB Equivalent of the Union (in C). (Not the Variant data type but I wan't User Defined Type(UDT))

The best Solution will get published in this Weekly with a special Thanks Note. Please send your personal details (U Know what relevant to send) with this Code. Mail ur Code to msfca@hotmail.com with Subject as "Participation Code" (Exactly, without the quotes, silly)

 


Techies

(For Generally whole of the Public! Especially the VB FANS ;-)) )

Techies: Scanning for Words in a String

I am currently writing an application to scan a text file for certain text keywords, and then copy the text (in between the kewords) into a new text file. Could you please provide me with any tips/code/examples in order to do this optimally?

You might want to try reading the whole file into a big string, and then using the InStr function to look for particular keywords. Do you have a particular beginning keyword and an ending keyword? If so, you can use InStr to find the first keyword and the last keyword. Each will give you a position number, as in this example:

Dim iStart as Long
Dim iEnd as Long
Dim sSubString as string

iStart = InStr(BigString, "Keyword_1")
iEnd = InStr(BigString, "Keyword_2")

Then, you use the string manipulation functions, such as Mid$, to pull out the text between the two positions.

sSubString = Mid$(BigString, iStart, Len(BigString) - iEnd)

For instance, if your strings were as follows:

BigString: "This is a very long string."
Keyword_1: "is"
Keyword_2: "long"

iStart would equal 6, and iEnd would equal 16. sSubString would equal "is a very ". InStr is a very efficient function for dealing with long strings, so I'd give it a try.

 

Techies- Parsing Strings

I want to find the value of a string containing operators, like "sqr(1000 ^2 - 734 ^2)". How can I do that with visual basic?

There aren't any built in functions to do this, unfortunately. You can read the string manually with the various string operators. However, this could become quite tricky, based on how complex your equations can get. Not only would you have to parse out the string into its various components, but you'd also have to write substantial code to evaluate the expressions properly as well as in the proper order. You may want to check http://www.xmission.com/~imagicom for a list of available libraries which may be able to help you out.


Request from the Administrator

Whenever and wherever mentioned "the Subject in the Mail should have…", please adhere to the Exact wordings (Try Copying and Pasting). This is very important as we have configured the mailing system to transfer these specific mails to some folders and as there are 50+ mails arriving each day, the relevant mail may get lost

Compulsion or Choice:

Also, those of you (I’ve received only one Complaint from a LOTUS Notes Mailing system User) have been not receiving the MSFs in proper format (All mails in HTML format should appear as a Web Page and not with the HTML Syntax's) please check in your Mailing Systems to receive and send mails in HTML Format instead of Test Only format. Those , who cannot do this either through compulsion or by choice please go a step further and copy all the contents of the mail starting from <HTML> tag to the </HTML> tag and paste into the Notepad. Save the File with the extension: html. Close the Notepad file and Open this Recently created html file by double-clicking and bingo! u r in touch with us

Again thanx and …

Vikas Gupta

vikasjee@hotmail.com

 


What is MSF all about?

Hello friends,

It seems that some "New" Friends don't know about MSF !

"Ye MSF nahi jaanta...!" as said in One of the Indian (Hindi) Advt.

So Lets break the impasse...

MSF is a Free Weekly Mail containing the Jokes, "Interesting Thingees" as it is called. Its basically an Abbreviation of "Most Selected Forwards". B'coz nowadays all the Internet-ians (i suppose that's what we're called !) forward the mails b'coz its so time consuming to write personal mails to friends (so as to keep in contact and above all to indicate they they're still live and kicking). I think all of u will agree with me in that (though one of my closest friend don't agree to it, but i know that exceptions are always there, and she is an exception, that's why she is 'so' close!).

With the 11th MSF we started with a new Section For the Techies, by the Techies, containing the Technical Information of one of the most popular languages of our times (!?!) Visual Basic (Those who differ in opinion may be considered an exception and as said above, Exceptions are always ...). Though this Techies Section will not only be VB infested b'coz it depends upon the contributors to this Weekly what good to send...

So Keep forwarding mails so as to include in one of the Editions of MSF...

To become a registered contributor to MSF please send an EMPTY MAIL with Subject as "Contributor" without Quotes. The benefits of becoming the Registered Contributor will be evident in the due course of time !!! Rules, as everywhere, do strictly apply !

To become a regular subscriber to each MSF send an Empty mail with Subject as "Subscribe" without Quotes

Mail to: msfca@hotmail.com

Thanks

Bye for now,

Vikas Gupta

Email: vikasjee@hotmail.com

Web: http://go.to/CyberA