Skip to main content

Posts

Showing posts from 2010

Macro to Search Typos in Microsoft Word

Most of us tend to type some funny words or break a word into multiple words which are not captured by the spell checker. Inability of the spell checker to understand the context leads to this issue. Here is a Word Macro to detect such errors which I developed while writing my PhD proposal.
Macro searches for each word in the 'terms' array and move the cursor to the first occurrence allowing you to manually edit the word(s). It doesn't correct errors as some of the words are context sensitive and depends on the position of a sentence. You can always extend the to code to deal with common mistakes like writing 'in to' instead of 'into'. After each correction you need to rerun the macro. Simplest way to rerun is to assign a shortcut key to the macro. When all the words are searched you will see a message saying "Double Check Compete...!". Feel free to add your own words to the 'terms' array.

Sub Double_Check()
'
' Double_Check Macro
&…

Response on OverSim

Thanks everyone for the encouraging words on my OverSim tutorials. I got several positive blog comments & direct e-mails. It's seems time is right for a more formal tutorial. I'll try to expand the existing topics & add new ones within next couple of weeks. Please contribute by sending sample codes & suggestions that will help all of us.

SnapIt Screen Capture

Recently I was asked to reviews a screen capture utility called SnapIt 3.7. I was bit skeptical as I was happy with screen capture feature in Microsoft OneNote. I'm happy to realize SnapIt provides much more features than OneNote. It's small & doesn't add any noticeable overhead, though I hate to add another icon to the task bar. To summarize it: supports hotkeys, auto-saving, clipboard, etc.copies screenshots to the clipboard so works with any apptracks capture history, auto-saves captured imagesauto-names captured images  can save in many formats, e.g., BMP, GIF, JPEG, PNG & TIFFIf you write a review & post it on your own blog/twitter/FB SnapIt may give you a licensed copy. So hurry up & contact Julia Taylor or visit SnapIt site.

Oversim - Key Overlay Functions

Constructor
Can be use to set message to NULL.Better not to skip defining the constructor.

Destructor
Clear/delete messages in destructor using cancelAndDelete(). New version seems to be motivating to use a destructor so better not to skip.

void initializeOverlay(int stage) Can be used to initialize the overlay node, read parameter values, set key, set statistic collectors, start timers, etc.
stage -  can be either MIN_STAGE_APP (this module is being created) or MAX_STAGE_APP (all modules were created). We typically need MIN_STAGE_APP to initialize application functions & variables.void finishOverlay()
Called when module is terminating. Can be used to summarize stat. New OverSim version seems to be motivating us to delete messages in the destructor.

void joinOverlay()
Define what to do when a node is added to system. Can be used to establish connections with successor/predecessor & identify fingers in Chord. Also indicate to the simulator that overlay is now ready.

NodeVector*…

4. DHTTestApp & DHT

DHTTestAPP & DHT work together where DHTTestAPP utilizes the DHT to store & retrieve (key, value) pairs. DHT utilize the underlying overlay to route queries.

