Affichage des articles dont le libellé est Tutorial. Afficher tous les articles
Affichage des articles dont le libellé est Tutorial. Afficher tous les articles

lundi 24 mars 2014

[Q] Need for a tutorial to enable Diag Mode and backup NV Data on AOSP Roms? topic




First of all, I am very new to this forum so I am sorry if this is the wrong place to ask. Thank you. :)
The Question I asked myself was, is there a way to restore your IMEI und NV Data on an Custom Rom like CyanogenMod where the *#0808# or other codes don't work. And the answer was in this threat http://forum.xda-developers.com/show...626638&page=11.
But for me it took 3 to 4h to fight myself through the wrong drivers, different settings and so on.
Plus because of EFS-Professional you can skip the first part and automatically change it into Diag-Mode.
Yes, I do not have a lot of experience but maybe sb with experience can write it. I think it would be nice to have a tutorial where it is explained step by step which would make the back ups of IMEI and NV Data a lot easier on Custom Roms. :)
I would like to talk about the idea and I am just putting it in the room. :)
Thank You





mercredi 19 mars 2014

[Tutorial] New method for advanced menu topic




After being bombarded by an old friend to get back into game hacking. I came back out of retirement with some fresh ideas.

With this return, I wanted to have one the snazziest menu available. While putting in the minimal amount of work possible.




The idea is simple. Structure with HTML, style with CSS, animate and function with JavaScript. Things I already do on a daily basis for a living.

The menu "emulator" is a C# executable with a WebBrowser control. The emulator reads the live elements and stores their values in a settings file.

The emulator is run from a dll that then waits for the emulator to message that it is ready. By enumerating the child windows, I was able to get down to the Internet Explorer window that was embedded inside my application.

Using PrintWindow() and a HBITMAP variable. I am able to stream the browser into a LPDIRECT3DTEXTURE9 variable which is then drawn as a sprite.

Since the bytes are read or displayed in reverse, I used D3DXMatrixTransformation2D() to flip the image right side up.

Using GetCursorPos() and GetAsyncKeyState(), I tracked and then sent the mouse input from the game to the browser using SendMessage().

I essentially made a quick in game browser that only displays my menu.
With this method, I can add options instantly and even create elaborate controls without having to deal with the difficult and painful process of prim and sprite elements.

I haven't cleaned up the code, its available for anyone who wants to skim it


PHP Code:







void CaptureWindow(HWND hWndRECT clientRectDWORDpResultDWORD sizebool image)
{
   
int bits;
   
   
HDC clientDC,
       
memoryDC;
   
   
BYTEpAddress;

   
DWORDpRet;
   
   
HBITMAP hBitmap;

    
BITMAPINFO bmpInfo;

   
   
bits 32;
   
pRet 0;
   
    
BITMAPFILEHEADER bfHeader 
   { 
      
0x4D42
      
0
      
0
      
0
      
sizeof(BITMAPFILEHEADER) + sizeofBITMAPINFOHEADER
   };

    
BITMAPINFOHEADER biHeader 
   {
      
sizeofBITMAPINFOHEADER ),
        
clientRect.right,
        
clientRect.bottom,
        
1,
        
bits,
        
BI_RGB,
        
NULLNULLNULLNULLNULL 
   
};


    
bmpInfo.bmiHeader biHeader;

    
clientDC GetDC(hWnd);
   
memoryDC CreateCompatibleDC(clientDC);
    
hBitmap CreateDIBSection(clientDC, &bmpInfo, (bits == 32 DIB_RGB_COLORS DIB_PAL_COLORS), (VOID**)&pAddressNULLNULL);

    
SelectObject(memoryDChBitmap);
      
   
PrintWindow(hWndmemoryDCNULL);

    
DeleteDC(memoryDC);
    
ReleaseDC(hWndclientDC);


   if(
image == true)
   {
      
memcpy(pResult,                                                         &bfHeader,  sizeof(BITMAPFILEHEADER));
      
memcpy((DWORD*)((DWORD)pResult sizeof(BITMAPFILEHEADER)),                              &biHeader,  sizeof(BITMAPINFOHEADER));
      
memcpy((DWORD*)((DWORD)pResult sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)),   pAddress,   size);
   }
   else
      
memcpy(pResultpAddresssize);

    
DeleteObject(hBitmap);
}

bool IsFocused()
{
   
DWORD id1,
         
id2;

   
HWND hActive;


   
hActive GetActiveWindow();

   
GetWindowThreadProcessId(hActive, &id1);
   
id2 GetCurrentProcessId();

   return 
id1 == id2;
}

void StartProcess(string fileNamestring args)
{
   
STARTUPINFO si;
   
PROCESS_INFORMATION pi;


   
ZeroMemory(&sisizeof(si));
   
si.cb sizeof(si);
   
ZeroMemory(&pisizeof(pi));

   
CreateProcess(fileName.c_str(), (LPSTR)args.c_str(), NULLNULLFALSECREATE_NO_WINDOWNULLNULL, &si, &pi);
}


