Author Archive

Difference Between Const Ptr And Ptr to Const

This question becomes sometimes favorite in C interview. It very easy to confuse and play around in question that goes like this. What is difference between pointer to constant and constant pointer? How do you declare Constant Pointers and Pointers to Constants? If you could able to answer these questions then next question will be what is use of const ptr and ptr to const?

Basically when we use Const keyword in C language. Well, when we have some value in program that is not going to change then we make use of Const keyword. This tell compiler that the value of the variable is not going to change at any point of time during run-time, So this kind of variables are stored at initialized data segment of memory. To be precise Const type of variable values will be stored in initialized read-only area and the address of variable will be stored in initialized read-write area of data segment.

Well as it looks confusing but its easy to remember and play around all sort of questions. Here is the trick to remember and answer these confusing questions.

When someone says, pointer to constant char then start writing in reverse while coding, So in this case I will put first pointer – ie ‘* myptr’ then look at requirement what is const here, it is char. So it will be like – ‘ char * myptr’ and in the end put ‘const’ type. So to declare pointer to const char

const char * myptr;

Now when some says, declare constant pointer to char then, it will be,

char * const myptr;

The trick here is where to put ‘const’ keyword decides the declaration.  In first case ie pointer to a constant character, one cannot use ‘myptr’ pointer to change the value of char, ie value being pointed to.

    char temp = 'x';
    const char * myptr = &temp;
    *myptr = 'J'; // error -  assignment of read-only location *myptr

In case of constant pointer to a character. The location stored in the pointer cannot change. You cannot change where this pointer points.

    char temp = 'x';
    char temp1='y'

    char  *  const myptr = &temp;
    myptr = &temp1; // error -  assignment of read-only location *myptr

Now the most famous question in field of embedded systems. If you are working in embedded system and working on firmware ie programming for microcontrollers then this will be for you, declare const pointer to constant char and what is use of such variable. ie both value pointed by pointer is constant and pointer itself is constant. The answer is very simple its use is to declare program status word. Its special register which contains CPU status and all, simply its status flag of your microcontroller. So this kind of status registers are read only by value as well as by location.

const char * const myptr = &status;

So next time interview question comes on about const pointer remember me. Good Luck.

 

 

Number of View :785

No Comments


ETA – Estimated Turn Around Time Planning Software Life Cycle

What is ETA?
ETA stands for Estimated Turn Around Time. ETA is generally used in any planning and managment life cycle. In industry when a product born from an idea and enters into planning phase with stake holders in a Conference room, they all decide what should be the product launch date in the market for public use. ETA is not verbally decided for any product but it is calculated term with respect to resources available, and time available in the competent market. PRoduct goes from lifecyle so it is devided into many stages like requirement analysis, design, implementation, testing and last is delivery. This lifecycle again can repeate after customers feedback showing bugs in product or any new enhancement or featurs releases. In this lifecycle product is devided into modules and each module and so each phase has its ETA.
Advantages of ETA.
Having ETA in planning or anything having planned with correct estimation gives direction and confidennce to the team towards the launch of product or to that precious idea which can make history or million dollars.
With ETA we decide cost of product in advance.
Having ETA product is driven with timelines.

Number of View :937

No Comments


Spotcloud Buy Or Sell Unused Cloud Space Best Price Service From IaaS Enomaly ECP Provider

This is one good example of cloud IaaS (infrastructure as service). SpotCloud is the first commercial cloud computing clearing house and spot market service. Spotcloud is cloud capacity clearing house, a secure central platform for buying or selling unused cloud capacity based on location cost and capacity.

Spot New Cloud Capacity Providers

For Buyers: The SpotCloud marketplace provides a singular point of access to discover an extensive global network of cloud infrastructure providers. This service is like pre-paid mobile phones service, ie pay first to use but good thing is no need to pay extra for bandwidth, storage, etc
You need to use a Google Account & Email address.
For now this service is offered without SLA, reason they quote is “to keep the costs as low as possible the service is offered without any SLA, direct support or guarantees.”
For Sellers: The SpotCloud Clearing House empowers service providers to sell unused cloud capacity enabling increased utilization and revenue.
What is the minimum requirements for Sellers to offer capacity?
Decent bandwidth / connectivity, a compatible IaaS platform and at least 80 cores, (5 – 10 servers).
Cloud Capacity ClearingHouse(A clearing-house is an intermediary service which facilitates and simplifies transactions among multiple parties for the purpose of selling excess or unused computing capacity. )

Other services include Hotwire.com and Priceline.com, Google’s Adwords, Adsense and double-click exchange platform.

Enomaly ECP Service Provider Edition is a complete “cloud in a box” solution, enabling telcos and hosting providers to deliver revenue-generating Infrastructure-on-demand (IaaS) cloud computing services.

Number of View :1347

No Comments


An Introduction To SOA Basics Service Oriented Architecture As Developers Persepstive

I was reading this article, An Introduction to Service-Oriented Architecture from a Java Developer Perspective. To build service-oriented applications.

