Monthly Archives: June 2015

Fix MSVCR110.dll is missing when starting up WAMP

This can be happen when new OS has been installed..Apache needs this dll file

So  just we have to download the files

I am using win 7 home basic 64 bit(x64)

so here is the link:

https://www.microsoft.com/en-us/download/details.aspx?id=13523
https://www.microsoft.com/en-us/download/confirmation.aspx?id=30679
http://www.microsoft.com/en-US/download/details.aspx?id=15336

Just download those files and then install and open WAMP ..It will run smoothly without any kinds of errors 🙂

Enable Virtualization in Hp Pavillion dv4 Notebook PC

After searching the net I have found the solution…It was painful I can’t installing Android Studio that use Intel  HAXM for Emulating and Virtualization

My windows pc got hanged when enabled the virtualization from the BIOS and logon to the windows 🙁

So I have just proceed to this step to fixed this issue

This linked helped me a lot

Here I got hints

So I did just like this
Turn off Virtualization from Your BIOS then open the windows.. I am using windows 7 64 bit home basic

then go to

My Computer > Advanced System Settings > Advanced Tab > Performance Section > Settings > Data Execution Prevention > Select the button Turn on DEP for all programs and service excepts those I select
2015-06-28 22_01_35-Enable Virtualization in Hp Pavillion dv4 Notebook PC _ Syed Ahmed Zaki

Then restart the computer..

And at the BIOS menu enable Virtualization again and log on to windows

It will work like a charm if the steps follows perfectly 🙂

Check the virtualization from CMD by typing > “systeminfo”

and you will find something like this

2015-06-28 22_05_02-C__Windows_system32_cmd.exe

😀

C++ OOP:

C++ is a OOP Version of C…
A class is a blueprint of an object…..Basically a object is created from class

c++ class define:

 

 

c++ object define:

Here we are declaring two objects of a class Box

Box box1; // declare box1 of type Box
Box box2; //declare box2 of type Box

Basic example of OOP here :

C++ Class Member Functions:

2015-09-26 01_01_14-_D__desktop_desktop september_oop_access.exe_

We use this process to avoid direct access to the members of the class

Another technique, we have used scope resolution operator :: to define the same function outside the class that means if we want to define class in outside from the class then we have to use scope resolution operator.

 

inside the class we define this like that

and the member function is called just like this in a object from a class

C++ Access Modifiers:

Data hiding is one of the important features of Object Oriented Programming which allows preventing the functions of a program to access directly the internal representation of a class type .The access restriction to the class members is specified by the labeled public,private and protected sections with class body.The keywords public ,private and protected are called access specifiers.

 

A class can have multiple public,protected or private labeled sections.Each section remains in effect until either another section label or the closing right brace of the class body is seen.The default access for members and classes is private.

The public members:

A public meber is accessible from anywhere outside the class but within  a program.You can set and get the value of public variables without any member function as shown in the following example:

2015-09-26 02_34_55-access.cpp - Code__Blocks 13.12

 

The private members:

A private member variable or function cannot be accessed or even viewed from outside the class.Only the class and friend functions can access private members.

By default all the members of a class would be private, for example in the following class width is a private member, which means until you label a member, it will be assumed a private member.

Practically we define data in private section and related functions in public section so that they can be called from outside of the class as shown in the following program.

The protected members:

A protected member variable or function is very similar to a private member but it provided one additional benefit that they can be accessed in child classes which are called derived classes.

We will discuss derived classes and inheritance in next .But here I have derived one child class names SmallBox from a parent class Box

Following example is similar to above example and here width member will be accessible by any member function of its derived class SmallBox

 

Structure in C++

struct Books{

char title[50];
char author[50];
char subject[100];
int book_id;

}book;

Structure as Function arguments

 

Pointers to structures:

struct Books *struct_pointer;

struct_pointer=&Book1;

To access the members of the structure  I have to use -> operator as follows

struct_pointer->title;

With typedef:

There are some arrors in teh code  I will fix thsi later..

 

c++ input/output stream

I/O stream:

cerr:

clog:

 

C++ References

 References as parameters
References as Return Value:

 

 

Kaspersky 2015 and windows 7 Homegroup problem

KIS:
http://support.kaspersky.com/10309#block0
See this link

Follow the steps and make your connected network from public to trusted network

https://social.technet.microsoft.com/Forums/windows/en-US/61f37567-6a86-4862-b9be-18367c2fc0cc/kaspersky-internet-security-2010-and-windows-7-homegroup?forum=w7itprosecurity