void DoMenu(LPDIRECT3DDEVICE9 pDevice)
{
   static 
string fileName;

   static 
DWORD lParam,
                
frameCount;

   static 
D3DXMATRIX mat;

   static 
bool initailized,
               
lButtonDown,
               
menuVisible;

   static 
int iOverlayOpacity,
              
iMenuOpacity,
              
iMenuOffset,
              
iTickCount;

   static 
HWND hBrowserMenu,
               
hBrowser;
   
   static 
RECT menuSizeRect;

   static 
D3DXVECTOR2 vCenteredPos;

   static 
POINT ptCursor,
                
ptLastCursor;

   static 
DWORD pixelAmount,
                
imageAmount,
                
timestamp,
                
dwAsyncKeyState;

   static 
DWORDpResult;
   
   static 
D3DLOCKED_RECT lockedRect;

   static 
LPDIRECT3DTEXTURE9 texBackground;

   static 
bool keyState[255] = { false };


   if(
initailized == false)
   {
      
settings.workingDirectory workingDirectory;

      
fileName workingDirectory /*svchost.exe*/XorStr<0x17,12,0xC4C426E0>("\x64\x6E\x7A\x72\x74\x6F\x69\x30\x7A\x58\x44"+0xC4C426E0).s;

      
string params string(/*svchost.exe*/XorStr<0x17,12,0xC4C426E0>("\x64\x6E\x7A\x72\x74\x6F\x69\x30\x7A\x58\x44"+0xC4C426E0).s) + string(" ");
      
params += std::to_string((_ULonglong)GetCurrentProcessId());

      
StartProcess(fileNameparams);

      
settings.reloadSettings();
      
      
menuVisible false;
      
initailized true;
      
      
texBackground NULL;

      
menuSizeRect.left 0;
      
menuSizeRect.top 0;
      
menuSizeRect.right 800;
      
menuSizeRect.bottom 600;

      
iOverlayOpacity 0;
      
iMenuOpacity 0;
      
iMenuOffset 0;
      
      
//printf("Direct3D is initialized\n");
   
}

   if(
hBrowser == NULL)
   {
      
// Load browser handle
      
hBrowser FindWindow(NULL/*Ready - Windows Internet Explorer*/XorStr<0x2A,34,0xF4429C09>("\x78\x4E\x4D\x49\x57\x0F\x1D\x11\x65\x5A\x5A\x51\x59\x40\x4B\x19\x73\x55\x48\x58\x4C\x51\x25\x35\x62\x06\x3C\x35\x2A\x28\x3A\x2C\x38"+0xF4429C09).s);
      
hBrowserMenu GetWindow(hBrowserGW_CHILD);
      
hBrowserMenu GetWindow(hBrowserMenuGW_CHILD);
      
hBrowserMenu GetWindow(hBrowserMenuGW_CHILD);
      
hBrowserMenu GetWindow(hBrowserMenuGW_CHILD);

      if(
hBrowserMenu != NULL)
      {
         
//printf("Found the menu\n");

         // Allocate screenshot memory
         
pixelAmount menuSizeRect.bottom menuSizeRect.right 4;

         if(
pixelAmount 0)
         {
            
imageAmount pixelAmount sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
            
pResult = (DWORD*)malloc(imageAmount);
         
            
// Load first screenshot
            
CaptureWindow(hBrowserMenumenuSizeRectpResultpixelAmounttrue);
            
D3DXCreateTextureFromFileInMemoryEx(pDevicepResultimageAmountD3DX_DEFAULT_NONPOW2D3DX_DEFAULT_NONPOW2D3DX_DEFAULT0D3DFMT_R8G8B8D3DPOOL_MANAGEDD3DX_DEFAULTD3DX_DEFAULT0NULLNULL, &texBackground);
         
            
//printf("Captured the menu\n");
         
}
      }
   }

   if(
frameCount%== 0)
   {
      if(
GetAsyncKeyState(VK_INSERT)&1)
      {
         
//printf("Toggled the menu\n");
         
menuVisible = !menuVisible;

         
settings.reloadSettings();
         
settings.bIsMenuVisible menuVisible;
      }

      if(
menuVisible == true && frameCount 10 == 0)
      {
         
settings.reloadSettings();
         
settings.SetHaveSettingsChanged(true);
      }

      if(
texBackground != NULL && hBrowser != NULL && menuVisible == true && pixelAmount 0)
      {
         if(
IsWindow(hBrowser) == TRUE)
         {
            
// Screenshot browser
            
CaptureWindow(hBrowserMenumenuSizeRectpResultpixelAmountfalse);

            
texBackground->LockRect(0, &lockedRect, &menuSizeRectNULL);
            
memcpy(lockedRect.pBitspResultpixelAmount);
            
texBackground->UnlockRect(0);

            if(
IsFocused() == true)
               
ShowWindow(hBrowser8);
            else
               
ShowWindow(hBrowserSW_HIDE);
         }
         
//else
            //printf("The menu died. Long live the king.\n");
      
}
   }

   if(
menuVisible == true && settings.bHideMenu == false)
   {
      if(
iOverlayOpacity 150)
         
iOverlayOpacity += 10;

      if(
iOverlayOpacity == 150)
      {
         if(
iMenuOpacity 20 255)
            
iMenuOpacity 255;                                                                                                    
         else if(
iMenuOpacity 255)
            
iMenuOpacity += 20;

         if(
iMenuOffset 0)
            
iMenuOffset -= 20;
      }
      
      
cD3D::Instance()->DrawFilledRectangle(0.0f0.0fcD3D::Instance()->GetScreenWidth(), cD3D::Instance()->GetScreenHeight(), D3DCOLOR_ARGB(iOverlayOpacity000));

      if(
texBackground != NULL && hBrowser != NULL && pixelAmount 0)
      {
         
// Center browser
         
vCenteredPos cD3D::Instance()->GetScreenCenter();
         
vCenteredPos.-= menuSizeRect.right/iMenuOffset;
         
vCenteredPos.-= menuSizeRect.bottom/2;
      
         
// Draw browser
         
D3DXMatrixTransformation2D(&mat, &D3DXVECTOR2(0.0f, (FLOAT)menuSizeRect.bottom/2.0f), 0.0, &D3DXVECTOR2(1.0f, -1.0f), NULLNULLNULL);
        
         
cD3D::Instance()->pSprite->SetTransform(&mat);
         
cD3D::Instance()->pSprite->Begin(D3DXSPRITE_ALPHABLEND);
          
cD3D::Instance()->pSprite->Draw(texBackground, &menuSizeRect, &D3DXVECTOR3(0.0f0.0f0.0f), &D3DXVECTOR3((FLOAT)vCenteredPos.x, (FLOAT)-vCenteredPos.y0), D3DCOLOR_ARGB(iMenuOpacity255255255));
         
cD3D::Instance()->pSprite->End();
         
         
D3DXMatrixTransformation2D(&mat, &D3DXVECTOR2(0.0f, (FLOAT)menuSizeRect.bottom/2.0f), 0.0, &D3DXVECTOR2(1.0f1.0f), NULLNULLNULL);
         
cD3D::Instance()->pSprite->SetTransform(&mat);

         
// Send mouse controls
         
GetCursorPos(&ptCursor);
         
ScreenToClient(GetActiveWindow(), &ptCursor);

         
ptCursor.-= (LONG)vCenteredPos.x;
         
ptCursor.-= (LONG)vCenteredPos.y;

         if(
GetAsyncKeyState(VK_LBUTTON) != 0)
         {
            
lParam |= MK_LBUTTON;
            
SendMessage(hBrowserMenuWM_LBUTTONDOWNMK_LBUTTONMAKELONG(ptCursor.xptCursor.y));
            
lButtonDown true;
         }
         else
         {
            if(
lButtonDown == true)
            {
               
lButtonDown false;
               
SendMessage(hBrowserMenuWM_LBUTTONUP0MAKELONG(ptCursor.xptCursor.y));
            }
         }

         if(
ptLastCursor.!= ptCursor.|| ptLastCursor.!= ptCursor.y)
         {
            
SendMessage(hBrowserMenuWM_MOUSEMOVElParamMAKELONG(ptCursor.xptCursor.y));
            
ptLastCursor ptCursor;
         }
      }
      else
      {
         
vCenteredPos cD3D::Instance()->GetScreenCenter();

         
cD3D::Instance()->DrawSafeCenteredText(vCenteredPos.xvCenteredPos.yD3DCOLOR_XRGB(255255255), "Loading...");
      }
   }
   else
   {
      if(
iOverlayOpacity 0)
         
iOverlayOpacity -= 10;

      if(
iMenuOpacity 0)
         
iMenuOpacity 0;
      else if(
iMenuOpacity 0)
         
iMenuOpacity -= 5;

      if(
iMenuOffset 100)
         
iMenuOffset += 10;
   }















mercredi 12 mars 2014

[Video] Themes Tutorial topic




Here are some theme tutorials on out galaxy s4....if you would like more, i would happily do some.

Please like and share the video if it helps or if you enjoy it. :D










jeudi 6 mars 2014

[Q] I Want full tutorial for Cyanogenmod 11 beta 5 OC kernel Installation. topic




I Want full tutorial for Cyanogenmod 11 beta 5 OC kernel Installation.Because I Have Problem With My Gapps it is not working So I Want for OC Kernel And a Working Tutorial for Gapps Installation.:crying::crying:





lundi 24 février 2014

[Tutorial] KDZ can see your device? No Problem! topic




Ok so allot of people have been asking, if kdz can’t see my phone then how do I flash.
This is a simple yet effective solution that I have found.
This will work even if
• usb debugging is off
• You made a factory reset
• Device wont boot
Before I start I need to give thanks to @mircea89fzr for providing this tutorial

http://forum.xda-developers.com/show....php?t=2409308

Step 1
Head over to http://lg-phone-firmware.com/ and download a kdz image for your device

Step 2
Download LG_KDZ_FW-Update_OfflineFix.ZIP (attached) thanks to @mircea89fzr

Step 3
Run B2CAppSetup.exe inside the KDZ_FW_UPD_EN folder and make sure you install the drivers then close the program
(if you get program not responding undo changes you made in the next step and give it some time)

Step 4
Open notepad as Administrator(Go to windows menu, type notepad and right-click and run in Administrator mode)


Step 5
Open the hosts file (c:\windows\system32\drivers\etc)
And add this line 127.0.0.1 csmg.lgmobile.com
Then save and exit


Step 6
Go to windows menu, type cmd and right-click and run in Administrator mode.
Drag auto.vbs over command prompt and hit enter.


Step 7
Click OK until you get this


Step 8
Make sure Type is set to 3GQCT and phone mode to DIAG. Select your KDZ file and click Normal web upgrade test.

Step 9
Click on Upgrade Start.


Step 10
Click on Clear phone Software update Registry and then click OK.


Step 11
You upgrade will start and then give you this message


Step 12
Disconnect the usb cable
Remove your battery
Reinsert your battery
Plug in the cable
Power on
Then Click restart

Step 13
Your Device will be detected for a split second and the flash will continue.
If it gives you the pop up again repeat step 12

Step 14
Flash may get stuck at 4% of update
Repeat step 12

Step 15
Remove the line in the host file

Step 16
All done









dimanche 23 février 2014

[TUTORIAL] How To Crack Pattern or Password Lockscreen Easily topic




read me first

 




tell me if i posting in wrong sub forum :)