SOA Designed To change

For me difference between typical development and SOA based development is, Typical approach is designed to LAST, SOA based approach is designed to CHANGE. Meaning, once development is done, and as its working don’t touch it, in SOA approach, if one value needs to be changed its designed for that.

Evolve Around Business Object

Typical development is concentrated around CODE, SOA approach focuses for process and business object. If one business object is in use then how that business object will be re-usable, what are changes needed in that, eg. If Hiring management needs process as an business object to be applied in Sales management then what changes, what level of authentication and such changes are required. Such Approach in used while designing SOA based architectures.
Well there is always room for improvement.
And Good News is that, Successful SOA adoption is done incrementally.

What is SOA?

You well get many definitions and descriptions for SOA, I like this defination, SOA enables the development of applications that are built by combining loosely coupled and interoperable services.
In short for me SOA involves following things.

  1. Development,
  2. Integration,
  3. Infrastructure management.

SOA Standards?

Service Oriented Architecture (SOA) represents a collection of best practices principles and patterns related to service-aware, enterprise-level, distributed computing. SOA standardization efforts at OASIS focus on workflows, translation coordination, orchestration, collaboration, loose coupling, business process modeling, and other concepts that support agile computing. OASIS standard named Business Process Execution Language (BPEL); most platform vendors are adhering to this standard. BPEL is essentially a programming language but is represented in XML.

Few Reference SOA arcitectures.

SOA Reference Architecture from IBM

SOA Workrooms

SOA Work Group

Do share your experience about developing your first service-oriented applications.

Number of View :1397

Tags: , ,

No Comments


How To Set Environment Variable When Debugging Using Microsoft Visual Studio 2008

Set up project properties environment variable

I am new to microsoft windows visual studio 2008 IDE , Was looking for How to set environment variables when debugging in Visual Studio?
My project is in c/c++ windows console application.

Set Environment Variables in VS2008

Here are few simple steps to add environment variable.

  1. Open your project.
  2. Go to Project>Properties or pres Alt+F7
  3. Under Configuration Properties>Debugging, edit the ‘Environment’ value to set environment variables.

I wanted to set and add the directory “C:\Program Files\Hummingbird\Connectivity\13.00\Exceed” to the path when debugging app X applications, set the ‘Environment’ value to

PATH=%PATH%;C:\Program Files\Hummingbird\Connectivity\13.00\Exceed;C:\Program Files\Intel\Compiler\Fortran\10.1.021\IA32\Bin

And done.

Set System Wide Environment Variables in Windows PC

Other way to set up this is using system wide environment variable.

  1. Right click “My Computer”, Select properties
  2. Select the “advanced” tab
  3. Click the “environment variables” button
  4. In the “System variables” section, add the new environment variable that you desire
  5. “Ok” all the way out to accept your changes

Note : Visual Studio 2003 doesn’t allow you to set environment variables for debugging. In this case one can use _putenv function.
source – Windows Sysinternals: Documentation, downloads and additional resources

Number of View :1653

Tags: , ,

No Comments


Debugging Fortran Programs Using IDB How To Debug Fortran Code Ifort Commands

how to debug fortran code using idb
debugging Fortran programs.

Compiling your Fortran program for debugging

To prepare your program for debugging when using the command line (ifort command):
In a command window, (such as the Fortran command window available from the Intel Fortran program folder), compile and link the program with full debug information and no optimization:

      ifort -g file.f90 (Linux OS and Mac OS X)

      ifort /debug:full file.f90 (Windows OS)

On Windows OS, specify the /debug:full compiler option to produce full debugging information. It produces symbol table information needed for full symbolic debugging of unoptimized code and global symbol information needed for linking.
How to use Intel idb as debugger.
IDB comes with good help information
eg, (idb) help run
Run the debugger program.

Usage:

    run   (arguments) (redirections)

Arguments:

     Run the program with the specified arguments.

                Run the program with the specified input and output
                redirections.

If no arguments and redirections are specified, program is run with arguments
and redirections specified by previous “run” command with arguments or by “set
args” command.

Synonyms: “r”.
To run the exe in debug mode from command line, use devenv with debugexe option.. read more for How To Run .exe In Debug Mode Microsoft Visual Studio.

Eg. > devenv /DebugExe r280test01.exe

After windows debugger starts Hit F10 key to start debugging.
Check out How to use dbx as debugger for fortan debugging here.
Check out Debugging Fortran programs with gdb here
Intel® Debugger (IDB) Manual

Number of View :4769

Tags: , , ,

1 Comment


How To Run .exe In Debug Mode Microsoft Visual Studio 2008

How to run .exe in debug mode microsoft visual studio 2008?
Here are few solutions I got for Running .exe in debug mode using the Windows debugger.

Using Devenv

Devenv allows you to set various options for the integrated development environment (IDE);

/DebugExe

Loads a Visual C++ executable under the control of the debugger. This switch is not available for Visual Basic or Visual C# executable.

