Archive

Archive for the ‘KnowWhat’ Category

Symmetric Sigmoid

May 14th, 2011 No comments
When unknown signed intervals are expected to be normalized to -1 to +1, a symmetric sigmoid function could prove very useful.  A Symmetric Sigmoid function is a modified version of the Sigmoid function by stretching it across the Y axis.  As per wikipedia, it is defined as a symmetric function is a special case of logistic function whose plot appears like a ‘S’ with the Y-axis intercept as 0.5 and min/max as 0/1 respectively.

The function definition for a sigmoid is:

In programming languages the implementation should be in order to overcome the numerical overflow and underflow issues:

if ( t < 0 )
    exp( t ) / ( 1.0 + ::exp( t ) )
else
    1.0 / ( 1.0 + ::exp( -t ) )

 

 

 

 

 

 

 

 

 

 

 

 

In the plot, if the curve is stretched in Y-axis to make the Y-intercept at 0.0, the lower bound would get stretched to -1.0.
The function definition for a symmetric sigmoid is:
P symmetric (t) = 2.0 * P(t) – 1.0

The function can also be defined in terms of hyperbolic tangent as:
P symmetric (t) = tanh(t)

With sigmoid functions, it becomes possible to normalize any range in [-∞, +∞] onto [-1.0, +1.0].

Oil Cooler Assembly for Royal Enfield Thunderbird 350 AVL

May 9th, 2011 No comments
The performance of a IC engine is directly dependent on the difference between the ambient temperature and the exhaust temperature.  If you had learned about IC engines, it is apparent that the power generated is proportional to the temperature difference between the inlet and the outlet feed for the engine.  So, it is critical to operate the engine under low temperature such that maximum power is generated by the engine.  To keep the engine cool, engine oil is used, which also serves as the lubricant for the moving parts.  Engine oil is the blood for an engine and it’s circulation is crucial for maintaining the temperature and low frictional loses.  There is no oil cooler assembly for TB, or for that matter any RE bikes in India. 

Chinmay Dhangre from Pune generously offered to supply a modified oil cooler.  I was excited to read a blog post by Chinmay at http://www.indiancarsbikes.in/automotive-technology/royal-enfield-avl-engine-oil-cooler-update-real-world-data-4175/. When I contacted Chinmay at macasp@gmail.com, he was readily helping me to get the necessary fitments and hardware.

The reason for keep the inlet at a higher position than the outlet is to ensure that some oil is pre-stored in the oil cooler compartment all the time.  When the engine is started, it takes >10 seconds for the oil to reach the rocker, tappet assembly through the Y pipe.  If I had put the oil cooler in the middle, it would take more time to fill the oil cooler and then reach the rocker assembly.  Having this inverted connection helps the oil start its circulation faster.

The oil cooler assembly and the Y pipes are connect via a nylon coated reinforced rubber tube.  While fitting so, care should be taken for keep the pipes away from the silencer tube.  Also, it is to be ensured the the joints don’t leak after they are secured by clamps.  In the above picture, one clamp is missing!

I had used one clamp to offset the nylon pipe from the silencer tube.  I will have to use some other method for this offseting, as I am indeed wasting a good clamp!

While draining the oil during oil replacement, one has to take care of removing the oil in the oil-cooler compartment by opening the bottom vent.  Otherwise, sludge can start to accumulate inside the oil cooler assembly, which could eventually block the oil flow later.  So, it should be practice that the oil cooler assembly is cleaned every time the engine is serviced.

The completed bike is able to keep the engine oil temperature lower by allowing the natural air flow cooling off the oil through the oil-cooler fins.  Do mind that while the bike is stationery, the oil cooler cannot provide any help as it needs air flow for cooling.

Windows Server 2008 R2 Itatic font problem