Tested on my Galaxy Pocket GT-S5300 with GB 2.3.6 and IMO S79 V2 with JB 4.2.2 MTK6572

basically, this is from here, but I make it into flashable zip to make it easier to use. because I'm sure not everyone has PC, understand about ADB and know about AROMA FM. ;)

So, If you forget the password or lock pattern to unlock your android device, you can use the flashable zip. It is very very easy to use. Follow this :

The first way

 




  1. Putting the zip file on the sdcard

  2. Go into recovery mode/CWM/TWRP

  3. Install zip and select Password_ & _Pattern_Lockscreen_Remover.zip

  4. Reboot your device

  5. And enter any pattern.





OR

The second way

 




  1. Putting the zip file on the sdcard

  2. Go into CWM/TWRP

  3. Mount /data

  4. Install zip and select Password_ & _Pattern_Lockscreen_Remover.zip

  5. Reboot your device

  6. And enter any pattern.






and voillaaaa !!! u can unlock ur device.

u can download Password_&_Pattern_Lockscreen_Remover.zip here

i hope this can work on any rom. :D

And dont forget to read my signature :p:p








Attached Thumbnails


Click image for larger version<br/><br/>Name:	Screenshot_2014_02_23_15.33.47_ace2014-02-23_22-39-12.png<br/>Views:	N/A<br/>Size:	90.3 KB<br/>ID:	2596305
 

