Structure vs Class Only different !

Structure vs Class

only different: base access modifier

Structure is Public.
Class is Private.


target board Setting NFS

1. sudo apt-get install nfs-common nfs-kernel-server portmap

2. sudo vi /etc/exports
/home/nfs/folder 192.168.0.*(rw,no_root_squash,async,subtree_check)

3. sudo /etc/init.d/nfs-kernel-server restart

4. mkdir /home/nfs/folder

// target board
1. mount -o port=2049,nolock,proto=tcp -t nfs 192.168.0.100:/home/nfs/folder /mnt

Git Command

git init : create Git Repository in current directory
git status: check uncommit issue
git --version : check version
git add: update in staging area( staging area: buffer area between work tree and repository)
git commit: commit file in staging area
git diff : show different between work tree and staging area
git config (--global) --list: check config information(--global set global, besides current area)
git log: commit log
git log $CommitName: show log in CommitName
git clone $repo $folder: copy from $repo and $local folder
git fetch: update local repo(though remote branch)
git push: push origin repo
git gc: repo log optimization



ADDING....

GIT clone error / delete branch in remote repository

GIT clone Error

ERROR
fetal: internal server error
remote: internal server error
fatal: early EOF
fatal: index-pack failed

solution :
if 'origin' branch was delete in remote repo, local is update about the information and the branch is delete automatically. 

cmd:
  $ git remote prune origin

printf % type

%c/%C  char
%s  string 
%p  pointer value hexadecimal number
%d/%i  signed decimal number
%u  unsigned decimal number
%f/%F  float
%e/%E  ?(real number exponent ?)
%g/%G  according to size, if size is small, %f/ if big is, %e
%x/%X  hexadecimal number
%o octal number
%n  line feed

QML and C++ Integration

Integrating QML and C++ provides a variety of opportunities, including the ability to:

1. Separate the user interface code from the application logic code, by implementing the former with QML and JavaScript within QML documents, and the latter with C++

2. Use and invoke some C++ functionality from QML (for example, to invoke your application logic, use a data model implemented in C++, or call some functions in a third-party C++ library)

3. Access functionality in the Qt QML or Qt Quick C++ API (for example, to dynamically generate images using QQuickImageProvider)

4. Implement your own QML object types from C++ — whether for use within your own specific application, or for distribution to others


 source: http://doc.qt.io/qt-5/qtqml-cppintegration-overview.html

change qmake version

change qmake version 
$ export QTDIR=/qtdir/Qt/5.7/gcc_64
$ export PATH=$QTDIR/bin:$PATH
$ export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

/qtdir = installed qt path

 qmake --version

[VMware workstation] solution - disable intall vmware tools (ubuntu)

[VMware workstation] solution - disable intall vmware tools (ubuntu)

1. open terminal$sudo apt-get install open-vm-tools-desktop


2. restart vmware

C Language - extern ?

Extern
- The extern keyword declares a variable or function and specifies that it has external linkage.

C++ Shift operator(KO)

Shift operator- cout, cin 쓸때 앞이나 뒤에 붙이는 연산자
- 표준 라이브러리에 std라는 namespace에 cout이나 cin에 관련된 클래스(istream, ostream)
- C++에서는 쉬프트 연산자도 연산자 오버로딩이 가능


Shift operator overloading
-----------------------------
int main()
{
    VALUE val(2,3); 
    std::cout << val;
    return 0;
}


1. VALUE class show x and y value.
2. create val Object. after, std::cout print val .

Error : 
cout : - possible normal data type printing
         - impossible object of user type

-표준 std의 ostream 클래스에서도 쉬프트 연산에 대한 오버로딩이 정의 되어 있지 않음
따라서,  표준 라이브러리로 객체를 출력하는 일 불가능

-> Solution
overloading of member fucntion

cout is cout.operator

cout.operator<< (val)


val 객체 인자값을 받을 수 있도록 cout 객체에는 operator<< 연산자를 오버로딩 시키면 가능


class VALUE{  

private:  
    int iX;
    int iY;  
public:  
    VALUE(int x=0, int y=0):iX(x), iY(y){}  
    friend ostream& operator<<(ostream& os, const VALUE& val);  
};  
  
ostream& operator<<(ostream& os, const VALUE& val)  
{  
    os<<"["<<val.iX<<", "<<val.iY<<"]"<<endl;   

    return os;  
}  
  
int main(void)  
{  
    VALUE val(2, 3);  
    std::cout<<val;  
    return 0; 
}

member func overloading : CHANGE std::cout<<val; to operator(std::cout, VALUE); 

NO logical problem. 

How to use #ifdef to C/C++

example
int testfunc(int x, int y)
{
#ifdef  _DEBUG
      printf("x=%d, Y=%d", x,y);  // if x=1, y =2 
#endif
   return  (x * Y) ;
}