May 5th, 2011 1 comment
    While doing some automatic windows updates, the default font for Windows 2008 R2 Server changed to Italics.  After getting perplexed about this problem and few hours of Internet searching, the solution was found at http://www.techsupportforum.com/forums/f217/problem-with-italic-fonts-everywhere-arial-233328.html.  Basically, it recommended a registry fix (see below), which seemed working perfectly. The replacement font prescribed in the registry fix sounded weird to me, so checked the name in http://en.wikipedia.org/wiki/Segoe and found that it belongs to the Sans-serif font category.
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
"MS Shell Dlg 2"="Segoe UI"
"MS Shell Dlg"="Segoe UI"
"Helv"="Segoe UI"
"MS Sans Serif 8,10,12,14,18,24"="Segoe UI"
"MS Serif 8,10,12,14,18,24"="Segoe UI"
"MS Sans Serif"="Segoe UI"
"System"="Segoe UI"
"Microsoft Sans Serif"="Segoe UI"
"Tahoma"="Segoe UI"
"MS Serif"="Segoe UI"
"Times New Roman"="Segoe UI"
"Times"="Segoe UI"
"Small Fonts"="Segoe UI"
"Tms Rmn"="Segoe UI"
"Arial"="Segoe UI"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
"Arial (TrueType)"="segoeui.ttf"
"Arial Italic (TrueType)"="segoeuii.ttf"
"Arial Bold (TrueType)"="segoeuib.ttf"
"Arial Bold Italic (TrueType)"="segoeuiz.ttf"
"Times New Roman (TrueType)"="segoeui.ttf"
"Times New Roman Italic (TrueType)"="segoeuii.ttf"
"Times New Roman Bold (TrueType)"="segoeuib.ttf"
"Times New Roman Bold Italic (TrueType)"="segoeuiz.ttf"
"Tahoma (TrueType)"="segoeui.ttf"
"Tahoma Bold (TrueType)"="segoeuib.ttf"
"Microsoft Sans Serif (TrueType)"="segoeui.ttf"
"MS Sans Serif 8,10,12,14,18,24 (VGA res)"="segoeui.ttf"
"MS Serif 8,10,12,14,18,24 (VGA res)"="segoeui.ttf"

[HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\Shell\MuiCache]
"@themeui.dll,-2037"="{Segoe UI, 8 pt}"
"@themeui.dll,-2038"="{Segoe UI, 8 pt}"
"@themeui.dll,-2039"="{Segoe UI, 8 pt}"
"@themeui.dll,-2040"="{Segoe UI, 8 pt}"
"@themeui.dll,-2041"="{Segoe UI, 8 pt}"
"@themeui.dll,-2042"="{Segoe UI, 8 pt}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontMapper\FamilyDefaults]
"Swiss"="Segoe UI"
"Roman"="Segoe UI"

HT12E & HT12D Rosc values

May 1st, 2011 No comments

Choosing a appropriate value of ROSC is critical for the functioning of HT12E and HT12D pair during Muxing and DeMuxing.  The following are the value pairs that are found to be working correctly at 5V power supply for both the ICs.  Although, they support variety of voltages, it is always better to keep them at the same voltage to avoid confusion on the internal oscillator frequency.  If the data sheet is seen, it becomes apparent that the internal oscillator frequency is function of (Vdd, Rosc).

HT12E ROSC HT12D ROSC
1M 47K
1.1M 51K
750K 33K

Modern wet grinder

May 1st, 2011 No comments

image

When I went to Kanchipuram to visit Ekambareswarar, I came across this shop where I’d stopped by to have some tea.  Though the tea tasted like neemcake soaked in hot water, I was intrigued to find that the gentleman in picture was preparing rice batter in a machine, that is typically used for dry grinding.  During my schooling days, I had been to flour mills several times to grind rice, wheat, chilly powder, etc.  There I used to observe how those grinding machines indeed work to grind the items quickly.

Not withstanding my curiousity, I went and asked the gentleman about the machine that he was using to make rice batter.  He said, such machines are available in use for quite some time, about 8 years.  But I have never seen this type of wet grinder before.  He said, these machines are quick and can produce batter that is very fine, unlike the traditional stone type wet grinders.  With him permission, I clicked this photo.

For the uneducated people, here is how the dry grinder work.  The machine’s main component is a pair of gear like perforated steel plates, where one is rotated by a heavy 3 phase motor and the other is stationary.  The plates operate very much like a clutch plate in an automobile.  The distance between the plates is controlled by a wheel.  Upon rotating it clockwise, the stationary plate gets closer to the rotating plate and vice versa.  The material to be ground, is feed through these plates where they are broken into smaller pieces.  Upon 2-3 iteration of grinding, the material can be ground to whatever finer requirement is by keeping the plates closer to each other.