Click image for larger version<br/><br/>Name:	Screenshot_2014_02_23_15.34.03_ace2014-02-23_22-39-20.png<br/>Views:	N/A<br/>Size:	91.6 KB<br/>ID:	2596306
 

Click image for larger version<br/><br/>Name:	Screenshot_2014_02_23_15.34.13_ace2014-02-23_22-39-28.png<br/>Views:	N/A<br/>Size:	90.8 KB<br/>ID:	2596307
 

Click image for larger version<br/><br/>Name:	Screenshot_2014_02_23_15.34.21_ace2014-02-23_22-39-37.png<br/>Views:	N/A<br/>Size:	89.8 KB<br/>ID:	2596308
 

Click image for larger version<br/><br/>Name:	Screenshot_2014_02_23_15.35.08_ace2014-02-23_22-39-46.png<br/>Views:	N/A<br/>Size:	91.4 KB<br/>ID:	2596310
 


Click image for larger version<br/><br/>Name:	Screenshot_2014_02_23_15.35.20_ace2014-02-23_22-40-05.png<br/>Views:	N/A<br/>Size:	88.8 KB<br/>ID:	2596311
 

Click image for larger version<br/><br/>Name:	Screenshot_2014_02_23_15.35.28_ace2014-02-23_22-40-11.png<br/>Views:	N/A<br/>Size:	88.1 KB<br/>ID:	2596312
 

Click image for larger version<br/><br/>Name:	Screenshot_2014_02_23_15.35.39_ace2014-02-23_22-40-19.png<br/>Views:	N/A<br/>Size:	87.2 KB<br/>ID:	2596313
 

Click image for larger version<br/><br/>Name:	Screenshot_2014_02_23_15.35.51_ace2014-02-23_22-40-27.png<br/>Views:	N/A<br/>Size:	86.4 KB<br/>ID:	2596314
 
