Example : if your win32 binary executable name is test.exe then, to run this win32 binary in debug mode use this command on windows command prompt.

C:\tmp>devenv /DebugExe test.exe

Your default debugger will start and loads this binary for debug mode. Then just hit F10 Key to go to main function. For Now on your debugging starts, ie to step into function use F11 key, you can put breakpoints and all debugging stuff.
I assume that you have compiled the binary test.exe with debug flag enabled, else debugger will not find the debug symbols and will not load the code.

Using Image File Execution Options

To setup an application to launch the debugger automatically.
How to: Launch the Debugger Automatically
the Image File Execution Options folder, locate the name of the application you want to debug, such as myapp.exe. If you cannot find the application you want to debug:

  1. right-click the Image File Execution Options folder, and on the shortcut menu, click New Key.
  2. Right-click the new key, and on the shortcut menu, click Rename.
  3. Edit the key name to the name of your application; myapp.exe, in this example.

read more
How to open a file, and go to a line number
devenv /edit E:\code.cpp /command “edit.goto 45”

In this example, devenv will open the code.cpp file, and go to line 45.

Number of View :3762

Tags: , ,

No Comments


How To Resolve Error __curr_eh_stack_entry and __eh_curr_region With pgcpp C++ Compiler

Was getting Error __curr_eh_stack_entry and __eh_curr_region With pgcpp C++ Compiler.
check out complete man pgcpp – The Portland Group Inc. C++ compiler

Building an application software using pgcc compiler, developed by C++ Language generates two external references of symbols [__curr_eh_stack_entry] and [__eh_curr_region], and results in kink error. Why?

How To Resolve Error __curr_eh_stack_entry and __eh_curr_region With pgcpp C++ Compiler?

Answer:
Compiler automatically generates these symbols when -exception (C++ exception handling) and -rtti=on (Runtime type information) options are used. If these option is not required to use, Please do not enable them.
source

-rtti(default) –no_rtti An pgcc compiler option switch.
Enable (disable) support for RTTI (runtime type Information) features: dynamic_cast, typeid.

Number of View :2323

Tags: , , ,

No Comments


How To _access Function For Long File Names As Path In Winddows Programming Use UNC

I use the function _access to check for file/directory existence in my program,
Problem definition: I have noticed that the function can’t deal with long file names.  I wanted to check if file is available or not at path located “C:\Documents and Settings\0001”, did Google search on how to give long file names in windows..

How To _access Function For Long File Names As Path In Winddows Programming make Use of UNC standards

Solution use the UNC(Universal Naming Convention) conventions for path to be specified while working with windows programs.

ie the path should be “C:\\Documents and Settings\\0001”

Now The next problem is wanted to use period ie . in file name path,

Eg. I need to use the path as “C:\\Documents and Settings\\.test\\0001”
So tried with something like “\\.\” But The “\\.\” prefix will access the Win32 device namespace instead of the Win32 file namespace.

Then how to Turns off automatic expansion of the path string? Use  the “\\?\” prefix also allows the use of “..” and “.” in the path names. To specify an extended-length path, use the “\\?\” prefix. For example, “\\?\D:\<very long path>”.  Read more about Naming Files, Paths, and Namespaces

That did not help much, and tried directly with “C:\\Documents and Settings\\.test\\0001” It works.
you can also try the PathFileExists function

access function Return Value

Each function returns 0 if the file has the given mode. The function returns –1 if the named file does not exist or is not accessible in the given mode;

Do share your questions and views..

Number of View :1511

Tags: , , ,

No Comments


How To Debug Err This Application Has Failed To Start Because MSVCR90.dll Was Not Found

Debugging for MSVCR90.DLL was not found error

This application has failed to start because MSVCR90.dll was not found. Re-installing the application may fix this problem.

why is it looking for MSVCR90.DLL while running debug? Shouldn’t it be looking for MSVCR90D.DLL?
While I did not compile it in debug mode.

A quick look using Dependency Walker
And doing windows dog sniffing got the location of msvcr90.dll location, at

C:\Program Files\Microsoft Visual Studio 9.0\VC\ce\dll\x86

If your application linking to both MSVCR90D.DLL and MSVCR90.DLL, then solution is simple, you need to ignore MSVCR90 (and if necessary, MSVCRT) when linking.
Now getting coredll.dll error, since msvcd90.dll links to this dll..
Well What is coredll.dll? I can’t find this dll on my PC and Windows CE device too. coredll.dll is roughly equivalent to kernel32.dll on a PC,
then its asking for mmvcr70.dll and mmvcp70.dll ;

Got downloaded all these dll from this site.
You may also use “dumpbin /imports” to debug dll in windows imports API list and find the category for any dll.

Number of View :2225

Tags: , ,

No Comments



SetPageWidth
Content Protected Using Blog Protector By: PcDrome.

Mahol Dot Org is Stephen Fry proof thanks to caching by WP Super Cache