Although, the above wet grinder is quick and capable of finer batter, I am wondering how it should be cleaner.  The process to be messy unlike the easy cleaning process of the stoned wet grinder.  May be, that’s the reason for the unpopularity of this wonderful machinery!

First Application using MongoDB & PHP

March 6th, 2011 No comments
I have been eyeing on MongoDB since I had visited IIIT Hyderabad for campus placements in Jan 2011.  The name MongoDB was introduced to me by the candidates whom I had to interview.  Infact all the candidates who took the interview had worked on MongoDB for solving some problem during their graduate studies.   MongoDB, the name comes from HuMongous DataBase, which is a well instituted name and the database indeed is meant for storing tonnes of data organized in JSON format.   Being a C++ coder, I had less experience with JSON and have always avoided that as it was primarily used in the Web application development.  After learning about Mongo in the official wiki, I got thrilled by the simplicity of JSON format and the advantage of it over the conventional XML format and infact decided to use JSON for a project that my team is working on.
MongoDB is written in C++, which increased my love towards the database.  I wanted to use MongoDB for my product development data store needs, but was stuck with the dependencies of Mongo’s C++ driver, where it wanted Boost libraries to be linked.  The pathetic problem is boost does not compile with the debug version of STLport.  My product is built on STLport, so I have to link MongoDB with Boost/STLport, which works well in release mode, but not in DEBUG mode.  How Sad!
My desperation grew as I wanted to have some useful application developed using MongoDB.  PHP came for my rescue. The PHP driver that was available with MongoDB is a cute baby.   I works like moon walk, when copy pasted on the PHP’s extension folder.   The documentation of PHP/MongoDB is well written and has lot of examples.  Also, there is awesome support available in the internet for all the doubts that I got while building my Brower based Photo SlideShow web application.  All, I did was, I pushed all my JPEG files into MongoDB and wrote simple PHP scripts to fetch the files based on the file name.  When the file name was not mentioned, my script would pick a file randomly.  I have presented the code below:
# view.php

# get the file id
$id = "";
if ( array_key_exists( "id", $_REQUEST ) ) {
    $id = $_REQUEST["id"];
}

# open database connectivity
$conn = new Mongo();
$store = $conn->store;
$image = $store->image;

# fetch the file as per the id or just randomly
if ( $id != "" ) {
    $query = array ( 'id' => $id );
    $cursor = $image->find( $query );
}
else {
    # set the html headers for refreshing the page every 3 sec.
    header( 'Refresh: 3;' );

    # Random fetch logic, get the count first.
    $count = $image->find()->count();
    $rand = rand( 1, $count-1 );  # generate a random number.
    # skip several records of the cursor based on the random number
    $cursor = $image->find()->skip( $rand )->limit(1);
}

# write output stream as JPEG content
header( 'Content-Type: image/jpeg' );
foreach ( $cursor as $obj ) {
    # decode the data, and just write on the output stream.
    echo base64_decode($obj["data"]);
}

# import.php

$dir = $_REQUEST["dir"];
if ( $dir == "" ) {
    echo "<h2>Import directory cannot be empty</h2>";
    exit;
}

$conn = new Mongo();
$db = $conn->store;
$image = $db->image;

echo "<ol>";
$dhandle = opendir( $dir );
while ( ($file = readdir( $dhandle )) != false ) {
    $path = $dir."/".$file;
    if ( is_dir( $path ) ) {
        continue;
    }

    $path = str_replace( '\\', '/', $path );
    $handle = fopen( $path, "rb" );
    $data = fread( $handle, filesize( $path ) );
    fclose( $handle );
    if ( $data == false ) {
	continue;
    }

    $key = preg_replace( "/[[:punct:]]/", "_", $file );
    echo "<li>Importing $path (Key: $key)...";
    try {
        $image->insert( array( "id" => $key,
               "data" => base64_encode( $data ) ), true );
        echo "Success";
    }
    catch ( MongoCursorException $e ) {
        echo "Exception: $e";
    }

    echo "</li>";
    ob_flush();
}

echo "</ol>";

Within minutes, I was able to have a browser based slide show application, which protected all my image files in the Database without being exposed out in the folder system.