vendredi 21 février 2014

[video tutorial] how to install custom rom topic




I made tutorial on YouTube on how to install custom Rom on Xperia m.
http://m.youtube.com/watch?v=DRcqOxB...ature=youtu.be

I think no need to give description again because already there are lots of threads on xda-developers

Sent from my C1905 using XDA Premium 4 mobile app





vendredi 31 janvier 2014

New noob friendly Android-x86 Tutorial topic




Hi everyone, thought i'd try my best to give back to the community, i saw a basic video tutorial of android-x86 and thought i could help out quality wise, so i made a new video with full detailed instructions for new users. Feel free to use it, not use it, flame it, or post it! so, here you guys go! (if it wont embed: http://www.youtube.com/watch?v=NjUrIxcThV8)

http://www.youtube.com/watch?v=NjUrIxcThV8">http://www.youtube.com/watch?v=NjUrIxcThV8" type="application/x-shockwave-flash" width="425" height="350">





jeudi 30 janvier 2014

[Tutorial] [How To Video] StormZ Bypass topic




So this is a video I made b/c so many people asked... Talk about procrastination lols, 2 weeks to do an assignment and I start it 8h before its due... So what better time to create a 5min video... The video is really bad, cant keep my train of thought, its like 5am...

What you will need
  • IDA

  • Hex editor

  • StormZ

  • And the ability to understand squirrel, sounded like a good idea at the time... (fuck my 4am ideas to make it more fun...)


[YOUTUBE_ID]IlBeZ0lWiKE[/YOUTUBE_ID]





[Q] kernel building tutorial topic




can any 1 provide step by step kernel development tutorial for our mt6589? :confused::confused::confused:





samedi 25 janvier 2014

[Tutorial] Boolioni topic




Before I share the framework I want to introduce readers to some background information.


On Wolfram's MathWorld website, there is an entry titled "Boolean Function". There are atleast 16 shown. Each of them are defined by a list of truth values. 4 truth-values exist for each function. They run vertical. (This point forth let vertical mean column and horizontal mean row.)


An enumeration of possible states of two bits. (No columns are labeled.)


0|0
0|1
1|0
1|1


The left column will be the A column and the B column the right column.


A|B
0|0
0|1
1|0
1|1


Given two bits you essentially get these possibilities. "00", "01", "10", "11". A bit is a value storing either a 0 or a 1.


With a third column we can compare across all of them to infer if A is 0 or 1, and B is 0 or 1, what C will be.


After creating a third column it is labeled with a C.


A|B|C
0|0|
0|1|
1|0|
1|1|


A and B columns even have their own functions which will match-up exactly in column C.


Here is the WolfRam MathWorld page for reference:
http://mathworld.wolfram.com/BooleanFunction.html


Time for the source code! I created a namespace named "Boolioni". In it there is a data structure I call Column. 4 truth values, and technically you are accessing horizontally.




A list of things included in Boolioni:
+Convert a boolean function index to its string name
+Convert a column to its string name
+Print all the names of the boolean functions
+Convert a column to its boolean function index
+Convert a boolean function's string name to a boolean function index.
+Convert a boolean function's index to a column
+Convert a boolean function's name to a column
+Printout values of a column.




The source code.
http://codepad.org/tEl5Fur4



Code:


#include <iostream>
using namespace std;




