Meltronics Website designed by me

The happiness of putting a personally created website was recreated today when the website of Meltronics went online.

Meltronics is my friend – Tushar Mayangade’s company, for which he asked me to design the website. After almost 2 months of intermittent work (alongside my job 😛 ), today is the day for celebration!

It was little challenging for me because earlier when myself and Mihir had designed the award winning website for IEEE CRCE Student Branch, I was mostly on the creative side – handling mostly the design and looks of the site.
This time I was doing the complete work that too in parallel with my job at Ittiam.

It was fun and got to learn a lot about html, jQuery which I had missed earlier.
Well then… checkout the website at Meltronics. Do tell me if anything can be improved.

Meltronics Website

Meltronics Website designed by me

Advertisements

Indeed a Happy Teachers’ Day…

Many great things have been written for teachers… they are indeed God in disguise of human beings to show us the right path… or still better- teach us how to choose the right path.

But when u get to contact your old teachers, it is a very pleasing and happy feeling that they still remember you… because a teacher teaches numerous students in every batch, and still if he/she remembers you…its a great feeling.

This time, I got to talk to Prof. Rahul Dahatonde, my BE Project guide from Fr. CRCE. First of all- I want to say sorry for creating a creating an inappropriate image through my blog, as i called him the “most dreaded professor”. It was just the starting of our project and this was what i heard from my seniors 😉 But later when we worked under him we realised he is a very genuine and encouraging person. Though our project was a little out of field with his, but still he guided us very well and we were able to put up something good. You can talk to him as a friend and discuss problems (though maintaining discipline is definitely required). Thank you Sir for guiding us & encouraging us to put our best. There have been other great profs at Fr. CRCE like Prof. BR Prabhu, Srija mam and many others.

Also, I got a reply from my MTech project guide, Prof. Somnath Sengupta from IIT Kharagpur. He is very fine man too. Not only a very knowledgeable person in the field of DSP & Multimedia processing but also a great guide. Ever ready to discuss problems and help u out. He has such energy difficult to imagine for a person of his age. We learnt a lot under your guidance.

I also want to mention my school teachers- Nirmala teacher, Rama teacher, Pinky teacher, Saraswati teacher, Hegde teacher, Jayalakshmi teacher, Madhuri teacher and many many others (i can name all here but space constraints 😦 ). Today i feel almost all the teachers knew and liked me in school 🙂 That indeed feels great.

There had been other teachers from the coaching classes i attended- Subramanian classes, Vidya classes, Vidya teacher, Anjali teacher, AKRoy classes for IITJEE and finally Vidyalankar classes for GATE.

I have been lucky to have u all as my teachers and today, i am what i am only because of you all. Thank you and may God bless you all.

Creating a DLL

To create a new dynamic link library (DLL) project
1. From the File menu, select New and then Project….
2. On the Project types pane, under Visual C++, select Win32.
3. On the Templates pane, select Win32 Console Application.
4. Choose a name for the project, such as testDll, and type it in the Name field. Choose a name for the solution, such as testDll, and type it in the Solution Name field.
5. Click OK to start the Win32 application wizard. On the Overview page of the Win32 Application Wizard dialog box, click Next.
6. On the Application Settings page of the Win32 Application Wizard, under Application type, select DLL.
7. On the Application Settings page of the Win32 Application Wizard, under Additional options, select Empty project. 8. Click Finish to create the project.

To add a function to the dynamic link library

1. To create a source, from the Project menu, select Add New Item…. The Add New Item dialog box will be displayed. On the Categories pane, under Visual C++, select Code. On the Templates pane, select C++ File (.cpp). Choose a name for the source file, such as testDll.cpp, and click Add. A blank file will be displayed.
2. Copy the code:

#include "testDll.h"
int add(int a, int b)
{ return a+b; }
int subtract(int a, int b)
{ return a-b; }
long multiply(int a, int b)
{ return a*b; }
float divide(int a, int b)
{ if(b==0)
{ printf("Error: Divide by Zero…\n");
return -1; }
else return (float)a/b;
}

3. To create a header file, right click “Header Files” in Solution Explorer, add files. On the Templates pane, select Header File (.h). Choose a name for the header file, such as testDll.h, and click Add. A blank file will be displayed.
Copy the following code:

#include <stdio.h>
__declspec(dllexport) int add(int a, int b);
__declspec(dllexport) int subtract(int a, int b);
__declspec(dllexport) long multiply(int a, int b);
__declspec(dllexport) float divide(int a, int b);

4. Note the __declspec(dllexport) modifier in the method declarations in this code. These modifiers enable the method to be exported by the DLL so that it can be used by other applications.
Another way to export a function is: To create a module-definition (.DEF) file which informs the linker to export our function. Select New from File menu and then select text File from Files tab. Give it a name example1.def.
Here is a sample of a module-definition fie (DEF file).

LIBRARY YOURDLL
DESCRIPTION ‘This is my DLL
EXPORTS
Whatever1 @2
Whatever2 @3

The LIBRARY command must match the name of your DLL. So if your DLL is named YOURDLL.DLL, the LIBRARY command is followed by YOURDLL.

The DESCRIPTION is any description you feel is appropriate for your DLL. The actual description is preceded by a single quote (‘).

The EXPORTS lists the functions that you exported, along with an ordinal number. It doesn’t matter what ordinal numbers you use, so long as you maintain different numbers for each function, and you shouldn’t change the ordinal numbers when you create an upgraded version of your DLL — persons preferring to use ordinal numbers to call your functions will get angry.

5. To build the project into a DLL, from the Project menu, select testDll Properties…. On the left pane, under Configuration Properties, select General. On the right pane, change the Configuration Type to Dynamic Library (.dll). Click OK to save the changes.