I am enjoying every bit of Mongo, and hope to develop several application using that in the future.

Know the Social Network that’s spun around you

December 20th, 2010 No comments
Social Networks have become a buzz in the contemporary world.  Most of us use them without understanding what they are and what they could do.  Basically, social networks are a platform the enable friends and family to be touch.  A good deal eh? Yes, it started just like that.  It started as a proxy for a pubs, playgrounds, parties where friends hang around.  Instead of going  for meeting a person, these social networks enabled friends to be in touch over instant messaging, blogging, scribbling, sharing pictures and videos by making use of the Internet technology.  This is definitely good, so far.  Do you know what else these social networks could do to you?  Let’s see some possibilities for an arbitrary ‘X’ whom you never know who that is:-
  1. Find your friends.  If you are little dumb, one can easily find your crush, hated ones, and what not.
  2. Find your likes and dislikes based on your messages, scribblings
  3. Know your places of interest based on what you have written about places, pointers on meeting spots that you chose to meet your friends, etc.
  4. Potentially know your neighborhood, by going through your blogs of scribblings about your neighbors or happenings in your vicinity.
  5. Find out what food you eat, and what you are allergic to.
  6. Find out what type of network connection you have, based on your connectivity logs.
  7. Find out paths from friends-of-friends for connecting an arbitrary person to you through your contacts.
  8. Find out which communities you belong to, and hence your social and professional networks
  9. Find out where you work, what your hobbies are.
  10. Find out where you studied, what you studied, what you aspire and where you are heading to; based on your professional community memberships, activity in forums, answers queries, etc.
  11. Find who you would meet, when and where based on your conversations
  12. Find out your mood swings, based on the vocabulary of your conversations
  13. Find out your pictures, and the pictures of the related ones in family and profession.
Remember something, whatever is meant to be private is never private in Social networks or any other electronic 3rd party services for that matter.  I have listed a very brief potential possibilities.  Please use these platform with fullest caution.

One side of the Internet researchers are working on “Internet Anonymization”, an idea to protect one’s identity; on the other hand, Internet giants are pushing “Social Networks” where they build intelligence on the so-called privacy of people.  What a weird world !?!

Powered by ScribeFire.

Tamil Steganography

December 3rd, 2010 No comments

A nice discussion on Tamil steganography that is worth sharing.. :)

Udayasankar said:

Came via shakty’s blog, interesting note on tamil and cryptography.  would like to know of any specific instances where a cryptic text and associated decipher key is available in Tamil. Are there known historical incidents in Tamil History where a use of cryptographic keys and texts are available, say similar to English Queen Mary’s use of cipher text which indirectly led to her execution. Or the Caesar cipher for instance. Any incidents you can point out.

Sudarshan, as in your comments on the blog, I am aware that the siddhas and mystics used indirect language and metaphors to express themselves to their select cliques, but then that does not amount to more than children making up their own dialects to bypass their elders.  could you point out any place where a real mathematical technique is used? for instance are there kalvettukkal or temple inscriptions which are in code?

I was wondering if the tamil language did indeed have a crypto concept that has mathematical backing as sakthy seemed to imply on his blog.  From what he wrote I took it to mean that this was a possibility rather than an established practice. However, the need to hide data is a universal impulse and i wondered if indian science and math did have some background in this. as to why specifically tamil, I will explain in a later mail. i am already aware that the mystics both Tamil and others, (much like the scientists of the eighteenth and earlier centuries.  Leornado, Newton, Leibnitz) coded their discoveries in cryptic text.

My response is:

i am not of an opinion that tamil were doing mathematical modeling on things that they practiced naturally like breathing.  the concept of mathematical modeling and theoretical proofs are the ideas of the west. if i am correct, our forefathers were men of practice, primarily based on observation sciences.   people observed the neighborhood carefully and identified interesting patterns. and these patterns are then connected to suitable inferences that were derived based on more observation and tuning..  if i have equate that to the current technology, the word is “statistical machine learning” without the approximations and model fitting.

i strongly believe that our men had insights which are passed on to their students as experiences on insights instead of mathematically explaining their insight like the west did.  our men had methods to conceive and transmit ideas without words (ex: bhagavath geetha 800 stanzas transmitted from the krishna “character” to the arjunan “character”).  our men understood non-linear time that exists, unlike the linear time definition of the west.  our men believed and practiced thought process instead of scripts.