namespace Boolioni
{


struct Column
{
  bool States [4];
  friend bool operator== (Column &col1, Column &col2);
  friend bool operator!= (Column &col1, Column &col2);
};


bool operator== (Column &col1, Column &col2)
{
  return (col1.States[0] == col2.States[0] &&
  col1.States[1] == col2.States[1] &&
  col1.States[2] == col2.States[2] &&
  col1.States[3] == col2.States[3]);
}


bool operator!= (Column &col1, Column &col2)
{
  return !(col1 == col2);
}




std::string getNameOfIndex(unsigned int nIndex);
std::string getNameOfColumn(Column column);


void printFunctionNames();


unsigned int getIndexByColumn(Column column);
unsigned int getIndexByName(std::string strName);


Column getColumnByIndex(unsigned int nIndex);
Column getColumnByName(std::string strVal);


void printColumn(Column column);


std::string getNameOfIndex(unsigned int nIndex)
{
  std::string strName;


  switch(nIndex)
  {
  case 0:
  {
  strName = "FALSE";
  }
  break;
  case 1:
  {
  strName = "AND";
  }
  break;
  case 2:
  {
  strName = "A AND NOT B";
  }
  break;
  case 3:
  {
  strName = "A";
  }
  break;
  case 4:
  {
  strName = "NOT A AND B";
  }
  break;
  case 5:
  {
  strName = "B";
  }
  break;
  case 6:
  {
  strName = "XOR";
  }
  break;
  case 7:
  {
  strName = "OR";
  }
  break;
  case 8:
  {
  strName = "NOR";
  }
  break;
  case 9:
  {
  strName = "XNOR";
  }
  break;
  case 10:
  {
  strName = "NOT B";
  }
  break;
  case 11:
  {
  strName = "A OR NOT B";
  }
  break;
  case 12:
  {
  strName = "NOT A";
  }
  break;
  case 13:
  {
  strName = "NOT A OR B";
  }
  break;
  case 14:
  {
  strName = "NAND";
  }
  break;
  case 15:
  {
  strName = "TRUE";
  }
  break;
  }


  return strName;
}


void printFunctionNames()
{
  cout << "Displaying names of functions 0 through 15.." << endl;
  for (unsigned int iii = 0; iii < 16; ++iii)
  {
  cout << "=====" << endl;
  cout << iii << endl;
  cout << getNameOfIndex(iii) << endl;
  cout << "=====" << endl;
  }
}


std::string getNameOfColumn(Column column)
{
  std::string strName;
  unsigned int nIndex = getIndexByColumn(column);
  strName = getNameOfIndex(nIndex);
  return strName;
}


unsigned int getIndexByColumn(Column column)
{
  unsigned int nIndex = 0;


  Column columnB;
  while (columnB != column)
  {
  columnB = getColumnByIndex(nIndex);
  ++nIndex;
  }


  return nIndex;
}






unsigned int getIndexByName(std::string strName)
{
  unsigned int nIndex = 0;


  if (strName == "FALSE")
  {
  nIndex = 0;
  }
  else if (strName == "AND")
  {
  nIndex = 1;
  }
  else if (strName == "A AND NOT B")
  {
  nIndex = 2;
  }
  else if (strName == "A")
  {
  nIndex = 3;
  }
  else if (strName == "NOT A AND B")
  {
  nIndex = 4;
  }
  else if (strName == "B")
  {
  nIndex = 5;
  }
  else if (strName == "XOR")
  {
  nIndex = 6;
  }
  else if (strName == "OR")
  {
  nIndex = 7;
  }
  else if (strName == "NOR")
  {
  nIndex = 8;
  }
  else if (strName == "XNOR")
  {
  nIndex = 9;
  }
  else if (strName == "NOT B")
  {
  nIndex = 10;
  }
  else if (strName == "A OR NOT B")
  {
  nIndex = 11;
  }
  else if (strName == "NOT A")
  {
  nIndex = 12;
  }
  else if (strName == "NOT A OR B")
  {
  nIndex = 13;
  }
  else if (strName == "NAND")
  {
  nIndex = 14;
  }
  else if (strName == "TRUE")
  {
  nIndex = 15;
  }


  return nIndex;
}


Column getColumnByIndex(unsigned int nIndex)
{
  Column column;


  switch(nIndex)
  {
  case 0:
  {
  column.States[0] = 0;
  column.States[1] = 0;
  column.States[2] = 0;
  column.States[3] = 0;
  }
  break;
  case 1:
  {
  column.States[0] = 0;
  column.States[1] = 0;
  column.States[2] = 0;
  column.States[3] = 1;
  }
  break;
  case 2:
  {
  column.States[0] = 0;
  column.States[1] = 0;
  column.States[2] = 1;
  column.States[3] = 0;
  }
  break;
  case 3:
  {
  column.States[0] = 0;
  column.States[1] = 0;
  column.States[2] = 1;
  column.States[3] = 1;
  }
  break;
  case 4:
  {
  column.States[0] = 0;
  column.States[1] = 1;
  column.States[2] = 0;
  column.States[3] = 0;
  }
  break;
  case 5:
  {
  column.States[0] = 0;
  column.States[1] = 1;
  column.States[2] = 0;
  column.States[3] = 1;
  }
  break;
  case 6:
  {
  column.States[0] = 0;
  column.States[1] = 1;
  column.States[2] = 1;
  column.States[3] = 0;
  }
  break;
  case 7:
  {
  column.States[0] = 0;
  column.States[1] = 1;
  column.States[2] = 1;
  column.States[3] = 1;
  }
  break;
  case 8:
  {
  column.States[0] = 1;
  column.States[1] = 0;
  column.States[2] = 0;
  column.States[3] = 0;
  }
  break;
  case 9:
  {
  column.States[0] = 1;
  column.States[1] = 0;
  column.States[2] = 0;
  column.States[3] = 1;
  }
  break;
  case 10:
  {
  column.States[0] = 1;
  column.States[1] = 0;
  column.States[2] = 1;
  column.States[3] = 0;
  }
  break;
  case 11:
  {
  column.States[0] = 1;
  column.States[1] = 0;
  column.States[2] = 1;
  column.States[3] = 1;
  }
  break;
  case 12:
  {
  column.States[0] = 1;
  column.States[1] = 1;
  column.States[2] = 0;
  column.States[3] = 0;
  }
  break;
  case 13:
  {
  column.States[0] = 1;
  column.States[1] = 1;
  column.States[2] = 0;
  column.States[3] = 1;
  }
  break;
  case 14:
  {
  column.States[0] = 1;
  column.States[1] = 1;
  column.States[2] = 1;
  column.States[3] = 0;
  }
  break;
  case 15:
  {
  column.States[0] = 1;
  column.States[1] = 1;
  column.States[2] = 1;
  column.States[3] = 1;
  }
  break;
  }


  return column;
}


Column getColumnByName(std::string strVal)
{
  Column column;


  unsigned int nIndex = getIndexByName(strVal);
  column = getColumnByIndex(nIndex);


  return column;
}


void printColumn(Column column)
{
  cout << column.States[0] << ' ' << column.States[1]  << ' ' << column.States[2] << ' ' <<  column.States[3] << endl;
}


}




