'Programming'에 해당되는 글 1721건

  1. 2014.11.21 qt signal & slot - connect / disconnect / emit
  2. 2014.11.20 qt 프로젝트 파일 연관
  3. 2014.11.11 DTD / XSD
  4. 2014.11.11 xcache 1.3.2 for php 5.3.22 for ARM
  5. 2014.11.10 xml benchmark
  6. 2014.11.10 xml dtd xsd
  7. 2014.11.06 QT font 관련
  8. 2014.11.05 QT modules
  9. 2014.11.05 QT Quick UI 2
  10. 2014.11.05 include guard
Programming/qt2014. 11. 21. 10:17
음.. 일단 분석한 내용으로는..
signal은 껍데기 이고 Q_OBJECT를 본 moc가 알아서 생성해서
slot과 연결을 해주는 듯하다

아래 코드를 보면 signals: 에는 프로토타입만 있고 실제로 구현은 보이지 않으며
class Window : public QWidget
{
    Q_OBJECT
public:
    explicit Window(QWidget *parent = 0);
signals:
    void counterReached();
private slots:
    void slotButtonClicked(bool checked);
private:
    int m_counter;
    QPushButton *m_button;
}; 

connect를 보면 signal과 slot은 거의 동일한 함수 형태를 지니고
인자를 넘겨받게 되는 구조로 되어있다.
Window::Window(QWidget *parent) : QWidget(parent)
{
    // Set size of the window
    setFixedSize(100, 50);
 
    // Create and position the button
    m_button = new QPushButton("Hello World", this);
    m_button->setGeometry(10, 10, 80, 30);
    m_button->setCheckable(true);
 
    // Set the counter to 0
    m_counter = 0;
 
    connect(m_button, SIGNAL(clicked(bool)), this, SLOT(slotButtonClicked(bool)));
    connect(this, SIGNAL(counterReached()), QApplication::instance(), SLOT(quit()));
}
 
void Window::slotButtonClicked(bool checked)
{
    if (checked) {
        m_button->setText("Checked");
    } else {
        m_button->setText("Hello World");
    }
 
    m_counter ++;
    if (m_counter == 10) {
        emit counterReached();
    }
} 

아무튼.. 원칙(?)적으로는 각종 핸들러를 만들어주고 생성하고 연결해야 하나
그렇게 되면 코드가 막 꼬이는 것 처럼 보일수가 있기에
이를 간결하게 하기 위해서 moc를 통해 생성하는 구조로 추측된다.

