sergey.a.kabanov
BAN USERI am an accomplished Software Engineer with over twenty-six years of experience in Object-Oriented design and development and over fifteen years in the U.S as a Senior / Lead Software Engineer, who is an expert in:
• full life cycle software (SDLC) project design and development
• project time line and resources calculation
• strategic decisions (project structure, program languages, algorithms and technologies)
• program architecture, development, testing, deployment, and technical documentation
• customer support
• technical leadership of 2 - 5 members team
Sergey Kabanov
10520 Chapel Hill Rd, Unit 111
Morrisville, NC 27560
Cellular: (630) 731 83 93
E-mail:
sergey.a.kabanov@gmail.com
U.S. Permanent Resident
http://www.linkedin.com/pub/sergey-kabanov/23/458/b64
My C++ programming and algorithms blog at CareerCup:
http://www.careercup.com/user?id=12402466
OBJECTIVE
To secure a challenging position as a SOFTWARE ENGINEER, SOFTWARE ARCHITECT and/or a team leader.
SUMMARY
An accomplished Software Engineer with over twenty-six years of experience in Object-Oriented design and development and over fifteen years in the U.S as a Senior / Lead Software Engineer.
Responsibilities:
• full life cycle software (SDLC) project design and development
• project time line and resources calculation
• strategic decisions (project structure, program languages, algorithms and technologies)
• program architecture, development, testing, deployment, and technical documentation
• customer support
• technical leadership of 2 - 5 members team
Environments, tools, and libraries used for software development:
• Primary program languages: Visual C++, C/C++, C, VB
• Primary software design environments: MS Visual Studio (2003…2015), Code Composer Studio (V5), WinCE Platform Builder
• Primary operating systems: WINDOWS NT/2000/XP/Vista/2003 Server/2008 Server/2012 Server, WinCE 5.0, WINDOWS 7, WINDOWS 8.1
• Auxiliary operating systems: MS DOS, UNIX, Sun Solaris
• Auxiliary program languages: VJ++, VB scripts, Java scripts, Borland C++, FORTRAN, Pascal, Assembler
• Software modeling tools: IBM Rational Rhapsody
• Notification languages and standards: SQL, XML, JSON, HTML, HL7, DICOM, FHIR
• Libraries: MFC, WIN32API, WinCE API, STL, ATL, GDI+, GDK, Windows Media SDK, WMI, OpenGL, Qualcomm, Novatel, Franklin, Sierra and Dialogic API, RESTful API
• Components and controls: COM/DCOM/COM+, ActiveX, WMI
• Data access models: ODBC/DAO/ADO, SAP as database security layer
• Databases: MS Access, SQL Server, DB2, Oracle
• Protocols: CAN-BUS, TCP/IP, Telnet, FTP, RCP, ASAI, VoIP, Token Ring
• Wireless technologies: GSM, CDMA, WiMax
• Special purpose servers: CTI, IIS, VPN, SAP
• VMWare and Hyper-V virtual machines
• Middleware: SQL data access (ADO, ODBC), XML and JSON interpreters, IIS
• Installation environments and tools: InstallShield, MS Visual Studio Installer, Visual Basic Installer
• Source control tools: VS Source Safe, Tortoise SVN, CMake, IBM Clear Case, Seapine Surround, Team Foundation Server
• Software testing tools: VectorCast
• Team coordination and product development managing systems: JIRA, Mercury Quality Control system, Team Foundation Server, Scrum / Agile
• Documentation systems: IBM Rational Doors, eMatrix
Software design and development experience areas:
• Real time multithreaded and multi-component medical images storage and control systems design, development and support
• DICOM and HL7 (HIIS) servers
• XSD and XDR schema editing tools for HL7 and XML translation servers
• Data communication protocols architecture, design, development and implementation
• Medical devices embedded software control and testing systems based on CAN BUS protocol
• Real-time, multithreaded wireless data access systems based on 3G (GSM, CDMA) and 4G (WiMax) technologies, designed and developed in C++ and STL for Windows 32 and Windows 64 platforms, and running on USB modems, Express cards, and PC cards
• Design and development of real-time video and image processing (AVI, MPEG, H.264, WMV, JPEG, PNG) surveillance systems with remote video sources in C++ and STL for Windows 32 and Windows 64 platforms
• Windows GUI design and development in C++, MFC, and STL
• Wireless video broadcasting and video / image compression development in C++
• C++ based Multi-threaded and multi-processed applications, parallel processing
• Video processing software plug-ins for surveillance server systems in C++ and VB
• 3D graphics based on OpenGL
• Integration with GPS systems
• Remote database control, relational database management systems (RDBMS) in C++ and SQL
• Database security layers’ design (SAP), based on C++, SQL, and ADO/DAO/ODBC
• 3D surface inspection applications in C++
• Software copyright defense and licensing procedures designed and developed in C++
• Special file access systems above FAT32 file system for portable devices made in C and C++
• Win CE based embedded system applications for tablet PC
• PDA based embedded server and Internet browser based client C++ software
• XML and JSON interpreters designed and developed in C++
• Network applications with TCP/IP protocol and Winsock API design and development in C++
• ActiveX components and COM servers integrated into MS Office applications made in C++ and Visual Basic
• Front end GUI products for Lucent/Avaya and AT&T IVR systems made in C++ and Visual Basic
• Internet and Intranet communication client/server applications design and development in C++
• Windows C++ based GUI tools for WINDOWS NT/2000 and UNIX - based IVR systems
• Multithreaded environments for TCP/IP socket data transfer between mainframe, WINDOWS NT/2000 server and UNIX-based IVR systems
• multi-tier C++ based applications with WINDOWS NT/2000/XP front end and UNIX back end
• Remote MS Access, SQL Server, DB2, and Oracle database control systems made in C++ and VB
• Computer Telephony Interactive Voice Response (IVR) applications made in C++ and Visual Basic
• Call centers telephony systems, voice processing boards support packages, WMA and MP3 audio codec
• Computer Telephony Integration (CTI) systems design and development in C++
• Communication between IVR and remote databases (including AS/400 servers and mainframes)
• IVR systems integration with third party text-to-speech and speech recognition systems and MS Internet Information Server (IIS)
• Credit card transaction gateways development in VB
• C++ and ATL based MMC snap-ins based GUI
• Embedded multi-processor systems design and development in C++
• Radio and TV studios design systems written in C++
• Parallel and serial ports (RS232, RS485) communication interfaces written in C and Assembler
• Trade network systems design and development in VB
• Multimedia training systems design and development in C++
• C++ based real-time remote devices control for radio and TV studios and for airline traffic systems
• C++ based real-time aerospace surveillance systems
• C based GUI systems for airline companies staff training
• Space satellite image processing systems design and development in C and Assembler
• Java applets and scripts based GUI help systems
• Customization of 3rd party applications
• Team leadership, presentations, exhibitions, and customer support
• FDA regulations based documentation
PROFESSIONAL EXPERIENCE
November 2013 – Present
FujiFilm Medical Systems USA, Inc., Raleigh, NC, USA
Lead Software Engineer
• Design, development, testing and support of real time, multithreaded and multi-component medical images storage and control systems
• DICOM & HL7 (HIIS) servers, integrated with IIS and Oracle database
• XSD and XDR schema editing tools
• Auxiliary utilities to measure operation timing for physical and virtual (VMWare and Hyper-V) machines performance comparison
• Oracle database stored procedures control
• National languages support / system localization
• Remote management of the overseas team
• presentations, exhibitions, and customer support
Main projects:
• Synapse:
Real time, multithreaded and multi-component system for medical images storage and management, works with DICOM standard for binary images, HL7 (v 2.4, 2.5) standard for information messages, consists of DICOM server, HIIS, Oracle database server, and client workstation, integrated with configuration tools, simulators, and IIS7 for internet access
• Fox:
The next generation of Synapse system: 64 bit components, HL7 v3 (RIM) and FHIR standards support, IIS8 integration
Environments, libraries, protocols, and technologies used:
Windows 2008 R2 and 2012 R2 64 bit servers, VMWare and Hyper-V virtual machines, Visual Studio 2010…2013, C/C++, MFC, STL, COM/DCOM/COM+ components, XML, XDS, XSD, DICOM, HL7 and FHIR notification standards, TCP/IP protocols, RESTful API, ADO and SAP for remote database access.
February 2012 – October 2013
Terumo Heart Inc., Ann Arbor, MI, USA
Lead Software Engineer
• Design, development, testing and support of universal data communication protocol between embedded controllers and external software systems
• Medical devices embedded controllers’ software
• Real time, multithreaded simulation systems for medical equipment communication and reliability testing
• Close coordination with quality assurance team
• FDA regulations based documentation
Main projects:
• DuraHeart II:
Real time software system for human heart pump control
• DTS:
Windows platform based system for human heart pump control software development and testing: CAN packets sniffer, filter and analyzer, embedded devices and data simulation
• CCE:
Universal data communication protocol between embedded medical devices
Environments, libraries, protocols, and technologies used:
Visual Studio 2010, C/C++, MFC, STL, Code Composer Studio V5, third party SDK libraries for communication interfaces (particularly for PCAN interface), IBM Rational Rhapsody as software modeling tool, Visual Source Safe and Seapine Surround as source control tools, VectorCast as software testing tool, IBM Rational Doors as documentation tool
September 2009 – January 2012
Smith Micro Software Inc., Chicago, IL, USA
Senior Software Engineer
• 3G (GSM, CDMA) and 4G (WiMax) technologies based real-time mobile data access software systems (particularly for Sprint, Verizon, AT&T, Comcast, and Clear mobile carriers)
• Wireless data access device software components
(particularly for Franklin, Sierra, Novatel, Qualcomm, and ZTE mobile devices) for multi-tier applications with User Interface front end and device-oriented back end
• Coordination with third party software development and quality assurance teams
• Customization of third party components and applications
• Management and improvement of application building utilities, and source control systems
• XML interpreters
Main projects:
• Sprint Smart View, AT&T Connection Manager, Clearwire Connection Manager, Time Warner Cable Connection Manager, Xfinity Comcast Connection Manager:
Multi-threaded real-time wireless data access software systems made for Sprint, AT&T, Clearwire, Time Warner Cable, and Comcast mobile carriers, and designed to work with variety of mobile devices: embedded modems, USB modems, express cards, and PC cards.
Environments, libraries, protocols, and technologies used:
MS Visual Studio.NET and MS Visual C++ environment, MFC, STL, ATL, WIN32API, Windows Media SDK libraries, third party SDK libraries for variety of mobile access devices, XML, Visual Source Safe, Tortoise SVN system, JIRA team tracking and coordination system
March 2004 – August 2009
Siemens Corporate Research Inc., Princeton, NJ, USA
Senior Software Engineer
• Real-time multi-threaded, multi-processor, and multi-task video and image processing (AVI, MPEG, H.264, JPEG, PNG) for security and surveillance systems
• Video / image compression and wireless video broadcasting
• Video processing software plug-ins for surveillance server systems
• Integration with OpenGL 3D graphics and GPS systems
• 3D surface inspection applications
• Remote database control and database security systems (SAP)
• Large memory allocation management
• Software copyright defense and licensing procedures
• ActiveX components and COM servers for real-time video and still image processing, integrated with MS Office applications
• ATL real-time components for portable / mobile devices and embedded systems, integrated with Internet browser based clients
• Special file access systems (Power Down Consistency File System) above FAT32 file system for portable devices
• XML and JSON interpreters
Main projects:
• RailProtect:
Multi-source, multi-threaded real-time video and image (AVI, MPEG, H.264, JPEG, PNG) processing, compression and wireless broadcasting security and surveillance MFC-based system, integrated with 3rd party video processing plug-ins, GPS systems, and software copyright defense and licensing procedures.
The system is now installed at New York train stations.
• Borescope:
Multi-source, multi-threaded real-time video and still image processing MFC system, based on COM server, integrated with MS Office applications and embedded into mini-PC panel.
• Global Inspection System:
Multi-processed 3D surface inspection MFC-based system, integrated with OpenGL graphics, using remote database control and database security layers (SAP), large memory allocation management, multi-core processor and multi-process resources optimization.
• Colorado:
Real-time, multi-threaded and multi-processed ATL-based system of COM components, integrated with XML and JSON interpreters, and embedded into portable PC panel or WinCE based mobile device.
• PDCFS:
Power Down Consistency File System – special file system layer above FAT32 system for WinCE based portable devices.
Environments, libraries, protocols, and technologies used:
MS Visual Studio.NET and MS Visual C++ environment, MFC, STL, ATL, WIN32API , GDI+, GDK, OpenGL libraries, Windows Media SDK libraries, WMI, WinCE API , WinCE Platform Builder, COM/DCOM/COM+ components, ActiveX controls, XML, JSON, SQL and ODBC/DAO/ADO for remote database access.
May 1998 – March 2004
WebSci Technologies, Inc. / eComServer, Inc. / Bhrigus, Inc., Princeton, NJ, USA
Senior Software Engineer
• Interactive Voice Response (IVR) applications for Dialogic hardware based Voice Response systems
• Computer Telephony Integration (CTI) systems
• Communication between IVR and remote databases (including AS/400 servers and mainframes)
• Dialogic hardware based IVR systems integration with third party text-to-speech (NeoSpeech) systems, speech recognition systems (SpeechWorks), and credit card transaction gateways (TrustCommerce)
• Dialogic hardware based IVR systems integration with MS Internet Information Server (IIS)
• Remote VXML interpreter servers for Dialogic platform based IVR
• WINDOWS NT/2000/XP based front end software products for Lucent/Avaya and AT&T IVR systems
• WINDOWS GUI remote control environment for administration and maintenance of multiple UNIX-based CONVERSANT IVRs, via TCP/IP, Telnet, RCP and FTP protocols
• WINDOWS NT/2000/XP client desktop programs designed as stand-alone applications and as Microsoft Management Console (MMC) snap-ins set
• WINDOWS GUI report generation systems and remote SQL Server and Oracle database management for call centers
• Web design GUI, remote database control and report generation systems
• Multimedia demonstration programs, remote login and encryption applications, keystroke generation tools, operation system control tasks
• Work team management, presentations, exhibitions, and customer support
Environments, libraries, protocols, and technologies used:
Dialogic hardware for WINDOWS NT/2000 platform, MS Visual Studio.NET (VC++ and VB languages, VB scripts) and Jbuilder environments, MFC, STL, ATL, Dialogic API, WIN32API libraries, JDK libraries, SpeechWorks OpenVXI libraries, COM/DCOM/COM+ components, ActiveX controls, OLE automation, SQL language and ODBC/DAO/ADO for remote data access.
May 1996 – April 1998
Computer Technologies House, Moscow, Russia
Software Engineer
• Multimedia English language learning system for Russian speakers
• Business information systems for software production trade companies
Environments, libraries, protocols, and technologies used:
MS Visual Studio environment (VC++ and VB languages, VB scripts), MFC, STL, WIN32API libraries, ActiveX controls, OLE automation, SQL and ODBC/DAO/ADO for remote data access, Java applets and scripts for help system.
March 1994 – May 1996
MEDIA ENGINEERING, Weiningen, Switzerland
Software Engineer
• Real-time remote control systems for radio and TV broadcasting station equipment
• Radio and TV studio design
• Real-time remote multi-processor control systems for radio and TV studio PBX
Environments, libraries, protocols, and technologies used:
MS Visual Studio (VC++ and VB) and Borland C++ environments, MFC, WIN32API, and OWL libraries,
ActiveX controls.
March 1985 – March 1994
LYRA Designer Office, Moscow, Russia
Software Engineer
• Multiprocessor real-time embedded surveillance systems for airline traffic control and blind aircraft flight
• Hybrid software systems of PC and PDP-11 based embedded processors, with high memory and speed restrictions
• Multiprocessor systems for weather forecast satellite image processing and improvement
• Imitation environments for airline dispatcher training, advertising animated presentation programs
• GUI systems for airline companies staff training and advertising graphic programs
Environments, libraries, protocols, and technologies used:
C, C++ FORTRAN, Pascal, and PDP-11 processor based Assemblers.
INVENTIONS
Method and system for interactive virtual inspection of modeled objects, Patent Application #2006P05376US01, filed in October, 2007.
FOREIGN LANGUAGES
Russian, Ukrainian.
EDUCATION
Honors Master’s Degree in Electrical and Mechanical Engineering specializing in Automatic Control Systems, Bauman Moscow State Technical University, Moscow, 1985.
REFERENCES AND DEMO APPLICATIONS
Available upon request.
The idea is simple:
1). Make an array of 256 number (each index represents the character).
Go through the string, add the number at the index, when we have such character.
2). Take all characters that are in our string even number of times, plus the very first character that we have only once (it can be the middle character in the palindrome).
void SwapAndMoveToTheMiddle(char* pA, char* pB)
{
char cTemp;
if (pA >= pB) return;
cTemp = *pA;
*pA = *pB;
*pB = cTemp;
++pA;
--pB;
SwapAndMoveToTheMiddle(pA, pB);
}
//.............................................................................................................
void ReverseStringWithRecursion(char* pOurString)
{
char *pBegin, *pEnd;
pBegin = pOurString;
while (*pOurString)
++pBegin;
pEnd = pBegin;
pBegin = pOurString;
SwapAndMoveToTheMiddle(pBegin, pEnd);
}
The sum of numbers from 1 to N is: N*(N+1)/2.
We can calculate this sum and compare it with the real sum of array elements.
The difference will be our missing number.
1). Make a linked list with a structure inside:
struct SymbolsAppearance
{
char c;
int iCounter;
}
Going through the string:
if the symbol occurs first time (there is no such "c" in the list yet),
add new element to the list, and make iCounter = 1.
If the symbol already is in the list, increase iCounter for the element with the correspondent "c".
2). Go through linked list and find the first element with maximal "iCounter".
The first method is just to simply go through the array and calculate the sums for all previous elements and all next elements, and compare them.
But is is too inefficient.
More efficient method is:
1). To calculate total sum of all elements.
Growing Sum =0
2). Going through the array, subtract elements from the total sum and add them to growing sum. Compare Growing Sum to the Total Sum. If they are equal - we found our element(s).
class COurList
{
public:
COurList()
{
iValue = 0;
pNext = 0;
}
int iValue;
COurList* pNext;
};
//.............................................................................................................
// Merge 2 sorted lists:
COurList* MergeSortedLists(COurList* pHead1, COurList* pHead2)
{
COurList *pCurrent1, *pCurrent2, *pCurrentRez, *pResultHead;
pCurrent1 = pHead1;
pCurrent2 = pHead2;
// what if we have only one valid pointer?
if ((!pHead1) && (pHead2))
return pHead2;
if ((!pHead2) && (pHead1))
return pHead1;
// first, set up the result header:
if (pCurrent1->iValue < pCurrent2->iValue)
{
pResultHead = pHead1;
pCurrent1 = pHead1->pNext;
pCurrentRez = pResultHead;
}
else
if (pCurrent1->iValue > pCurrent2->iValue)
{
pResultHead = pHead2;
pCurrent2 = pHead2->pNext;
pCurrentRez = pResultHead;
}
else
if (pCurrent1->iValue > pCurrent2->iValue)
{
pResultHead = pHead1;
pCurrent1 = pHead1->pNext;
pResultHead->pNext = pHead2;
pCurrentRez = pHead2;
pCurrent2 = pHead2->pNext;
}
// Now go through the list:
while (pCurrent1 && pCurrent2)
{
if (pCurrent1->iValue < pCurrent2->iValue)
{
pCurrentRez->pNext = pCurrent1;
pCurrentRez = pCurrent1;
pCurrent1 = pCurrent1->pNext;
}
else
if (pCurrent1->iValue > pCurrent2->iValue)
{
pCurrentRez->pNext = pCurrent2;
pCurrentRez = pCurrent2;
pCurrent2 = pCurrent2->pNext;
}
else
if (pCurrent1->iValue > pCurrent2->iValue)
{
pCurrentRez->pNext = pCurrent1;
pCurrentRez = pCurrent1;
pCurrentRez->pNext = pCurrent2;
pCurrentRez = pCurrent2;
pCurrent1 = pCurrent1->pNext;
pCurrent2 = pCurrent2->pNext;
}
}//while
// list remainder:
if (pCurrent1)
pCurrentRez->pNext = pCurrent1;
if (pCurrent2)
pCurrentRez->pNext = pCurrent2;
if (!pCurrent1 && !pCurrent2)
pCurrentRez->pNext = NULL;
return pResultHead;
}
//.............................................................................................................
void CutToFirstKelements(COurList* pHead, const int& k)
{
int i;
if (k <= 0) pHead=NULL;
for (i = 0; i < k - 1; ++i)
pHead = pHead->pNext;
pHead->pNext = NULL;
}
class COurList
{
public:
COurList()
{
iValue = 0;
pNext = 0;
}
int iValue;
COurList* pNext;
};
//.............................................................................................................
// Merge 2 sorted lists:
COurList* MergeSortedLists(COurList* pHead1, COurList* pHead2)
{
COurList *pCurrent1, *pCurrent2, *pCurrentRez, *pResultHead;
pCurrent1 = pHead1;
pCurrent2 = pHead2;
// what if we have only one valid pointer?
if ((!pHead1) && (pHead2))
return pHead2;
if ((!pHead2) && (pHead1))
return pHead1;
// first, set up the result header:
if (pCurrent1->iValue < pCurrent2->iValue)
{
pResultHead = pHead1;
pCurrent1 = pHead1->pNext;
pCurrentRez = pResultHead;
}
else
if (pCurrent1->iValue > pCurrent2->iValue)
{
pResultHead = pHead2;
pCurrent2 = pHead2->pNext;
pCurrentRez = pResultHead;
}
else
if (pCurrent1->iValue > pCurrent2->iValue)
{
pResultHead = pHead1;
pCurrent1 = pHead1->pNext;
pResultHead->pNext = pHead2;
pCurrentRez = pHead2;
pCurrent2 = pHead2->pNext;
}
// Now go through the list:
while (pCurrent1 && pCurrent2)
{
if (pCurrent1->iValue < pCurrent2->iValue)
{
pCurrentRez->pNext = pCurrent1;
pCurrentRez = pCurrent1;
pCurrent1 = pCurrent1->pNext;
}
else
if (pCurrent1->iValue > pCurrent2->iValue)
{
pCurrentRez->pNext = pCurrent2;
pCurrentRez = pCurrent2;
pCurrent2 = pCurrent2->pNext;
}
else
if (pCurrent1->iValue > pCurrent2->iValue)
{
pCurrentRez->pNext = pCurrent1;
pCurrentRez = pCurrent1;
pCurrentRez->pNext = pCurrent2;
pCurrentRez = pCurrent2;
pCurrent1 = pCurrent1->pNext;
pCurrent2 = pCurrent2->pNext;
}
}//while
// list remainder:
if (pCurrent1)
pCurrentRez->pNext = pCurrent1;
if (pCurrent2)
pCurrentRez->pNext = pCurrent2;
if (!pCurrent1 && !pCurrent2)
pCurrentRez->pNext = NULL;
return pResultHead;
}
//.............................................................................................................
void CutToFirstKelements(COurList* pHead, const int& k)
{
int i;
if (k <= 0) pHead=NULL;
for (i = 0; i < k - 1; ++i)
pHead = pHead->pNext;
pHead->pNext = NULL;
}
To me, the idea is to find ALL POSSIBLE ways of going from the upper left to the lower right corner, and to keep the cost of each way in a vector.
Then we find the minimal vector element.
We can traverse the matrix a directed graph using a recursion.
Solution #1:
1). Make a copy of linked list
2). Reverse the copy
3). Merge the original list with the copy up to the middle
Solution #2:
1). Write a function to swap data of "i"th and "N-i"th item of the list:
The sub-function for that is to find "N-i"th item of the list, using 2 pointers (normal one and shifted one).
2). Use that function from i=0 to i = N/2
unsigned __int64 convert(unsigned char* InputString)
{
// We assume that we always have a string for a positive value - no sign
int iLength;
unsigned char* pInputBegin;
unsigned char* pInputCurrent;
unsigned char* pInputEnd;
unsigned __int64 uiResult;
unsigned __int64 uiMultiplier;
// First, we find the end of the string (assuming there is no number bigger than 10**100 in the Universe):
pInputCurrent = InputString;
pInputBegin = InputString;
iLength = 0;
while (*pInputCurrent != NULL)
{
if (iLength >= 100)
{
return 0; // the number is too big
}
++pInputCurrent;
++iLength;
}
pInputEnd = pInputCurrent; // now we point to the last string character
uiResult = 0;
uiMultiplier = 1;
while (pInputCurrent >= pInputBegin)
{
uiResult = uiResult + uiMultiplier * (*pInputCurrent - 48); // ASCII characters 48...57 correspond to digits 0...9
uiMultiplier = uiMultiplier * 10;
--pInputCurrent;
}
return uiResult;
}
#include <vector>
using namespace std;
class ResizableBitmap
{
int iWidth, iHeight;
vector<unsigned char> vPixels;
vector<bool> vMask;
void ResizeVectors()
{
vPixels.resize(3 * iWidth * iHeight);
vMask.resize(3 * iWidth * iHeight);
}
public:
ResizableBitmap()
{
iWidth = 640;
iHeight = 480;
ResizeVectors();
}
ResizableBitmap(int& iW, int& iH)
{
iWidth = iW;
iHeight = iH;
ResizeVectors();
}
~ResizableBitmap()
{
vPixels.clear();
vMask.clear();
}
void CompareWithPreviousBitmap(const ResizableBitmap& PreviousBitmap);
void SomeOperation();
};
void ResizableBitmap::CompareWithPreviousBitmap(const ResizableBitmap& PreviousBitmap)
{
unsigned int i;
// There can be 2 cases:
// 1). Size is changed - the places that were added or substracted - are different
// 2). Size is the same - each pixel is compared with the previous one by "XOR"
if (PreviousBitmap.iWidth < iWidth)
{
// mark the new bitmap fragment as changed
}
if (PreviousBitmap.iHeight < iHeight)
{
// mark the new bitmap fragment as changed
}
if ((PreviousBitmap.iWidth == iWidth) && (PreviousBitmap.iHeight == iHeight))
{
for (i = 0; i < vPixels.size(); i++)
{
vMask[i] = (bool)(vPixels[i] ^ PreviousBitmap.vPixels[i]);
}
}
}
void ResizableBitmap::SomeOperation()
{
unsigned int i;
for (i = 0; i < vPixels.size(); i++)
{
if (vMask[i])
{
// do something only if the pixel is different than the previous one
}
}
}
We should have, let say, 3 Counter Server (to duplicate or even triplicate their functionality in case of one or even two Counter Servers fail).
Each of Work Server (there can be thousands of them) sends the information about the requests quantity every (for example) 15 minutes to all 3 Counter Servers.
The Counter Servers summarize the quantity of requests coming from the Work Servers, and when the sum reaches the threshold, sends the action request (to give a special "doodle" to the special client)
back to the Work Server that gave the last requests quantity information.
If there is no information coming in 15 minutes from one of the Work Servers, The Counter Server decides that there is something wrong with the particular Work Server (server failure).
To prevent Counter Server failure, as I said, we need to duplicate or even triplicate their work.
The correct way is:
class a
{
public:
int x = 7;
static int y;
void f1()
{ x = 24; }
void static f2()
{ y = 35; }
};
If you need a fast search, simply make an array of 256 booleans.
An index will be the input, and the boolean value will be an output.
I think we just traverse the three and keep track of the level where we are. If the current level is the necessary level => print the content.
- sergey.a.kabanov January 16, 2012Create a linked list, for each node you need to have a word and a frequency.
For each new word you read from the file, do the following:
Compare the word with stored words in the list.
If the word is already there, increase the frequency.
If the word is not there, add the new element to the list with the new word and frequency = 1.
A little detail: we need to compare the data in the nodes, not the nodes themself.
- sergey.a.kabanov January 16, 2012The idea is to go left and right from each element until left will be the beginning, or right will be the end.
The initial length of each possible palindrome is 1.
We need to distinguish 2 cases:
1). "Odd" case, like "abcdcba"
2). "Even" case, like "dcbaabcd"
In "even" case, we need to shift our "right" pointer to one position right and to increasr the current length.
During each next move, we increase our current palindrome length on 2, if the left and the right characters are the same.
When palindome stops (we reach the array borders, or our left and right characters are not the same any more),
we compare our current palindrome length with the previous maximal length.
void FindLongestPalindrome(char Arr[])
{
char* pCurr; // moving through our string
char* pBegin; // the beginning of the string
char* pEnd; // the end of the string
char* pLeft; // to go left from the current character
char*pRight; // to go right from the current character
int iMaxIndex=0;
int iCurIndex=0;
int iMaxLength=1;
int iLength;
pCurr=pBegin=&Arr[0];
pEnd=pBegin;
while(1)
{
pEnd++;
if(*pEnd=='\0') break;
}
// now pEnd points to the end of our array
while(1) // go through the array
{
iLength=1;
//Odd case:
pLeft=pRight=pCurr;
//even case:
if((*pLeft)==(*pRight+1))
{
pRight++;
iLength++;
if(pRight>pEnd) break;
}
while(1)
{
if((*pRight) != (*pLeft)) break;
pLeft--;
pRight++;
if((pLeft<pBegin) || (pRight>pEnd)) break;
iLength = iLength+2; // because we add characters from the left and from the right
}
if(iLength > iMaxLength)
{
iMaxLength = iLength;
iMaxIndex = iCurIndex;
}
pCurr++;
if(pCurr>pEnd) break;
iCurIndex++;
}
// Now we have iMaxIndex as the beginning of longest palindrome, and iMaxLength as it's length
for(int i=iMaxIndex; i<=iMaxIndex+iMaxLength; i++)
printf("%c", Arr[i]);
printf("\n");
}
But to do that, we need to know how many pills each bottle contains!
And it should be the same quantity of pills in each bottle.
Then it is easy:
Let say, we have 10 pille in each bottle.
Then, if all of them contain heavy pills, they all together should weigt:
90+80+70+60+50
If we have light pills in the first one, they should weight:
(90-9)+80+70+60+50
If we have light pills in the second one, they should weight:
90+(90-9*2)+70+60+50
And so on.
(x<<3)+(x<<1) is equivalent of "x*10", i.e. (x*8)+(x*2)
- sergey.a.kabanov January 14, 2012The inplementation of pure virtual function will be ignored by the compiler, unless it is pure virtual destructor.
class Basez
{
public :
virtual void method () = 0;
private :
int n;
};
void Basez::method()
{ n = 1;} // will be ignored in compilation time
class D1z : Basez {};
class D2z : public D1z
{
int i;
void method() {i = 2;}
};
"main":
//Basez bsz; // cannot do this
Derivez* dsz = new D2z();
dsz->method();
//dsz->Basez::method(); // cannot do this
Actually, you cannot declare uninitialized reference only OUSIDE the class body.
Inside the class, you can do it, but after you will not be able to create an object of the class, you will get an error
"no default constructor":
class Bugaga1
{
int& i;
};
//Bugaga1 bugug; // if you have an unitialized reference inside the constructor, you cannot create the object (it will say "no default constructor")
//Bugaga1* bugug;
//bugug = new Bugaga();
extern void asprint(int *ia, int sz);
void asprint(int *ia, int sz); // okay, compiler ignores the word "external", i.e.it does not make any sense for function definitions
void asprint(int *ia, int sz);
void asprint(int *ia, int sz); // okay, we ignore the second definition, as it it the same as the first one
void asprint(float *ia, int sz);
void asprint(int *ia, int sz); // still okay, function overloading
int asprint(int *ia, int sz);
void asprint(int *ia, int sz); // OOPS! function redefinition with different returning type! Error!
Since throw specification is NOT the part of function signature , there is nothing wrong with the code. Moreover, it will normally call "abc()" of the derived class in the following situation:
Foo* fo;
fo = new DFoo();
fo->abc();
delete fo;
Actually, in case of:
char a[]='';
it compiles with sizeof(a) = 1.
I think the question is about explicit conversion operators.
Like that:
class A
{
private:
double d;
public:
A(double x):d(x){}
operator double()
{return d;}
}
In "main":
A a(2.0);
double dd;
dd=a;
Very good solution!
Private destructor plus static constructor/destructor idiom...
Just one little addition: we also need to make our "new" operator as private,
else we still can create an object using "new"!
This is actually "placement new" operator, not operator "new" overloading.
- sergey.a.kabanov January 14, 2012Actually, we cannot make a template virtual function inside the class. Do you mean a template class with virtual function in it?
- sergey.a.kabanov January 14, 2012that is because your Vs2008 is 32 bit application!
- sergey.a.kabanov January 14, 2012To be quite correct, if you use 64 bit compiler.
If you use 32 bit compiler running on 64 bit system, the result still will be 4.
we can use so called "virtual constructor idiom", i.e. virtual function that creates a new object inside and returns the pointer on is.
In case of Exemplar we simply create a new object, in case of Clone we copy the existing object to the new one:
class Baseclass
{
public:
Baseclass(){}
virtual Baseclass* clone();
virtual Baseclass* exemplar();
};
Baseclass* Baseclass::clone()
{
return new Baseclass(*this);
}
Baseclass* Baseclass::exemplar()
{
return new Baseclass();
}
class Derivedclass : private Baseclass
{
public:
Derivedclass(){}
virtual Derivedclass* clone();
virtual Derivedclass* exemplar();
};
Derivedclass* Derivedclass::clone()
{
return new Derivedclass(*this);
}
Derivedclass* Derivedclass::exemplar()
{
return new Derivedclass();
}
My understanding they ask about object creation in the heap
- sergey.a.kabanov January 13, 2012No, because the "friendship" should be declared INSIDE the base class, not outside!
- sergey.a.kabanov January 13, 2012No, using pointers to call a function is just calling a function using pointer! ;)
Something like that:
class OurClass
{
void a();
void b();
void c();
};
void OurClass::a()
{ printf"Ourclass.a()\n");}
void OurClass::b()
{ printf"Ourclass.b()\n");}
void OurClass::c()
{ printf"Ourclass c()\n");}
typedef void (OurClass::*OurClassMemberPointers)(int);
OurClassMemberPointers[3] = {&OurClass::a(), &OurClass::b(), &OurClass::c()};
inside "main":
OurClass x;
for(int i=0;i<3;i++)
{
OurClass* p = OurClassMemberPointers[i];
(x.*p)(); // call the function by the pointer, i.e. a,d.c sequentially
}
First of all, this will not work:
void A::foo(void )={};
It will be considered as function redeclaration.
Second, if the base class destructor is pure virtual, you cannot make a derived class object without explicit definition of the base class destructor.
You can make a function virtual inside template class,
but you cannot make a template virtual function inside a class.
Another words:
template <class T> class A
{
virtual void f(); // possible, creates vtable pointer, class size = 4
};
class A
{
template <class T> virtual void f(); //impossible: compiler does not know how to make vtable (they will be different for each type)
};
I believe this is right.
Cases b) and c) change the size of the class, other cases do not.
When you say:
const int &b=i;
That does not mean "constant reference", but "reference to the constant object".
Because the function body is associated with the class itself,
not with the object.
For example:
class Agg
{
int a;
int b;
static int c;
static int d;
void show()
{a=b;}
};
What do you think will be the size of Agg object?
It will be 8. The space for integers a and b.
Everything else (function bodies and static members) is associated
with the class itself, and will not be COPIED into every created object of that class.
Here is an illustration how the program crashes trying to delete statically created object:
void InsertLeadingDigitIntoArray(int*& Arr, int& n)
{
Arr[Index]=0;
int* Arr2;
Arr2 = new int[n+1];
Arr2[0] = 1;
memcpy(&Arr2[1], &Arr[0], n*sizeof(int));
delete [] Arr; // BANG! Here it crashes! - trying to delete dynamically (from the heap)
Arr = Arr2;
n++;
}
// inside main:
int Array[]={4,5,6,7,8,7,6,5,4,3,2}; // statically allocated (in the stack)
int* Arr=&Array[0];
int n;
n=sizeof(Arrray)/sizeof(int);
InsertLeadingDigitIntoArray(Arr, n);
No, it will not work.
Actually, it will not work even if we say:
cout<< b.i <<endl;
We should be inside the class to access it's private members!
Something like that:
OurSingleton* GetInstance()
{
if (pInstance == NULL)
{
EnterCriticalSection(&cs);
if (pInstance == NULL)
{
try
{
pInstance = new OurSingleton();
}
catch(...)
{
// do something
}
}
LeaveCriticalSection(&cs);
}
return pInstance;
}
I think it is the best solution!
- sergey.a.kabanov January 13, 2012Actually, we even do not need to check the concatenation for this particular task. It is enough to find the MIN element, which is exactly our index.
- sergey.a.kabanov January 13, 2012Can be done without recursion:
class Nodex
{
public:
bool visited;
int a;
Nodex* parent;
Nodex* left;
Nodex* right;
};
Nodex* NodeHead;
// set NodeHead to the root
void TraverseWitoutRecursion()
{
Nodex* current;
current = NodeHead;
while(1)
{
if(current==NULL) break;
if((current->left != NULL) && (current->visited==false))
current = current->left;
else
if((current->right != NULL) && (current->visited==false))
current = current->right;
else
if(current->visited==false)
{
printf("node value = %d", current->a);
current->visited = true;
}
else
current = current->parent;
}
}
Assume we have positive value.
Arr = input and output array pointer,
n = input and output array length.
void IncreaseArray(int*& Arr, int& n)
{
int Index;
bool bQuit=false;
// start from the end backwards to the beginning:
for(Index=n-1;Index>0;Index--)
{
if(Arr[Index]<9)
{
Arr[Index]++; // we just increase the value and quit
bQuit=true;
break;
}
else // i.e. the digit == 9
{
Arr[Index]=0; // thanser to the next digit
}
} // now we are at index "0", if we went through all loop
if(bQuit==true) return;
// special case: the very first digit:
if(Arr[Index]<9)
{
Arr[Index]++;
return;
}
// if the array was "9999", we need to make it "10000":
Arr[Index]=0;
int* Arr2;
Arr2 = new int[n+1];
Arr2[0] = 1;
memcpy(&Arr2[1], &Arr[0], n*sizeof(int));
delete [] Arr; // actually, we should not do that, as Arr can be a pointer to a STATIC array!
Arr = Arr2;
n++;
}
Is the simpliest solution just to check every new element for the sum with the previous ones, until the sum be the right one?
let say, necessary sum = 5.
Add the first element: 1
Add the next one: 3
check: 1+3 != 5
Add the next one: 8
check: 1+8 != 5
check: 3+8 != 5
Add next one: 2
check: 1+2 != 5
check: 3+2 == 5
Bingo! Our elements are : 1st and 4th.
In my opinion, the question is how to keep track of 100 biggest numbers of the huge file / array / database.
When first 100 elements come to the file, we remember each of them in the array of 100 integers, and also keep tracking
of what is MIN and what is MAX.
After all 100 indexes are occupied, we do the following upon the next element coming:
If the current element <= MAX element of the array - do nothig;
If the current element > MAX element of the array:
a). Insert this element into array on the place of MIN element;
b). Recalculate MIN and MAX elements of the array.
- sergey.a.kabanov September 28, 2016