ofcourse encryption was used heavily in the past, just in term of metaphors, symbols.  our guys did not work at the character by character level, instead at the context and semantics level.  anything that is semantic is difficult to model because of the heavy polysemous tamil language.

Tobacco Helps!

October 25th, 2010 No comments
There is very nice use for tobacco even for the non-smokers!  Most of the LMV, MMV, HMV drivers would know about this  trick, so I am just documenting a world’s secret. 

If you had driven your car on high ways on a rainy day, despite having a nice wiper, you might have had severe problems with water staying on the wind shield glasses.  When the windshield gets wet, water stays there for long to deplete the clarity of driver’s vision on the roads.  If it is night and raining, highways and high beam lamps, you would know how bad it feels to drive.

This is where Tobacco comes for help.  When tobacco is wiped on glass, it gives glass repulsion to water.  Assume that you have wiped a bit of oil on glass and sprinkle water over glass.  You would see that the water droplets are never attached to the glass, rather they roll out faster without disturbing the surface of the glass.  Likewise, tobacco adds a thin layer of protection against water without disturbing the transparency of glass.   So, if it rained, take some tobacco and apply it over the glass, following by wiping the glass with tobacco.  You would witness water droplets running on your windshield rather than sticking on it. 

Disclaimer: Test the acceptance of tobacco on your glass in small scale before applying it in full.  Because tobacco can stain your windshield glass permanently, if inappropriately used.  Also, the application of tobacco is one-time use only.  If it rained very heavily, this trick may not work as the force water would remove the layer created by the application.

கச்சி திருநெறிக்காரைக்காடு

October 21st, 2010 No comments

காஞ்சி மாநகர் சரித்திர காலத்திற்கு முன்பே தோன்றி புராண இதிகாசங்களிலும் சைவ, வைணவ, பெளத்த, சமண காவியங்களிலும் இந்நகர் சிறப்பிக்கப்பட்டுள்ளது. தொண்டை நாட்டு தலங்களுள் காஞ்சிபுரம் முதன்மை வாய்ந்தது. இது உலகிலேயே மிகப் பழமை வாய்ந்த நகரங்களுள் ஒன்றாக மதிக்கத்தக்க மாட்சிமையுடையது. “நகரேஷு காஞ்சி” என்று மகாகவி காளிதாசராலும், “தேசமெல்லாம் புகழ்ந்தாடும் கச்சி” என்று மாணிக்கவாசகப் பெருமானும், “கல்வியிற்கரையிலா காஞ்சி நகரம்” என்று திருநாவுக்கரசரும், “காஞ்சியை நினைப்பீர் காசிக்கடிநகர் வசித்த பேறாம்” என காஞ்சிப் புராணமும் போற்றுகின்றது. மனிதனின் அன்றாட வாழ்க்கையில் இறைவுணர்வு மேலிட பிறக்க, இருக்க, நினைக் தரிசிக்க இறக்க முக்தி அளிக்கின்ற தலங்களில் ஒன்றாக விளங்குவது காஞ்சி தலமாகும். பஞ்ச பூத தலங்களில் மண் தலமாக விளங்குவது காஞ்சி நகரமாகும்.

கா என்றால் பிரமன், அஞ்சித்தல் என்றால் பூசித்தல், புரம் என்றால் நகரம். பிரம்ன் சிவனை பூசித்த நகரம் ஆதலால் காஞ்சிபுரம் என் பெயர் பெற்றது. காஞ்சியில் உள்ள சிவாலயங்களில் எங்கும் அம்பாள் சன்னதி தனியாக கிடையாது. ஏனெனில் அனைத்து சிவாலயங்களுக்கும் அன்னை காமாட்சி தான் அம்பாளாக விளங்குகிறாள். இந்த சிறப்பு இந்தியாவில் வேறு எங்கும் கிடையாது. இந்தியாவில் உள்ள 108 வைணவ திவ்யதேசங்களில் காஞ்சியில் ஆழ்வார்களால் மங்களாசாசனம் செய்யப்பட்ட 14 வைணவ தலங்கள் உள்ளது மிகவும் சிறப்பாகும்.

Powered by ScribeFire.