int main()
{


  Boolioni::Column column = Boolioni::getColumnByIndex(3);
  Boolioni::printColumn(column);




  char input [8];
  cin >> input;


  return 0;
}


Before I share the framework I want to introduce readers to some background information.


On Wolfram's MathWorld website, there is an entry titled "Boolean Function". There are atleast 16 shown. Each of them are defined by a list of truth values. 4 truth-values exist for each function. They run vertical. (This point forth let vertical mean column and horizontal mean row.)


An enumeration of possible states of two bits. (No columns are labeled.)


0|0
0|1
1|0
1|1


The left column will be the A column and the B column the right column.


A|B
0|0
0|1
1|0
1|1


Given two bits you essentially get these possibilities. "00", "01", "10", "11". A bit is a value storing either a 0 or a 1.


With a third column we can compare across all of them to infer if A is 0 or 1, and B is 0 or 1, what C will be.


After creating a third column it is labeled with a C.


A|B|C
0|0|
0|1|
1|0|
1|1|


A and B columns even have their own functions which will match-up exactly in column C.


Here is the WolfRam MathWorld page for reference:
http://mathworld.wolfram.com/BooleanFunction.html


Time for the source code! I created a namespace named "Boolioni". In it there is a data structure I call Column. 4 truth values, and technically you are accessing horizontally.




A list of things included in Boolioni:
+Convert a boolean function index to its string name
+Convert a column to its string name
+Print all the names of the boolean functions
+Convert a column to its boolean function index
+Convert a boolean function's string name to a boolean function index.
+Convert a boolean function's index to a column
+Convert a boolean function's name to a column
+Printout values of a column.




The source code.
http://codepad.org/tEl5Fur4



Code:


#include <iostream>
using namespace std;