DHTTestAPP
Is a Tier2 application that periodically issue DHT put, get, & modify queries. The implementation consist of 2 modules:
GlobalDhtTestMap - Provides a data structure & functions to maintain a global list of (key, value) pairs. Random keys are taken from this list to issue DHT get & modify queries.DHTTestApp - Issues DHT put, get, & modify queries after some delay derived from a truncnormal distribution. Put messages - Use to add a random (key, value) pair into the DHT. A put message (represented as DHTputCAPICall) consists of a random key, random value, expiration time (ttl), & whether (key, value) pair can be modified. Then the message is send to the Tier1 application using sendInternalRpcCall() method, which will store (key, value) pair in the DHT. When a successful response is received (ke…

3. KBRTestApp

After developing your own application & overlay next you should play with the KBRTestApp. KBRTestApp is a Tier1 application that tests 3 operations:
OneWayTest - Route an overlay message to a random key & measure one-way hop count & latency. When a message reaches the destination, receiver call a method in the sender to collect statistics (not over the network). A sequence number is attached to a message to prevent collecting statistics of duplicate ones. Intermediate nodes append their addresses to a message while it's being forwarded.RPCTest - Send RPC call to a random key, wait for response, & then measure one-way hop count & latency. RPC context is used to keep track of destination & whether a message should be considered for statistics.LookUpTest - Lookup a random key using RPC call & collect latency when response is received. Sends as an internal RPC (sendInternalRpcCall) between two tiers (from application to overlay) using LookupCall messages.Con…

Key Application Layer Functions

Constructor  Can be use to set message to NULL. Better not to skip defining the constructor.

Destructor Can be use to clear/delete messages using cancelAndDelete(). New version seems to be motivating to use a destructor so better not to skip.

void initializeApp(int stage)
Can be used to initialize the application, read parameters from omnet.ini file, set statistic collectors, GUI display variables, start timers, set UDP port, etc.
stage - Indicate which stage your are in. MIN_STAGE_APP indicates this module is being created while MAX_STAGE_APP indicates all modules were created. We typically need MIN_STAGE_APP to initialize application & variables. void finishApp() Called when application is terminating. Can be used to summarize stat. New version seems to be motivating us to delete messages in the destructor.

void handleTimerEvent(cMessage* msg) Handle event timer. Use to generate new periodic messages, other events, or check for lost messages. Better not to generate messages until un…

OverSim - Best/Necessary Practices

General Declare each module in a separate fileWrap simple modules through compound modules, even if there is only 1 simple module. This is where you connect in/out gates. Use IOverlay or ITier interfacesUse @class() property to tell compiler to use our own C++ definition of a simple moduleUse Define_Module() method to add a module definition class to simulationBetter not to do anything until underlay is properly initialized. Overlay may be in the initialization phase  if you want to measure bootstrap phase. Can check using underlayConfigurator->isInInitPhase() Applications Suppose our application name is myapp All applications must be stored in /src/applications/ within OverSim directory, e.g., /src/applications/myapp/Package name should be oversim.applications.myapp
Each application must be extended from BaseApp class (.ned files & C++ classes)This will add default in/out gates & parameters to the module &, also C++generic methods such as initializeApp() or deliver()Use …

2. OverSim - First Application & Overlay

OverSim has many sample applications & overlays that you can look at & understand. But, it's always better to build your own ones so you would understand things better. OverSimDevelop provides the steps necessary to build your first application & overlay. My objectives it to provide few additional details that would complete the picture.
Synopsis A node generates a ping messages & sends it to a randomly selected node. When the destination node gets the ping message, it replies with a pong message. As this process continuous messages are probabilistically dropped & statistics are collected.

Overview
MyApplication randomly selects set of overlay nodes then send a ping message to each of them using the MyOverlay. Each overlay node maintains 2 pointers, one to the successor & another to the predecessor node. Ping messages are forwarded clockwise or anticlockwise based on these 2 pointers, e.g., message from node 8 to 2 (in a network with 10 nodes) will follow the …

iPad Show Password Characters

I had the chance to play with a iPad while I was in BestBuy today. As there is no office suite, I wanted to see whether I could run Google Docs. While I was entering password, it tends to show each character that I was entering before displaying *. For example, When I type 'abc' it first showed 'a' then '*', '*b' then '**', '**c' then change to '***'. Anyway, I couldn't login as my complex password was too much for iPad. Overall, I felt Safari was bit slow on it. I love the concept & how it feels. But, the ideal hand held computer that I want is still in design. I can wait couple of more years.

1. Building P2P Simulators with OverSim - Where to Begin

This could be a series of blog posts about extending or developing your own OverSim applications & overlay networks. OverSim has a minimal tutorial on writing your own application & overlay network; however, it doesn't show the big picture. So, I'm wasting lots of time playing with code & trying to understand the rest. Good thing is, I like it more & more as I understand. You need to change/develop only a few things, but finding out which ones is a hell of a task. I hope this will not only make my life easy but also will be useful to new comers. Here's what you need to do: You need some background on OMNeT++ OverSim extend OMNeT++. But sometime it has its own way of doing things (to make your task even simple) so understand the differences.Develop several OMNeT++ simulators. TicToc is a good one to start with. Extend it as you imagine.Read Towards a Common API for Structured Peer-to-Peer Overlays, which is the basis for OvseSim's API. Here'…