Software fixes and design and development




Void threadfunc (void *parameters){

Int aMem [1024][1024];

Char *p = “hello”;

Thread body;


This is not instantiating thread and exception occurring. What could be the exception


The stack overflow exception

The default stacksize is 1MB for most of the Os

Array of 1 mb integers will overflow stack size, due to which thread won’t init and raises exception.

Using right design pattern

 Design patterns will be used a lot now a days. But identify correct design pattern will fetch more benefits.

Problem: We need to develop a library which can talk to Oracle and Sql server.

Factory design pattern.

Use same interface but different implementation for underlying database.

Please post in comment if much more good design pattern available.

Powerful object oriented programming

Problem: There is a function which will fill the buffer from source to destination and if source is less than destination remaining destination need to be filled with spaces. Now that need to be filled with null values. Or some specific value. This function is all over code base. How do you pass the specific value without changing function usage through code base.

It func (int *ptr, int *dst, int srclen, int dstlen)


Change the function like this

Int func ( int *ptr, int*dst, int srclen, int dstlen, int val)

Change the body of the function with val.

Function overloading allow new function change without modify the whole code base. No need to rename the whole code base with function parameter change.

This solution useful for so many occasions.


There is an object created and used throught the code base. It has constructor well defined. Now it need to be changed to object pointer instead of object variable throught the code base. For example, class cExClass {
cExClass() { }
~cExClass() { }
void somefunc() { }

cExClass oExObj;


The above kind of code used everywhere. Now it need to be changed to oExObj->somefunc(), that means you have to create dynbamic memory to the object only. Not object as value. How do you achieve end result without changing entire code base.


Create the object with dynamic memory allocation.
cExClass *oExObjp = new cExClass();
cExClass oExObj(*oExObjp);

Careful about copy constructor and assignment operator implementation for the class.

Implement proper destructors.

Pointer arithmetic and memory leaks

Int *ptr = new int [1024];For (int I=0; I <1024; I++)
Print (ptr [I+10]);Desired to print all elements from 10th element but bugHow and where.Solution:Always remember to boundary checks for dynamic memory.So it will be

For I= 0; I <1024 -10; I++;
Print (ptr [I+10]);

Problem: How can you find size of structure without using sizeof


Struct p {
Int I;
Char k;
Struct a b;

Simple solution is

Struct p *ptr;

Struct p* qptr;

Struct p* sptr = ptr;

Qptr = ++ptr;

Return qptr – sptr;

What is the output of
Char * s = “hello”;

Strcpy (s, s+1);


Memory exception in some weak OS.

Windows device driver development WDF

 Windows device driver development using WDF framework is easy if can maintain certain points while developing.

Problem: opening device handle in ioctl. This one will crash the system if properly not used.

Open the device handle in the init driver entry point and save it in device context.
In ioctl take the handle from device context and use it for operations.

 We will use STL in c++ a lot and it’s good practice. But in some compilers this problem exists for lists.

Std::list <object> oList;

Here by default in some compilers two objects will be created in list. Which cause 2 object constructors will be called by mistake. If the constructor expect to init with memory then exception will come.

Std::vector <object> oVector;

Sometime safe to use.

However design choices can opt anyone of them.

Fixes for problems during configuring Jenkins for Linux as master and Windows as slave node to build

We will go through various step by step procedures to configure CI tools like Jenkins to set up builds. But often we will encounter various problems while we follow the procedure exactly. This blog will give some techniques to save some time for developers and system administrators.

Problem: Unable to git clone repository in Windows Slave node using GIT+SSH.

Solution: Use C:\Program files\Git\Cmd\Git.exe.

Set this as path for environment variable for GIT in Jenkins master while configuring Windows Slave.

Manage Jenkins -> Manage Nodes -> Select Slave -> Configure -> Environment Variables -> Add.

Problem: master rejecting connection that is already connected for Jlnp protocol.

Solution: Goto global configuration settings in master Jenkins. Enable slave to master connectivity.

Problem: Unable to build the sln file using msbuild.

Solution: Jenkins master -> windows batch commands

Goto desired folder where sln located.  Using cd
Give complete path to vcvarsall.bat
Give the msbuild file. Sln

Blog by Ashoka Bantumilli

Leave a Reply

Required fields are marked*