Homegroup:

http://www.nkonecny.com/blog/2012/01/16/share-an-entire-drive-with-a-homegroup/

Fixing Master Boot Recrord(MBR) issue with BIOS and Windows 7

Insert Windows 7 DVD in the DVD – ROM
then Keep Nexting and Repair Windows option will come then you have to click comamnd prompt when system recovery option comes then click bootrec

>bootrec /fixmbr

and enter then type >exit

then just restart  the system

Boot screen will be back again 🙂

This video helped me a lot by showing how the command perform

C++ Strings

Actually C++ strings are two types

1. Traditional C style character string
2. String class type Introduces in Standard C++

Example of C-style string:

Some builtin strings function came from language C

strcpy(s1,s2); //copies s2 into s1

strcat(s1,s2);  //concatenates string s2 at the end of the string s1

strlen(s1); //returns the length of the string s1..length means actually size that means how many letters is in the string with white spaces and spaces

strcmp(s1,s2); //returns 0 if s1==s2 s1 and s2 are same if less than 0 s1<s2 and greater than 0 s1>s2

strchr(s1,ch);returns a pointer at the first occurence f character ch in string s1

strstr(s1,s2); //retruns a pointer to the first occurence of string s2 in string s1

Example here:

 

In C++ Standard String Class:

Here we are using the library header #include<string> that is c++ built in header for strings manipulation…

C++ Pointer

I tried to clear here my logic for pointer basic

 

Actually in c++ pointer can be declare like this

type  *var_name;

example:

int *ip;
double *dp;
float *fp;
char *ch;

 

C++ NULL Pointers

It actually represent no where

int *zaki=0;
int *dhaka=NULL;

Both the examples meaning the same attitude of the c++

It actually default by the operating systems

Here is one example:

We can also define by this

if(ptr) //it will proceed if p is not null
and
if(!ptr) //it will proceed if p is null

Pointer arithmetic

Incrementing a pointer:

Decrementing a pointer:

Comparison with pointer:

 

C++ pointer vs arrays:

C++ Array of pointers

and also can store data like this with pointer and array mutually

C++ Pointer to Pointer:

 

C++ Array

declare arrays:

arraytype arrayName[arraySize]; //basic syntax

example:

int zakiLive[10];

Initialize arrays:

int zakiLive[5]={4,5,6,8};

zakiLive[3]=8
It means value 8 is in 3rd index in array zakiLive as index in array count from 0 and it goes on..
Here is an example of array

C++ Arrays have some types:

Multi-Dimensional Arrays:

 

syntax can be like this

array_data_type  array_name[size1][size2][size3]……..[sizeN];

Two Dimensional Arrays(It is one kind of multidimensional arrays):

type arrayName[x][y];

Initialize Two Dimensional Arrays:

int a[3][4]={
{0,1,2,3},
{4,5,6,7},
{8,9,10,11}
};

We can also write equivalent like this

int a[3][4]={0,1,2,3,4,5,6,7,8,9,10,11};

We can accesss Two-Dimensional Array elemets by

int valueArray=a[2][3];

Here is a code

C++ Pointer to an Array

Here it is happeing like this shown above.

There are another 2 types of C++ array functioning with pointer

Passing Arrays to Function and Returning Array From Functions

Now let discuss in details

Passing Arrays to Function:

What we know from the function  synatx is

But it’s not possible to pass a full array to the argument by using an index number..But we can pass an array by using without an index..This process can be done by three steps

Way-1
Formal Parameters as a pointer

Way-2
Formal Parameters as a size array as follows

Way-3
Formal Paramaeters as an unsized array as follows

The example given here with array without size

 

Return Array from Functions:

We will discss this later more In Sha Allah 🙂

C++ Numbers

defining numbers in c++

code:

Mathematical Functions:

C++ has some predefined library functions for mathematical calculation.We have to use the header #include<cmath> for using this

example:

 

 

C++ Nested Switch , Nested If

Nested If,Else If,Else:

 

Just another example here:

Nested Switch Statement:

 

 

 

C++ Ternary Basics clear

Last tutorial we have seen about ternary

But the question is why we use ternary ?

the same we can write like this

or like this

So the syntax is:

Just like the if else paradology

Code:

 

c++ decision making

switch statement

 

IF statement

 

if..else Statements

 

 

if…else…if statements

 

Ternary Operator

(a<b)?true:false;

example: