Friday, December 9, 2016

Consume Antimalware Scan Interface (AMSI) from C#


Windows 10 have a new mechanism that will allow software developers to integrate their applications with whatever antimalware programs exist on users’ computers.

The goal of the new Antimalware Scan Interface (AMSI) is to let applications send content to the locally installed antivirus product to be checked for malware.

No C# sample code is available in msdn. Here is the sample C# code to communicate with antimalware product installed in your machine. I used Windows Defender here.

  public enum AMSI_RESULT   
 3:   {   
 4:    AMSI_RESULT_CLEAN = 0,   
 5:    AMSI_RESULT_NOT_DETECTED = 1,   
 6:    AMSI_RESULT_DETECTED = 32768   
 7:   }   
 8:    
 9:   [DllImport("Amsi.dll", EntryPoint = "AmsiInitialize", CallingConvention = CallingConvention.StdCall)]   
 10:   public static extern int AmsiInitialize([MarshalAs(UnmanagedType.LPWStr)]string appName, out IntPtr amsiContext);   
 11:    
 12:   [DllImport("Amsi.dll", EntryPoint = "AmsiUninitialize", CallingConvention = CallingConvention.StdCall)]   
 13:   public static extern void AmsiUninitialize(IntPtr amsiContext);   
 14:    
 15:   [DllImport("Amsi.dll", EntryPoint = "AmsiOpenSession", CallingConvention = CallingConvention.StdCall)]   
 16:   public static extern int AmsiOpenSession(IntPtr amsiContext, out IntPtr session);   
 17:    
 18:   [DllImport("Amsi.dll", EntryPoint = "AmsiCloseSession", CallingConvention = CallingConvention.StdCall)]   
 19:   public static extern void AmsiCloseSession(IntPtr amsiContext, IntPtr session);   
 20:    
 21:   [DllImport("Amsi.dll", EntryPoint = "AmsiScanString", CallingConvention = CallingConvention.StdCall)]   
 22:   public static extern int AmsiScanString(IntPtr amsiContext, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)]string @string, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)]string contentName, IntPtr session, out AMSI_RESULT result);   
 23:   [DllImport("Amsi.dll", EntryPoint = "AmsiScanBuffer", CallingConvention = CallingConvention.StdCall)]   
 24:   public static extern int AmsiScanBuffer(IntPtr amsiContext, byte[] buffer, ulong length, string contentName, IntPtr session, out AMSI_RESULT result);   
 25:    
 26:   //This method apparently exists on MSDN but not in AMSI.dll (version 4.9.10586.0)   
 27:   [DllImport("Amsi.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]   
 28:   public static extern bool AmsiResultIsMalware(AMSI_RESULT result);   
 29:    
 30:   private void CallAntimalwareScanInterface()   
 31:   {   
 32:    IntPtr amsiContext;   
 33:    IntPtr session;   
 34:    AMSI_RESULT result = 0;   
 35:    int returnValue;   
 36:    
 37:    returnValue = AmsiInitialize("VirusScanAPI", out amsiContext); //appName is the name of the application consuming the Amsi.dll. Here my project name is VirusScanAPI.   
 38:    returnValue = AmsiOpenSession(amsiContext, out session);   
 39:    returnValue = AmsiScanString(amsiContext, @"X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*", "EICAR", session, out result); //I've used EICAR test string.   
 40:    AmsiCloseSession(amsiContext, session);   
 41:    AmsiUninitialize(amsiContext);   
 42:   }   

DLLImport entry for Amsi.dll win32 APIs can be found here.

Happy coding!

Thursday, June 2, 2016

Design guidelines for concurrent DB connection in SOA

In a Service Oriented Architecture, our web services will be accessed by multiple users concurrently.

Some design guidelines that is useful while designing DB Access Layer for SOA architecture .

1. Don't make your connection static/shared.
2.Always use using statement for DB connection object. Using will act as try catch finally block and closes and disposes the connection object, and this connection object is moved to connection pool that is manged by CLR.
3. If you want to test concurrency in your application, create multiple threads and make multiple request to the exposed services.

 ServiceClientClass client = new ServiceClientClass ();  
 Thread th = new Thread(() => client.CallDBService());  
 th.Start();     

or as in this link:
http://stackoverflow.com/questions/25361706/how-to-test-concurrency-scenarios-in-net

If the connection object is reused by all requests, you will get unexpected errors like
 'Not allowed to change the 'ConnectionString' property. The connection's current state is open.'

Read more here:
http://stackoverflow.com/questions/9705637/executereader-requires-an-open-and-available-connection-the-connections-curren
http://stackoverflow.com/questions/670774/how-can-i-solve-a-connection-pool-problem-between-asp-net-and-sql-server
http://stackoverflow.com/questions/11448335/dispose-the-connection-or-close-the-connection
 

FUJIFILM XQ2 - Portrait and landscape photography


I'm not a pro photographer, just an enthusiast!


I got a new FujiFilm XQ2 last week. Was playing around with it. My biggest concern was about portrait photography. I really like to take portraits with nice bokeh. Before buying I did some research in google, but couldn't find any major posts on this.

Looks like it's pretty good for half body portrait shot. I took some photos of my niece. I wanted to experiment on full body portrait also, but my niece got angry on me. :(
The picture quality is pretty awesome and color rendering is also really good. And as you can see, the picture came with a good bokeh. I did the shoot 1m - 1.5m away from the subject by zooming in with aperture at f/4.9. You can experiment with the different distance from the subject with different apertures.

These all pics are Straight Out of Camera.





XQ2 is really good for landscape as well. It cannot deliver ultra wide angle shots, but good enough for wide angle shots I believe. Sadly, there is no inbuilt neutral density filter in XQ2.



Thanks to my friend, Kundoli for these snow shots.






Monday, April 7, 2014

c# Value types and reference types

May be this topic is one the most confusing part in C# and a quick stackoverflow search would return a pretty huge amount of Q&A on this. This writing would be more for my reference as I myself getting confused with this topic overtime and every time I need to do lot of search to get the exact stuffs. So I will consolidate the abstracts here. I will keep the references in the footer so the reader can have a in-depth read on the same.

Value Types

The typical convention is “Value types always goes to stack”. This is an incorrect statement and the statement should be "value types can be stored on the stack and the heap"
  • There are three kinds of storage locations: stack locations, heap locations, and registers.
  • Long-lived objects are always heap locations.
  • Short-lived objects are always stack locations or registers.
References and instances of value types are essentially the same thing as far as their storage is concerned; they go on either the stack, in registers, or the heap depending on whether the storage of the value needs to be short-lived or long-lived.

Why short-lived value types are stored in stack

The stack is a "FILO" (first in, last out) data structure, that is managed and optimized by the CPU quite closely. Since CPU organizes stack memory so efficiently, reading from and writing to stack variables is very fast. Every time a function declares a new variable, it is "pushed" onto the stack. Then every time a function exits, all of the variables pushed onto the stack by that function, are freed (that is to say, they are deleted). Once a stack variable is freed, that region of memory becomes available for other stack variables. Since stack is handled by CPU, .Net Garbage collector need not to take care of stack allocation and deallocation.

Reference Types

The storage locations of instances of reference types are always treated as though they are long-lived, even if they are provably short-lived. Therefore they always go on the heap.
We are taught for years, reference type object will hold an address, that is the physical memory address where object is stored on heap. This is absolutely wrong. Reference type variable will never hold the exact physical address of the memory location on heap. It will hold a reference and this reference is not an address, a reference is something like "a reference is a small chunk of data which contains information used by the CLR to find out the actual physical address of the object in the heap." 
Why references, not pointers
As per Eric Lippert, “We also want to avoid some of the optimization nightmares that languages with pointers have. Languages with heavy use of pointers have a hard time doing garbage collection, optimizations, and so on, because it is infeasible to guarantee that no one has an interior pointer to an object, and therefore the object must remain alive and immobile.

Why reference types are stored in heap

Unlike the stack, the heap does not have size restrictions on object size (apart from the physical limitations of the computer)
Reference type always goes to heap. Reference type object never holds the exact physical address of the storage location on heap. Reference is not an address. Reference and pointer is entirely different entities.

References

  1. The Truth about value types.
  2. References are not addresses.
  3. Jon Skeet on value type and ref type
  4. .NET: Type Fundamentals – msdn article
  5. What is Stack and Heap
  6. StackOverflow Link1
  7. StackOverflow Link2
  8. StackOverflow Link3
Disclaimer: I have shamelessly copied sentences and words from the blogs put in references.

Thursday, January 31, 2013

Tuesday, February 7, 2012

.Net FAQ

-----------------------------------------------------------------------------
C# Frequently Asked Questions
http://blogs.msdn.com/b/csharpfaq/default.aspx?PageIndex=2

------------------------------------------------------------------------------
1. Default access specifier

Classes and structs that are declared directly within a namespace (in other words, that are not nested within other classes or structs) can be either public or internal. Internal is the default if no access modifier is specified.

http://msdn.microsoft.com/en-us/library/ms173121%28v=vs.90%29.aspx

2. Protected Internal
The type or member can be accessed by any code in the assembly in which it is declared, or from within a derived class in another assembly. Access from another assembly must take place within a class declaration that derives from the class in which the protected internal element is declared, and it must take place through an instance of the derived class type.

Note:
The protected internal accessibility level means protected OR internal, not protected AND internal. In other words, a protected internal member can be accessed from any class in the same assembly, including derived classes. To limit accessibility to only derived classes in the same assembly, declare the class itself internal, and declare its members as protected.
http://msdn.microsoft.com/en-us/library/ms173121%28v=vs.90%29.aspx

3. Advantages of Delegates

They're a great way of encapsulating a piece of code. For instance, when you attach an event handler to the button, that handler is a delegate. The button doesn't need to know what it does, just how to call it at the right time.

Another example is LINQ - filtering, projecting etc all require the same kind of template code; all that changes is the logic to represent the filter, the projection etc. With lambda expressions in C# 3 (which are converted into delegates or expression trees) this makes it really simple:

var namesOfAdults = people.Where(person => person.Age >= 18)
.Select(person => person.Name);

(That can also be represented as a query expression, but let's not stray too far from delegates.)

Another way of thinking of a delegate is as a single-method interface type. For example, the EventHandler delegate type is a bit like:

public interface IEventHandler
{
void Invoke(object sender, EventArgs e)
}

But the delegate support in the framework allows delegates to be chained together, invoked asynchronously, used as event handlers etc.

http://stackoverflow.com/questions/639320/what-are-the-advantages-of-delegates

4. Function Overloading in webservices

Not Possible for SOAP, Possible in WCF

  [OperationContract(Name = "DoWork")]
        string DoWork();

       [OperationContract(Name = "DoWorkWithParam")]
        string DoWork(string param);

The function overloading in Web Service is not as straightforward as in class. While trying to overload member function, we make two or more methods with the same name with different parameters. But this will not work in web services and will show runtime error because WSDL is not supported by the same method name.

http://www.codeproject.com/Articles/30018/Function-Overloading-in-Web-Services

5.Web services vs WCF
http://msdn.microsoft.com/en-us/library/aa738737.aspx

http://www.codeproject.com/Articles/45698/WCF-Comparison-with-Web-Services-and-NET-Remoting

6. How to consume .net web services from java/python. How dataset will be processed.?
At design time, when the Java developer runs WSDL2Java, there isn't enough information in the schema definition to do anything.Hence, In order for Java developers to consume this Web Service, they'll have to drop down and use their equivalent DOM API directly.
The ultimate solution, however, would be to standardize an XML Schema definition for representing database resultsets that could be supported across all toolkits.


http://msdn.microsoft.com/en-us/magazine/cc188755.aspx


7. Abstract Classes vs. Interfaces
http://msdn.microsoft.com/en-us/library/scsyfw1d%28v=vs.71%29.aspx

8. What is an asax file.
http://msdn.microsoft.com/en-us/library/1xaas8a2%28v=vs.71%29.aspx

9.MutliCast delegates
http://msdn.microsoft.com/en-us/library/ms173175.aspx

10. Sealed Class

The main purpose of a sealed class to take away the inheritance feature from the user so they cannot derive a class from a sealed class. One of the best usage of sealed classes is when you have a class with static members. For example, the Pens and Brushes classes of the System.Drawing namespace.
The Pens class represent the pens for standard colors. This class has only static members. For example, Pens.Blue represents a pen with blue color. Similarly, the Brushes class represents standard brushes. The Brushes.Blue represents a brush with blue color.
So when you're designing your application, you may keep in mind that you have sealed classes to seal user's boundaries.

http://www.c-sharpcorner.com/UploadFile/mahesh/SealedClasses11142005063733AM/SealedClasses.aspx

http://codebetter.com/patricksmacchia/2008/01/05/rambling-on-the-sealed-keyword/

http://www.codeproject.com/Articles/239939/Csharp-Tweaks-Why-to-use-the-sealed-keyword-on-cla

11. Static Classes and Static Class Members
http://msdn.microsoft.com/en-us/library/79b3xss3%28v=vs.80%29.aspx

12.What is the difference between const and static readonly?
http://blogs.msdn.com/b/csharpfaq/archive/2004/12/03/274791.aspx

13.Static Class vs Singleton

What makes you say that either a singleton or a static method isn't thread-safe? Usually both should be implemented to be thread-safe.

The big difference between a singleton and a bunch of static methods is that singletons can implement interfaces (or derive from useful base classes, although that's less common IME), so you can pass around the singleton as if it were "just another" implementation.

http://stackoverflow.com/questions/519520/difference-between-static-class-and-singleton-pattern

14.Primary Interop Assemblies
http://msdn.microsoft.com/en-us/library/aax7sdch.aspx

15.What is SOAP Prootcol

16.Access Modifiers
http://msdn.microsoft.com/en-us/library/wxh6fsc7%28v=vs.71%29.aspx

17. Indexes in SQL
http://www.sqlservercentral.com/articles/Stairway+Series/72284/

18. ExecuteQuery-Vs-ExecuteNonQuery
http://www.dotnetspider.com/forum/98072-ExecuteQuery-Vs-ExecuteNonQuery.aspx

19. ExecuteQuery VS ExecuteReader

20. idictionary
http://msdn.microsoft.com/en-us/library/system.collections.idictionary.aspx

21. Hash table vs. Dictionary

The Dictionary class has the same functionality as the Hashtable class. A Dictionary of a specific type (other than Object) has better performance than a Hashtable for value types because the elements of Hashtable are of type Object and, therefore, boxing and unboxing typically occur if storing or retrieving a value type.
http://msdn.microsoft.com/en-us/library/4yh14awz%28v=vs.80%29.aspx

22. Layered Archtecture and Multitier architecture
The concepts of layer and tier are often used interchangeably. However, one fairly common point of view is that there is indeed a difference, and that a layer is a logical structuring mechanism for the elements that make up the software solution, while a tier is a physical structuring mechanism for the system infrastructure.

http://en.wikipedia.org/wiki/Multitier_architecture


23. Should I use a view, a stored procedure, or a user-defined function

databases.aspfaq.com/database/should-i-use-a-view-a-stored-procedure-or-a-user-defined-function.html

1. A function is a subprogram written to perform certain computations
2. A scalar function returns only a single value (or NULL), whereas a table function returns a (relational) table comprising zero or more rows, each row with one or more columns.
3. Functions must return a value (using the RETURN keyword), but for stored procedures this is not compulsory.
4. Stored procedures can use RETURN keyword but without any value being passed.
5. Functions could be used in SELECT statements, provided they don’t do any data manipulation. However, procedures cannot be included in SELECT statements.
6. A function can have only IN parameters, while stored procedures may have OUT or INOUT parameters.
7. A stored procedure can return multiple values using the OUT parameter or return no value at all.
http://searchsqlserver.techtarget.com/tip/Stored-procedures-vs-functions

We can call a SQL Function from ADO.NET code. Say we havea function named ABC(). So we call as SELECT ABC() from ADO.Net code. We cannot calla directly as ABC().

http://stackoverflow.com/questions/1056390/how-to-use-sql-user-defined-functions-in-net

Friday, August 26, 2011

Missing her badly. Need to date her once more at least.. ;)

Missing those days badly..


“Very few people have ever said anything nice about Calcutta, unless they were Bengali.”
(Geoffrey Moorhouse)

Kolkata, She is sweet and cute, and will create a strong bond with you. She would never depart from you. If you had lived with her for even the least amount of time, you are sure to get a gift of warm memories that you will never forget in all your life! 

I was with her for 4 years. You can imagine the depth of bond that I shared with her. The weekends were always enjoyed with her company. She will take you to the streets for a casual walk where you can find a sea of humanity. Never ever you tire of her nor is there a boring moment around her! You can either go to high-tech Salt Lake where air-conditioned cars travel silently side by side with cycle rickshaws and auto-rickshaws. The auto-rickshaw drivers in Kolkata are simply awesome. They will never cease to amaze you with their driving skills. If you want to enjoy the true auto rickshaw ride, you should take a ride in Salt Lake on the morning of any weekday . They are very precise at keeping gaps in traffic. They will come as fast as they can and sharply and precisely stop the vehicle. And speaking of blocks, a traffic block in Kolkata is something you should experience at least once your life, especially in Salt Lake. You have to see it to believe it :D

Shot from Kolkata taxi in a rainy season...

She will always call you to City Centre, Salt Lake. You can't ignore that call as the joys of window shopping and roaming around are too strong of resist. After the mundane terrible 1 hour sleepy boring morning meeting in my company, she take you to the small poori kada, where you will get 4 poories and sabhgy [Potato curry] for 10 bucks and 1 rupee tea in a small cute clay pot. After that tea and chit chat from Shambhu dha's shop  where one can enjoy viewing the perfect style of cigarette smoking by a lady. Every day morning and evening, we meet this lady at Shambhu dha's shop (because one of my friends is a big fan of this lady's smoking style ;)). Actually I wished to photograph her smoking, but I was scared of the women's commission ;)
 
Waking up at 9.30 and then running behind the Garia Station - New Town bus to get into to reach the 10.00 AM morning meeting at office. Hanging onto the bus floorboard from home to office, where the whole road will be covered by yellow taxis. Oh..That was wonderful. Missing those days.. :(. Evening having hardcore spicy pani poori @ 50 paisa per pani poori.. Where else you can get this??? And I created a record there, 65 pani pooris in a single shot. But couldn't beat my beloved friend, Rahul M.R (akka, m.r) who marked a record of 72!!!
 
Playing football on weekends near by Karunamayi and fighting  with big fat guy, Santy Singh which almost always results in me falling down!  :). Then taking a taxi from Karunamayi; a taxi where the driver has already manipulated the taxi's meter to make it run at lighting speed and thus shows double the actual fare; Fighting with the guy to cut down the taxi fare finally ending up with us settling on a decent fare (tough to bargain with Bengalis ;) ! )
 
Central park near by Karunamayi is a wonderful place. Central park is a huge expanse of greenery meant for relaxation, but through out the day, it is taken over by young boys and girls on the lookout for seclusion. Elders find it embarrassing to stroll in its grounds for fear of suddenly finding scenes being enacted – scenes that are appropriate in the privacy of the bedrooms, not in the open, behind some shrubs!! :D
 
Victoria Memorial, Kolkata
On weekends morning after football I usually go with her to central Kolkata, where we will have appam and kadala curry, a mouth watering Kerala dish from a Kerala hotel in park street. Then walking in the streets of park circus where you can find another sea of humanity. Oh! Darling, you are photographer's paradise. She will always remember me that I have to do something to make these poor homeless peoples lives in a better way. Central Kolkata is the best part of Kolkata and this is the Old Kolkata. Central Kolkata has lot of things to show you, old buildings constructed at the time of British era, Victoria memorial building and lot more... Walking with her in these streets is a wonderful experience. That will relax you like anything.

How can I forget College Street, a wonderful place where we can walk into old Kolkata buildings. College street has book stalls from start to the end of the street and lot of stalls that offers 1000+ designs of unique wedding cards.

Gariahat, I probably spent most of my time with her in Gariahat . Endless road side shops where you can get everything from  salt to camphor at a very cheap price. Sriram market, New market in Esplanade, bargaining with shopkeepers for every paisa! They will say something  like 1000 INR for a small hand bag. and we would start at 50-100 rupees.. ha..ha.. Having famous mouth watering Kolkata sweets from sweet stalls and lot more...

This is a small taste of the beauty that is Kolkata...You should date her once in your life time..


Thanks to Aneesh Ramaswami for correcting grammar ...

Monday, July 25, 2011

Image search using image - Tineye

You may have came across scenarios like you have a image file in your local computer, but you don't know the origin of the image. Using this image, you may like to explore story behind the image or you may like to explore similar images.

So How will do it just using the image file. Here comes the technology of reverse image search, the famous Tineye, which is an image search engine in reverse, as to enter a particular image, for their clones and modifications throughout the Internet, making it easier the task of finding places far has a picture of yourself or have had any changes. Today has been a little affected by the Google version of this service , but still fighting back.

Still, the biggest problem with these services is that they are in the cloud and all images on your disk automatically excluded from the search. To resolve this problem exists imgSeek, which is a desktop version, with large differences, TinEye service.


imgSeek initially works by creating a catalog of all the images you have in your file and then be indexed and searched easily. Then you have two options: you can enter an image similar to the one you want to search, for example you can select an image from a cloud and find all pictures of clouds you have in your catalog, and secondly you can draw that image to the program find images that match the doodle. Just as it sounds, you can make a small drawing and let the program do its job. The results are somewhat random with this option, but the attempts that I have, in most cases failed to find the image that was referencing.

You can download the program from the official website or download the latest version via SourceForge .

Sunday, July 24, 2011

In the Footsteps of Tenzing Norgay Touching My Father's Soul: A Sherpa's Journey To The Top Of Everest

'A story of passion, hardship and endurance' - REINHOLD MESSNER

A gripping and inspirational piece of mountaineering literature, shortlisted for the Boardman Tasker award. A book of adventure, wisdom and spiritual enlightenment. Touching My Father's Soul recounts Tenzing's son, Jamling Norgay's treacherous climb to the world's most forbidding summit. As retold in Krakauer's Into This Air, the 1996 IMAX climbing expedition collided with tragedy. As the climb unfolds so too does Norgay's inner journey. His desire to finally stand alongside his father's soul on the summit of Everest is realised, as is an understanding of his family's Sherpa history and a realisation of the power and significance of the Himalayas. Beautifully repackaged for the paperback edition, this is a classic.
Jamling Tenzing Norgay is the son of Tenzing Norgay, who, with Sir Edmund Hillary, was the first man to reach the summit of Mount Everest, or Jomolungma, as we call it in Tibetan. In this book he tells the story of his participation in the successful ascent of Everest in 1996. Although generally Tibetans do not attempt to scale the peaks of mountains, being content to cross the passes that characterize journeys in Tibet, Jamling Tenzing Norgay takes a very Tibetna view of the enterprise - he regards it as a pilgrimage. It is a pilgrimage on the one hand in tribute to his renowned and courageous father, but also because of traditional Tibetan sense that mountains are the abodes of divine beings.


Get a Copy
Flikpart.com is offering low price edition, Imported high quality print and audio cassette at low prices.





Wednesday, July 6, 2011

ഭൂലോക മണ്ടന്മാരായ മലയാളികള്‍

സ്ഥലം
കൊല്‍ക്കത്ത
 

രംഗം
അവിടെ ഉള്ള ഒരു മലയാളി കടയില്‍ നിന്ന് പ്രഭാത ഭക്ഷണം കഴിക്കുന്നു.
 സംഭവം
അപ്പോള്‍ എന്നെ അമ്പരിപ്പിച്ച ഒരു സംഭവം അവിടെ നടക്കുന്നു. മലയാളികള്‍ വെറും മണ്ടന്മാരെന്നു തെളിയിക്കുന്ന ഒരു പരിഹാസ്യകരമായ ഒരു സംഭവം. ഒരു അമ്മയും അവരുടെ ചെറിയ ഒരു കുട്ടിയും [അവരുടെ സ്വന്തം മോന്‍
ആണേ] വരുന്നു. കുട്ടിക്ക് ഒരു എഴ് എട്ട് വയസ്സു കാണും. കുട്ടി ഒരു കസേരയുടെ അടുത്ത് നിക്കുന്നു. അപ്പൊ ഈ മഹതിക്ക്‌ ആ കുട്ടിയെ കടന്നു പോകണം. അപ്പോള്‍ ആ മഹതി കുഞ്ഞിനോട് പറയുന്നു - "Excuse Me". അത് കേട്ട് ഞാന്‍ തരിച്ചു ഇരിന്നു പോയി. മലയാളികള്‍ പണ്ടേ മച്ചാന്മാര്‍ ആണ്‌. പക്ഷെ നമ്മള്‍ മലയാളികള്‍ വെറും മച്ചാന്മാരും ച്ചാത്തിക്കളും അല്ല. മെഗാ മെഗാ മചാന്മാരും മചാത്തിക്കളും ആണേ.. ഹോ ..ഹോ .. മുതു മുട്ടന്‍ ..

Monday, June 27, 2011

The terrific power behind Prayer, Mantras, Temples and Poojas and how it works

Before going into the heart of post, I would like to tell something here. I mentioned temple as a structure reserved for religious or spiritual activities referring to all religions. Temple is not constrained to Hinduism.

I spent my childhood with my ammoomma [Grandmother] in a village called, kanderi in Northern Kerala. Northern Kerala is blessed with lot of Theyyams. Ammoomma used to take me to watch Theyyam and tell lot of stories about Theyyams, Purana and lot of other stories about mantra. I have been running behind our mantras and different rituals from those days when my brain started embedding memories.

Initially when I heard that there is mystic power behind mantras, I also couldn't believe it. I read some books and they led some light into my exploration behind the mysteries of mantra. Half of the knowledge I got from the readings and other half I myself developed from the base of these readings and others. I just wanted to tell some basic concepts behind mantras and rituals. Probably I think I am able to get .1% in this vast Vedic tradition in India.

A mantra is a sound, syllable, word, or group of words that is considered capable of "creating transformation". Mantras originated in the Vedic tradition of India. As you know, everything in this universe is driven by energy. Without energy nothing in this world can be alive. Every energy has precisely defined frequency. Everything in this universe has a sound which vibrates at a particular frequency. Mantras are the sounds of the language of the universe, the energy.If we want to tune into and access a particular universal frequency, chant the mantra that vibrates that frequency.

Our universe is occupied with a substance called "Akâsha" of the Hindus and the "Ether" of the Greeks, which allows the propagation of electro magnetic waves. As I said earlier, when we chant a mantra, frequency is generated. Every mantra is precisely crafted to produce a unique frequency. We need to chant mantra in such a manner to generate that unique frequency. A connection is established between our body and the energy field through resonance. This electromagnetic energy waves will start propagating through the Akâsha. Since all objects in universe is connected each other, all supporting particles and energy forces will start to support the electro magnetic energy generated from our mantra. The negative energy from our mind will be cleared and positive energy will start flowing to your mind. For each mantra there will be specific aim and the aim will be achieved. This is the basic theory behind mantras. So using mantras we can overcome what is specified in our horoscope or defined in palm.

So What is temples and rituals all about. Actually we all are going to temples and pray there. Normally, we don't need to go to temple and pray. We can achieve the same effect by praying from home or any other place too.The only thing is you have to concentrate and pray. The advantage of temple is since of everyday poojas in temple, there will be lot of positive energy in the surroundings. And the atmosphere will be clam and quiet. The architecture of our old temples is designed based on Vastu Shastra. The architecture is designed in a manner to continuously emit positive electromagnetic energy. And about the deities worshipped in temples. Since deities are being getting chanted by lot of mantras, they will have electro magnetic power resided in them. For smooth transformation of energy, men are advised to be bare chest while going to temple. As per our culture, Women are considered as epitome of energy. So women don't need to be bare chest while they are going to temple.

When we go to astrologer for a specific problem, they will advise to do some specific poojas and they will advise to go to temple on specific days. The basic science is electro magnetic energy for all these. I would like to ink an example here. An astrologer told my amma to go to a temple and do some poojas on birth star nalu [ I don't know how to write that in english. For eg:, avittam nalu day ] days. At first I thought what is the point of doing poojas on these specific days. I thought a lot and finally I got the answer. As I told earlier, when we are chanting a mantra, all other particles in universe are supporting us. On birth star day, the star will be at one specific position in the orbit and it will powerful than other positions and when we are chanting mantras on this day, the effect of mantras will be more powerful compared to other days.

"kannuthattuka" in malayalam is also doing the same thing. While "kannuthattubol", negative energy starts propagating and the negative energy will create negative effects on that object. If we are chanting a mantra, the positive energy created by this stop the flow of negative energy and "kannuthattal" wont affect us. Black magic is also using the same techniques. There are specific mantras defined for black magic. When we are chanting these mantras, negative energy will start propagating and will affect the concerned person.

I am stopping here and just wanted to tell that the basic concept behind the universe is electro-magnetic energy and our sages knew everything about our universe far far more than our modern science.

I wanted to write about this for quite some time. Finally I am able to write a brief note about Vedic culture. I am proud that we have this much big heritage but still sad that Indian's are running at light year speed behind western culture.

References -

Sunday, June 26, 2011

The Importance of Personal Projects in Software engineer's life

I felt like working as software engineer in software industry kills your passion in coding. Is it ? I think so. I have been working as a software engineer for past 4 years. I got placed through campus selection in a MNC. So what is the outcome after last 4 years. I became a baby in software industry. I neither got exposure to any new technologies nor any challenging job. We cannot blame the company too some extend. Because to some extend, the technology company uses depends on the client. I had a hardcore passion for coding in my college days. These days I hate coding to the worst extend it can go. Almost all coders will go through these kind of scenarios. So How to get rid of this.

Being a freelancer is a good idea. You are boss for your business. You are defining the architecture, you are implementing your ideas and the outcome is you are enjoying your work. Of course, the financial security of leaving a 9 to 5 job to be your own boss is the first drawback that would come to mind. So we need to find a optimised algorithm for tackling the problem.

So what is the algorithm for enjoying the coding and still being in software corporate world ?

The answer is Define personal projects and code the projects.

So from where we will get ideas for personal projects? For getting ideas we can walk through freelancing sites (Elance, Freelancer.com, Vworker). Don't work on any freelancer jobs initially for money. That will pressurise you like hell. Just get the ideas and code for your own pleasure.So that we can sharpen our skills, enjoy coding, explore different levels of coding, publish blog posts, publish in sites like codeproject, we can help fellow coders in different coding community, present different ideas in you company team meeting and various other opportunities. And one of the other colourful thing, you will be a star among your team mates.

I am not good in writing blog posts. I just wanna ink my ideas some where. Some parts of my mind is calling me back. Build your ideas and be a world class coder. Happy coding!

Comment your valuable ideas...


Thursday, June 11, 2009

Create PDFs in .Net on the fly

I was doing a project in that i want to create PDF reports on the fly. I goggled a lot and i went through lot of tools over internet.But i went back on seeing the 200$ + license.I cannot buy licence becoz i 'm doing project as a self service towards a charity association.Then i came across a open source project called iTextSharp. iTextSharp is a library entirely written ic C# on .Net platform that allows u to create PDF dynamically.

So lets code to create a simple PDF in VB.Net

Imports iTextSharp.text
Imports iTextSharp.text.pdf
Imports iTextSharp.text.html

Public Sub GenerateReport()
Dim Doc As New Document(PageSize.A4, 80, 50, 30, 65)
Dim FileName As String = Guid.NewGuid.ToString
Dim Par As New Paragraph()
Dim oLabResults As New LabResult
Dim iTextTable As iTextSharp.text.Table
Dim imgLogo As iTextSharp.text.Image
Dim strLogoPath As String
Dim oDirInfo As New DirectoryInfo(HttpContext.Current.Request.PhysicalApplicationPath & "Temp")
PdfWriter.GetInstance(Doc, New FileStream(oDirInfo.ToString & "\" & FileName & ".pdf", FileMode.Create))
Dim oDocHeader As New iTextSharp.text.HeaderFooter(New Phrase("Amrita Hospitals"), False)
Doc.Header = oDocHeader
oDocHeader.Border = Rectangle.NO_BORDER
oDocHeader.Alignment = Rectangle.ALIGN_CENTER
Doc.Open()
End Sub