LD_LIBRARY_PATH="/opt/QtSDKs/Qt5.3.1/5.3/gcc_64/lib:/opt/QtSDKs/Qt5.3.1/5.3/gcc_64/lib:/home/user/projects/jansson/lib:$LD_LIBRARY_PATH" ./my_cool_app
git config --global core.autocrlf input
Или для подобного надо с нуля делать девайс на особой программируемой микросхеме?
Но эффекта ни какого , может нужно внести изменения в makefile ?
INCLUDES = -I/usr/local/include/php -I/usr/local/include/php/main ...
CPPFLAGS="-I/usr/include/ -I/usr/include/php" ./configure ...
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
#include <iconv.h>
string iconv_recode(const string from, const string to, string text)
{
iconv_t cnv = iconv_open(to.c_str(), from.c_str());
if (cnv == (iconv_t) - 1) {
iconv_close(cnv);
return "";
}
char *outbuf;
if ((outbuf = (char *) malloc(text.length()*2 + 1)) == NULL) {
iconv_close(cnv);
return "";
}
char *ip = (char *) text.c_str(), *op = outbuf;
size_t icount = text.length(), ocount = text.length()*2;
if (iconv(cnv, &ip, &icount, &op, &ocount) != (size_t) - 1) {
outbuf[text.length()*2 - ocount] = '\0';
text = outbuf;
} else {
text = "";
}
free(outbuf);
iconv_close(cnv);
return text;
}
void compare_strings(const string &aString1, const string &aString2) {
cout << "String 1: " << aString1 << endl
<< "String 2: " << aString2 << endl;
if (aString1 == aString2) {
cout << "Identical strings!" << endl
<< "-----" << endl;
} else {
cout << "Different strings!" << endl
<< "-----" << endl;
}
}
int main()
{
ifstream file_1("word_1.txt"); // The "Proverka" Word in UTF-8
ifstream file_2("word_2.txt"); // The "Proverka" Word in CP1251
string word_1, word_2;
file_1 >> word_1;
file_2 >> word_2;
compare_strings(word_1, word_2);
word_2 = iconv_recode("CP1251", "UTF-8", word_2);
compare_strings(word_1, word_2);
return 0;
}
exl@exl-Lenovo-G560e:~/SandBox/text_enc > enca -L russian word_1.txt
Universal transformation format 8 bits; UTF-8
Doubly-encoded to UTF-8 from ISO-8859-5
exl@exl-Lenovo-G560e:~/SandBox/text_enc > enca -L russian word_2.txt
MS-Windows code page 1251
LF line terminators
exl@exl-Lenovo-G560e:~/SandBox/text_enc > cat word_1.txt
Проверка
exl@exl-Lenovo-G560e:~/SandBox/text_enc > cat word_2.txt
��������
exl@exl-Lenovo-G560e:~/SandBox/text_enc > ./text_coding
String 1: Проверка
String 2: ��������
Different strings!
-----
String 1: Проверка
String 2: Проверка
Identical strings!
-----
#include "qpaintwidget.h"
#include <QPainter>
#include <QDebug>
QPaintWidget::QPaintWidget(QWidget *parent)
: QWidget(parent)
{
offset = 0;
resize(800, 600);
paintTimer = new QTimer(this);
paintTimer->start(10);
connect(paintTimer, SIGNAL(timeout()), this, SLOT(updatePixmap()));
}
void QPaintWidget::paintEvent(QPaintEvent *)
{
QColor whitebrush = Qt::white;
QColor blackbrush = Qt::black;
QColor redbrush = Qt::darkRed;
QPainterPath path;
QPainter painter(this); // Создаём новый объект рисовальщика
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(Qt::NoPen);
painter.translate(1 + offset, 0);
painter.setBrush(whitebrush);
painter.drawRect(0, 0, width(), height());
QPoint triangle[3] = {
QPoint(180, 450),
QPoint(220, 450),
QPoint(200, 555),
};
painter.setBrush(blackbrush);
painter.drawEllipse(10, 15, 380, 380);
painter.setBrush(redbrush);
painter.drawEllipse(35, 8, 330, 330);
painter.setBrush(whitebrush);
painter.drawEllipse(50, -5, 300, 330);
painter.setBrush(blackbrush);
painter.drawPolygon(triangle, 3);
path.setFillRule(Qt::WindingFill);
path.addRect(180, 250, 40, 200);
path.addRect(150, 250, 100, 20);
painter.drawPath(path);
painter.setBrush(whitebrush);
painter.drawEllipse(120, 260, 60, 20);
painter.drawEllipse(220, 260, 60, 20);
}
void QPaintWidget::updatePixmap()
{
(offset >= 810) ? offset = 0 : offset+=5;
qDebug() << offset;
repaint();
}
QPaintWidget::~QPaintWidget()
{
}
#ifndef QPAINTWIDGET_H
#define QPAINTWIDGET_H
#include <QWidget>
#include <QTimer>
class QPaintWidget : public QWidget
{
Q_OBJECT
int offset;
QTimer *paintTimer;
protected:
void paintEvent(QPaintEvent *);
private slots:
void updatePixmap();
public:
QPaintWidget(QWidget *parent = 0);
~QPaintWidget();
};
#endif // QPAINTWIDGET_H
#!/bin/bash
OLDIFS=$IFS
string=$1
IFS='.'
string_array=($string)
len=$(( ${#string_array[@]} - 1 ))
IFS=$OLDIFS
echo ${string_array[$len]}
exl@exl-Lenovo-G560e:~/SandBox > ./token.sh ..log.f
f
exl@exl-Lenovo-G560e:~/SandBox > ./token.sh .log.ccc
ccc
exl@exl-Lenovo-G560e:~/SandBox > ./token.sh log.qwerty
qwerty