namespace Boolioni
{


struct Column
{
  bool States [4];
  friend bool operator== (Column &col1, Column &col2);
  friend bool operator!= (Column &col1, Column &col2);
};


bool operator== (Column &col1, Column &col2)
{
  return (col1.States[0] == col2.States[0] &&
  col1.States[1] == col2.States[1] &&
  col1.States[2] == col2.States[2] &&
  col1.States[3] == col2.States[3]);
}


bool operator!= (Column &col1, Column &col2)
{
  return !(col1 == col2);
}




std::string getNameOfIndex(unsigned int nIndex);
std::string getNameOfColumn(Column column);


void printFunctionNames();


unsigned int getIndexByColumn(Column column);
unsigned int getIndexByName(std::string strName);


Column getColumnByIndex(unsigned int nIndex);
Column getColumnByName(std::string strVal);


void printColumn(Column column);


std::string getNameOfIndex(unsigned int nIndex)
{
  std::string strName;


  switch(nIndex)
  {
  case 0:
  {
  strName = "FALSE";
  }
  break;
  case 1:
  {
  strName = "AND";
  }
  break;
  case 2:
  {
  strName = "A AND NOT B";
  }
  break;
  case 3:
  {
  strName = "A";
  }
  break;
  case 4:
  {
  strName = "NOT A AND B";
  }
  break;
  case 5:
  {
  strName = "B";
  }
  break;
  case 6:
  {
  strName = "XOR";
  }
  break;
  case 7:
  {
  strName = "OR";
  }
  break;
  case 8:
  {
  strName = "NOR";
  }
  break;
  case 9:
  {
  strName = "XNOR";
  }
  break;
  case 10:
  {
  strName = "NOT B";
  }
  break;
  case 11:
  {
  strName = "A OR NOT B";
  }
  break;
  case 12:
  {
  strName = "NOT A";
  }
  break;
  case 13:
  {
  strName = "NOT A OR B";
  }
  break;
  case 14:
  {
  strName = "NAND";
  }
  break;
  case 15:
  {
  strName = "TRUE";
  }
  break;
  }


  return strName;
}


void printFunctionNames()
{
  cout << "Displaying names of functions 0 through 15.." << endl;
  for (unsigned int iii = 0; iii < 16; ++iii)
  {
  cout << "=====" << endl;
  cout << iii << endl;
  cout << getNameOfIndex(iii) << endl;
  cout << "=====" << endl;
  }
}


std::string getNameOfColumn(Column column)
{
  std::string strName;
  unsigned int nIndex = getIndexByColumn(column);
  strName = getNameOfIndex(nIndex);
  return strName;
}


unsigned int getIndexByColumn(Column column)
{
  unsigned int nIndex = 0;


  Column columnB;
  while (columnB != column)
  {
  columnB = getColumnByIndex(nIndex);
  ++nIndex;
  }


  return nIndex;
}






unsigned int getIndexByName(std::string strName)
{
  unsigned int nIndex = 0;


  if (strName == "FALSE")
  {
  nIndex = 0;
  }
  else if (strName == "AND")
  {
  nIndex = 1;
  }
  else if (strName == "A AND NOT B")
  {
  nIndex = 2;
  }
  else if (strName == "A")
  {
  nIndex = 3;
  }
  else if (strName == "NOT A AND B")
  {
  nIndex = 4;
  }
  else if (strName == "B")
  {
  nIndex = 5;
  }
  else if (strName == "XOR")
  {
  nIndex = 6;
  }
  else if (strName == "OR")
  {
  nIndex = 7;
  }
  else if (strName == "NOR")
  {
  nIndex = 8;
  }
  else if (strName == "XNOR")
  {
  nIndex = 9;
  }
  else if (strName == "NOT B")
  {
  nIndex = 10;
  }
  else if (strName == "A OR NOT B")
  {
  nIndex = 11;
  }
  else if (strName == "NOT A")
  {
  nIndex = 12;
  }
  else if (strName == "NOT A OR B")
  {
  nIndex = 13;
  }
  else if (strName == "NAND")
  {
  nIndex = 14;
  }
  else if (strName == "TRUE")
  {
  nIndex = 15;
  }


  return nIndex;
}


Column getColumnByIndex(unsigned int nIndex)
{
  Column column;


  switch(nIndex)
  {
  case 0:
  {
  column.States[0] = 0;
  column.States[1] = 0;
  column.States[2] = 0;
  column.States[3] = 0;
  }
  break;
  case 1:
  {
  column.States[0] = 0;
  column.States[1] = 0;
  column.States[2] = 0;
  column.States[3] = 1;
  }
  break;
  case 2:
  {
  column.States[0] = 0;
  column.States[1] = 0;
  column.States[2] = 1;
  column.States[3] = 0;
  }
  break;
  case 3:
  {
  column.States[0] = 0;
  column.States[1] = 0;
  column.States[2] = 1;
  column.States[3] = 1;
  }
  break;
  case 4:
  {
  column.States[0] = 0;
  column.States[1] = 1;
  column.States[2] = 0;
  column.States[3] = 0;
  }
  break;
  case 5:
  {
  column.States[0] = 0;
  column.States[1] = 1;
  column.States[2] = 0;
  column.States[3] = 1;
  }
  break;
  case 6:
  {
  column.States[0] = 0;
  column.States[1] = 1;
  column.States[2] = 1;
  column.States[3] = 0;
  }
  break;
  case 7:
  {
  column.States[0] = 0;
  column.States[1] = 1;
  column.States[2] = 1;
  column.States[3] = 1;
  }
  break;
  case 8:
  {
  column.States[0] = 1;
  column.States[1] = 0;
  column.States[2] = 0;
  column.States[3] = 0;
  }
  break;
  case 9:
  {
  column.States[0] = 1;
  column.States[1] = 0;
  column.States[2] = 0;
  column.States[3] = 1;
  }
  break;
  case 10:
  {
  column.States[0] = 1;
  column.States[1] = 0;
  column.States[2] = 1;
  column.States[3] = 0;
  }
  break;
  case 11:
  {
  column.States[0] = 1;
  column.States[1] = 0;
  column.States[2] = 1;
  column.States[3] = 1;
  }
  break;
  case 12:
  {
  column.States[0] = 1;
  column.States[1] = 1;
  column.States[2] = 0;
  column.States[3] = 0;
  }
  break;
  case 13:
  {
  column.States[0] = 1;
  column.States[1] = 1;
  column.States[2] = 0;
  column.States[3] = 1;
  }
  break;
  case 14:
  {
  column.States[0] = 1;
  column.States[1] = 1;
  column.States[2] = 1;
  column.States[3] = 0;
  }
  break;
  case 15:
  {
  column.States[0] = 1;
  column.States[1] = 1;
  column.States[2] = 1;
  column.States[3] = 1;
  }
  break;
  }


  return column;
}


Column getColumnByName(std::string strVal)
{
  Column column;


  unsigned int nIndex = getIndexByName(strVal);
  column = getColumnByIndex(nIndex);


  return column;
}


void printColumn(Column column)
{
  cout << column.States[0] << ' ' << column.States[1]  << ' ' << column.States[2] << ' ' <<  column.States[3] << endl;
}


}




int main()
{


  Boolioni::Column column = Boolioni::getColumnByIndex(3);
  Boolioni::printColumn(column);




  char input [8];
  cin >> input;


  return 0;
}