[링크 : http://qt-project.org/doc/qt-4.8/tools-customtypesending.html]
[링크 : http://qt-project.org/wiki/Qt_for_beginners_Signals_and_slots]
[링크 : http://qt-project.org/wiki/Qt_for_beginners_Signals_and_slots_2]
[링크 : http://www.joinc.co.kr/modules/moniwiki/wiki.php/QT_Whitepaper]

'Programming > qt' 카테고리의 다른 글

Qt for Embedded Linux 와 VNC  (0) 2014.12.11
qt dialog / webkit 연동  (0) 2014.12.10
qt 프로젝트 파일 연관  (0) 2014.11.20
QT font 관련  (0) 2014.11.06
QT modules  (0) 2014.11.05
Posted by 구차니
Programming/qt2014. 11. 20. 13:44
.pro 파일은 프로젝트 파일

qmake을 통해
Makefile을 생성
그 이후 make로 컴파일 

즉, 프로젝트를 수정할일이 있다면 .pro 파일을 수정후
qmake를 통해서 Makefile을 다시 생성해 내도록 해야 한다.

*.pro -> qmake -> Makefile -> make 

[링크 : http://qt-project.org/doc/qt-4.8/qmake-project-files.html]
[링크 : http://qt-project.org/doc/qt-4.8/qmake-manual.html]
[링크 : http://qt-project.org/doc/qt-4.8/qmake-tutorial.html]

'Programming > qt' 카테고리의 다른 글

qt dialog / webkit 연동  (0) 2014.12.10
qt signal & slot - connect / disconnect / emit  (0) 2014.11.21
QT font 관련  (0) 2014.11.06
QT modules  (0) 2014.11.05
QT Quick UI  (2) 2014.11.05
Posted by 구차니
Programming/xml2014. 11. 11. 09:58
DTD는 namespace를 지원하지 않고
XSD는 XML 표준에 namespace를 지원한다.
XSD를 쓰는게 더 나을거 같기도 하고..
[링크 : http://stackoverflow.com/questions/1490583/dtd-or-xml-schema-which-one-is-better]

일단 예제를 보면 DTD는 XML 포맷이 아니고 XSD는 XML 포맷이다.
<!DOCTYPE note
[
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]> 

[링크 : http://www.w3schools.com/xml/xml_dtd.asp] DTD 


<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="note">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="to" type="xs:string"/>
      <xs:element name="from" type="xs:string"/>
      <xs:element name="heading" type="xs:string"/>
      <xs:element name="body" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

</xs:schema> 

[링크 : http://www.w3schools.com/schema/] XSD 

[링크 : http://bsp.mits.ch/xsd2dtd/] XSD to DTD 

'Programming > xml' 카테고리의 다른 글

xmlstarlet  (0) 2016.05.26
DOM vs SAX  (0) 2014.11.21
xml parser 선택 / 종류  (0) 2014.11.21
xml benchmark  (0) 2014.11.10
xml dtd xsd  (0) 2014.11.10
Posted by 구차니
Programming/php2014. 11. 11. 08:18
암용으로 크로스컴파일 하려는데
이래저래 부딛히는 dog show!!

php 컴파일시 configure 파일에서 dlopen 으로  검색후
found=yes로 하여 강제로 dlopen(extension 사용 가능하도록) 수정해야 한다.

php 컴파일
$ rm config.cache
$ ./configure --host=arm-none-linux-gnueabi --disable-all --with-config-file-path=/etc --enable-simplexml --enable-cgi --enable-fpm 

if-else 그리고 fi를 주석처리 
$ vi configure
65281 line
flock_type=unknown
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else

65323 line
if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else


xcache 컴파일
$ CC=arm-none-linux-gnueabi-gcc ./configure  --host=arm-none-linux-gnueabi --enable-xcache --enable-xcache-optimizer
xcache의 환경설정

$ vi /etc/php.ini

# 주석처리 되어있으니 주석만 삭제하면 될 듯
cgi.fix_pathinfo=1

# 이상한(?) 경로이니 옮겨서 사용하려면 주석삭제 및 수정 필요
extension_dir = "/usr/lib"

# 가장 아래 추가하면 됨
extension=xcache.so
[xcache.admin]
xcache.admin.enable_auth = Off

[xcache]
xcache.shm_scheme =        "mmap"
xcache.size  =               1M
xcache.count =                 1
xcache.slots =                8K
xcache.ttl   =                 0
xcache.gc_interval =           0

xcache.var_size  =            1M
xcache.var_count =             1
xcache.var_slots =            8K
xcache.var_ttl   =             0
xcache.var_maxttl   =          0
xcache.var_gc_interval =     300

xcache.test =                Off
xcache.readonly_protection = Off
xcache.mmap_path =    "/dev/zero"
xcache.coredump_directory =   ""

xcache.cacher =               On
xcache.stat   =              Off
xcache.optimizer =           Off

[xcache.coverager]
xcache.coverager =          Off
xcache.coveragedump_directory = "" 

$ vi /etc/lighttpd/lighttpd.conf 
cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
                               ".html" => "/usr/bin/php",
#                              ".php" => "/bin/php-cgi",
                               ".cgi" => "" )

fastcgi.server = ( ".php" => ((
                        "bin-path" => "/bin/php-cgi",
                        "socket" => "/tmp/php.sock",
                        "max-procs" => 1,
                        "bin-environment" => (
                                "PHP_FCGI_CHILDREN" => "1",
                                "PHP_FCGI_MAX_REQUESTS" => "100"),
                        "bin-copy-environment" => (
                                "PAHT", "SHELL", "USER" ),
                        "broken-scriptfilename" => "enable"
                ))
)

lighttpd 에서 cgi.assign 부분에 php를 주석처리 하지 않으면
php-cgi 가 fpm을 통해 데몬으로 구동되어도 cgi가 먼저 처리 하면서 캐싱이 되지 않는다. 
(cgi가 fastcgi보다 위에 있어서 그럴지도?) 



ab 로 벤치마크 결과 50% 정도 향상.. 이려나?
+xcache enable
Time taken for tests:   570.448 seconds
Requests per second:    1.75 [#/sec] (mean)
Time per request:       570.448 [ms] (mean)
Time per request:       570.448 [ms] (mean, across all concurrent requests)
Transfer rate:          38.86 [Kbytes/sec] received

+xcache disable
Time taken for tests:   916.042 seconds
Requests per second:    1.09 [#/sec] (mean)
Time per request:       916.042 [ms] (mean)
Time per request:       916.042 [ms] (mean, across all concurrent requests)
Transfer rate:          24.20 [Kbytes/sec] received 




-----
--enable-fpm을 추가하지 않아도 되긴 되는 듯?

'Programming > php' 카테고리의 다른 글

php simpleXML saveXML 정렬하기 (well-formed XML)  (0) 2014.12.23
php simpleXML  (0) 2014.12.22
lighttpd + php 퍼미션 문제  (0) 2014.10.21
php.ini extension_dir  (0) 2014.10.20
php 5.3.22 / xcache 1.3.2  (0) 2014.10.15
Posted by 구차니
Programming/xml2014. 11. 10. 15:01
옛날 글이라 큰 의미를 가지긴 어렵지만..
2009년도 당시에 QTXML 성능은.. 핵폐기물 수준이었던 건가?!

[링크 : http://xmlbench.sourceforge.net/results/benchmark200910/in
[링크 : http://xmlbench.sourceforge.net/index.php?page=results.php
[링크 : http://xmlbench.sourceforge.net/

'Programming > xml' 카테고리의 다른 글

xmlstarlet  (0) 2016.05.26
DOM vs SAX  (0) 2014.11.21
xml parser 선택 / 종류  (0) 2014.11.21
DTD / XSD  (0) 2014.11.11
xml dtd xsd  (0) 2014.11.10
Posted by 구차니
Programming/xml2014. 11. 10. 14:48
XML - eXtensible Markup Language
DTD -Document Type Definition
XSD - XML Schema Definition

[링크 : http://en.wikipedia.org/wiki/XML
[링크 : http://edia.org/wiki/Document_type_definition]
[링크 : http://en.wikipedia.org/wiki/XML_Schema_(W3C)

'Programming > xml' 카테고리의 다른 글

xmlstarlet  (0) 2016.05.26
DOM vs SAX  (0) 2014.11.21
xml parser 선택 / 종류  (0) 2014.11.21
DTD / XSD  (0) 2014.11.11
xml benchmark  (0) 2014.11.10
Posted by 구차니
Programming/qt2014. 11. 6. 15:03
/usr/local/QtEmbedded-4.8.3/lib/fonts
*.ttf
*.qpf

[링크 : http://forum.falinux.com/zbxe/index.php?document_srl=498350&mid=graphic]



1. qt는 PFA/FPB BDF,TTF,qtf 폰트등을 지원합니다. 

2. qpf 폰트는 qt가 이들 bdf, ttf 폰트를 로드해서 rendering 이라는 절차를 거치는 과정에서 qpf라는 폰트를 나름대로 만들어서 사용을 하는 폰트입니다. qt쪽에서 보다 더 빠르게 만들어 놓은 format입니다. 
[링크 : http://www.korone.net/bbs/board.php?bo_table=qt_qna&wr_id=15069

umlaut

'Programming > qt' 카테고리의 다른 글

qt signal & slot - connect / disconnect / emit  (0) 2014.11.21
qt 프로젝트 파일 연관  (0) 2014.11.20
QT modules  (0) 2014.11.05
QT Quick UI  (2) 2014.11.05
qt moc(Meta Object Compiler)  (0) 2014.09.20
Posted by 구차니
Programming/qt2014. 11. 5. 16:20
java 에서는 package라고 하고
qt 에서는 module 이라고 하나보다

아무튼 module 이름으로 include 하면된다.
#include <Qtgui> 


Modules for general software development
QtCore Core non-graphical classes used by other modules
QtGui Graphical user interface (GUI) components
QtMultimedia Classes for low-level multimedia functionality
QtNetwork Classes for network programming
QtOpenGL OpenGL support classes
QtOpenVG OpenVG support classes
QtScript Classes for evaluating Qt Scripts
QtScriptTools Additional Qt Script components
QtSql Classes for database integration using SQL
QtSvg Classes for displaying the contents of SVG files
QtWebKit Classes for displaying and editing Web content
QtXml Classes for handling XML
QtXmlPatterns An XQuery & XPath engine for XML and custom data models
QtDeclarative An engine for declaratively building fluid user interfaces.
Phonon Multimedia framework classes
Qt3Support Qt 3 compatibility classes
Modules for working with Qt's tools
QtDesigner Classes for extending Qt Designer
QtUiTools Classes for handling Qt Designer forms in applications
QtHelp Classes for online help
QtTest Tool classes for unit testing
Modules for Windows developers
QAxContainer Extension for accessing ActiveX controls
QAxServer Extension for writing ActiveX servers
Modules for Unix developers
QtDBus Classes for Inter-Process Communication using the D-Bus

[링크 : http://qt-project.org/doc/qt-4.8/modules.html]

'Programming > qt' 카테고리의 다른 글

qt 프로젝트 파일 연관  (0) 2014.11.20
QT font 관련  (0) 2014.11.06
QT Quick UI  (2) 2014.11.05
qt moc(Meta Object Compiler)  (0) 2014.09.20
Qt 기본 encoding 설정  (0) 2014.09.19
Posted by 구차니
Programming/qt2014. 11. 5. 16:12
요약 : Quick UI는 qml 이라는 문서를 통해 GUI가 생성된다.


심심(?)해서 Qt Widgets Application 대신 QT Quick UI를 해서 프로젝트를 생성하니


QT Creator 에서 복사하니 이렇게 코드가 컬러풀 하게 붙여지네 ㄷㄷ

import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Window 2.2

ApplicationWindow {
    title: qsTr("Hello World")
    width: 640
    height: 480

    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            MenuItem {
                text: qsTr("&Open")
                onTriggered: console.log("Open action triggered");
            }
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
            }
        }
    }

    Button {
        text: qsTr("Hello World")
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter
    }
}

이렇게 나온다 ㄷㄷ


'Programming > qt' 카테고리의 다른 글

QT font 관련  (0) 2014.11.06
QT modules  (0) 2014.11.05
qt moc(Meta Object Compiler)  (0) 2014.09.20
Qt 기본 encoding 설정  (0) 2014.09.19
qt 시그널 .. emit  (0) 2014.09.19
Posted by 구차니
Programming/C Win32 MFC2014. 11. 5. 15:21
대단한건 아니고 현업에서 작업을 해봤다면 다들 했고 봤을 그 녀석

#ifndef FILENAME_HEADER
#define FILENAME_HEADER 
#endif 

[링크 : http://en.wikipedia.org/wiki/Include_guard]

'Programming > C Win32 MFC' 카테고리의 다른 글

winUSB / win32 physical drive  (0) 2014.12.23
printf POSIX 확장 %1$d  (0) 2014.12.09
vc++ vector와 Vector 차이점?  (0) 2014.07.03
순열생성관련  (0) 2014.06.27
2중 포인터 사용이유  (0) 2014.03.19
Posted by 구차니