Note: If you are building a project from the command line, use the /LD compiler option to specify that the output file should be a DLL. For more information, see /MD, /MT, /LD (Use Run-Time Library).

6. Compile the dynamic link library by selecting Build Solution from the Build menu. This creates a DLL that can be used by other programs.

To create an application that references the dynamic link library
Create a normal Win32 Console application project.

To use the functionality from the class library in the console application

1. After you create a new console application, an empty program is created for you. The name for the source file is the same as the name that you chose for the project earlier. In this example, it is named testDllRef.cpp.

#include "testDll.h"
#include
#include
#pragma comment(lib, "testDll.lib")
int main()
{
printf("3+5= %d\n",add(3,5));
printf("3-5= %d\n",subtract(3,5));
printf("3*5= %ld\n",multiply(3,5));
printf("3/5= %f\n",divide(3,5));
_getch();
}

2. To reference the header files of the dynamic link library, you must modify the include directories path. To do this, on the Property Pages dialog box, expand the Configuration Properties node, expand the C/C++ node, and then select General. Next to Additional Include Directories, type the path of the location of the testDll.h header file.

3. Linking to the dll:

#pragma comment(lib, "testDll.lib")

Does the job. If you don’t want to use this statement u can manually set Project> properties > Configuration Properties > Linker> Input:

Additional Dependencies – add the name of the .lib file, “testDll.lib” here.
4. Copy the testDll.dll & testDll.lib to the folder where your source file (testDllRef.cpp) is present.
5. Build the executable by selecting Build Solution from the Build menu.
6. Run the “testDllRef.exe” from Debug> Start without Debugging. It should work!
7. If you try to run the generated “testDllRef.exe” from the “Release” folder, you will have to copy the “testDll.dll” & ”testDll.lib” to the Release folder. Then it’ll run.
To avoid this, you can copy the .dll & .lib to “Release” folder & in the #pragma comment specify:

#pragma comment(lib, "../Release/testDll.lib")

It’ll also work.

Reference: MSDN Library

Creating a setup file in VC++

Ever imagined how the setup files are made? i was curious too. Following is the procedure to create one in Visual Studio for VC++ projects.

Creating a setup file for your application using MS Visual Studio 2008

1. First build your application & generate the executable (.exe) file in “Release mode”.

2. While the solution file is still open in VS, create a deployment project (as shown in the fig 1):

File> New Project > Project types: select “Setup & Deployment”.

fig 1

3. On the Templates pane on right side, select “Setup Project”. Give a suitable name & location for the project.

4. Instead of “creating a new solution”, select the “Add to solution” option from the drop down list. The window will look like this:

fig 2

5. Add the output of the application project to the setup project. To do so, right-click on Setup1 in Solution Explorer, point to Add, and then click Project Output… fig 3.fig 3

i. In the Add Project Output Group dialog box, select Primary Output.

ii. Select Release Win32 from the Configuration drop-down box, and then click OK.

6. In the Detected Dependencies, Visual Studio adds the dependent merge module (.msm) files for the Visual C++ libraries to the setup project.

fig 4

7. IMP: if you have any other dll or lib files that your project depends on, add it to the Application folder by right clicking “Application folder” in the “File System” tab & Add > file.

fig 5 fig 6

8. Build the setup project to create the installer files (Setup1.msi and setup.exe). To do so, right click the Setup1 project node in Solution Explorer and select Build.

Visual Studio creates the installer files in the Release folder of your setup project.

fig 7

9. Run the installer on a second computer that does not have the Visual C++ libraries.

i. Copy Setup1.msi and setup.exe to the second computer.

ii. Run setup.exe on the second computer. Follow the steps that are provided by the setup wizard to complete the installation.

fig 8 fig 9

Go to the installation folder & run the .exe. It should produce the desired output.

Reference: MSDN Library

time() and GetTickCount() in C

In C language,
time() function returns a value of the current time in seconds from 1st January, 1970 UTC.
If you want the absolute time from 1st January, 1900 UTC in seconds (may be required in some network packet transmissions), then u can simply add the following unsigned int value to time():

const unsigned int from1900Till1970 = (unsigned int) 2208988800ul;
time_1900 = time() + from1900Till1970;

This absolute time values will continue without problem till 2036(The 32bit return value can go upto that period). After that we’ll see what happens. Mostly this concept of absolute time will go by then.

GetTickCount() function returns the time since your system booted up, in milliseconds. Hence it is not an absolute value. It returns a 16bit unsigned int value. There is a possibility of Rollback. On a Windows machine, the Rollback will occur if the system is ON continuously for approx. 49.7 days. Rare possibility but it exists.

Mentor Graphics University Design Contest 2010

There is a Electronics design challenge by Mentor Graphics.
This is the inaugural Mentor Graphics University Design contest 2010 in India. The focus of this contest is to provide an opportunity for engineering students to showcase their technical talent and competency using “Mentor Graphics tools”.

Stages:
Its a 3 stage competition.
Stage 1: Preparation and Submission of Paper/Project.
Stage 2: Poster Presentation
Stage 3: Paper/Project Presentation

Last of Submission of Papers:
August 15th, 2010

Awards:
1st Prize: US$ 3000
2nd Prize: US$ 2000
3rd Prize: US$ 1000

Participation:
Team/College/University Requirements: Teams must consist of at least two, but no more than five, students. There is no limit to the number of teams that may compete from any given University.

Submissions are invited from all students at all stages of their university careers, from undergraduate to post-graduate. The University/College should be “Mentor Graphics Higher Education Program(HEP) Partner”. All submissions should have the proof of Mentor Graphics tool/technology usage.

More Details:
Mentor Graphics Design Challenge India