if debug mode
#define _DEBUG "DEBUG"

print x=1, Y=2
after return


if release mode,
not print
return

C/C++ Data type byte range


data type

data type  byte

unsigned long       DWORD
int                        BOOL;
unsigned char       BYTE;
unsigned short      WORD;
unsigned int          UINT;

char            1 byte -128 ~ 127
unsigned char 1 byte 0 ~ 255

int8                 1 byte -128 ~ 127

int16         2 byte -32,768 to 32,767

unsigned int 2 byte -32,768 to 32,767

(signed) short (int)        2 byte -32,768 to 32,767
unsigned short (int)         2 byte 0 ~ 65,535

int32                        4 byte -2,147,483,648 ~ 2,147,483,647

(signed) int                4 byte -2,147,483,648 ~ 2,147,483,647
unsigned int                4 byte 0 ~ 4,294,967,295

(signed) long (int)        4 byte -2,147,483,648 ~ 2,147,483,647
unsigned long (ing)          4 byte -2,147,483,648 ~ 2,147,483,647
int64                        8 byte -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807
float                                 4 byte 3.4E +/- 38 (7 digits)
double                        8 byte 1.7E +/- 308 (15 digits)
long double                8 byte 1.2E +/- 4932 (19 digits)


linux eclipse jdk 설치

http://blog.naver.com/jooostory/220226721954

C Language printf format

printf function summary
Format :%i, %d, %c ,%f, %s,%ll , %ull, %x etc.
unsigned int          -> %u
d - decimal number 
o - octal number 
x -hexadecimal number 
short                 -> %hd(decimal number)
short                 -> %ho(octal number)
short                 -> %hx(hexadecimal number)
long             -> %ld(decimal number)
long             -> %lo(octal number)
long             -> %lx(hexadecimal number)
unsigned long    -> %lu
long long             -> %lld
unsigned long long    -> %llu


description-------------------------------------------------------------------------------------------
\n (newline)
\t (tab)
\v (vertical tab)
\f (new page)
\b (backspace)
\r (carriage return)
\n (newline)
%d (print as a decimal integer)
%3d (print as a decimal integer with a width of at least 3 wide)
%f (print as a floating point)
%5f (print as a floating point with a width of at least 5 wide)
%.4f (print as a floating point with a precision of four characters after the decimal point)
%6.2f (print as a floating point at least 6 wide and a precision of 2)

example-------------------------------------------------------------------------------------------

 #include<stdio.h>
int main()
 {
  int a,b;
  float c,d;
  a = 17;
  b = a / 2;
  printf("%d\n",b);
  printf("%3d\n",b);
  printf("%03d\n",b);
  c = 18.3;
  d = c / 3;
  printf("%3.2f\n",d);
 }
result-------------------------------------------------------------------------------------------
8
   8
007
6.10

example-------------------------------------------------------------------------------------------
#include<stdio.h>

int main()
{
 printf("1.%s:\n", "Hello, abcde!");
 printf("2.%15s:\n", "Hello, abcde!");
 printf("3.%.10s:\n", "Hello, abcde!");
 printf("4.%-10s:\n", "Hello, abcde!");
 printf("5.%-15s:\n", "Hello, abcde!");
 printf("6.%.15s:\n", "Hello, abcde!");
 printf("7.%15.10s:\n", "Hello, abcde!");
 printf("8.%-15.10s:\n", "Hello, abcde!");
}
result:-------------------------------------------------------------------------------------------
1.Hello, abcde!:  
2.  Hello, abcde!:
3.Hello, abc:
4.Hello, abcde!:
5.Hello, abcde!  :
6.Hello, abcde!:
7.     Hello, abc:
8.Hello, abc   
description------------------------------------------------------------------------------------
1. statement prints the string (nothing special happens.)
2.statement prints the string, but print 15 characters. If the string is smaller the “empty” positions will be filled with “Space.”
3. statement prints the string, but print only 10 characters of the string.
4. statement prints the string, but prints at least 10 characters. If the string is smaller “space” is added at the end. (See next example.)
5. statement prints the string, but prints at least 15 characters. The string in this case is shorter than the defined 15 character, thus “space” is added at the end (defined by the minus sign.)
6. statement prints the string, but print only 15 characters of the string. In this case the string is shorter than 15, thus the whole string is printed.
7. statement prints the string, but print 15 characters.
If the string is smaller the “empty” positions will be filled with “space.” But it will only print a maximum of 10 characters, thus only part of new string (old string plus the space positions) is printed.
8. statement prints the string, but it does the exact same thing as the previous statement, accept the “space” is added at the end.

Apartment Buying Guide 2025: Shocking Red Flags You Should NEVER Ignore!

 🏙️ Apartment Buying Guide 2025: Shocking Red Flags You Should NEVER Ignore! 🚨 Are you thinking about buying an apartment in 2025? 🏢  It’...