dpkg-query -W --showformat='${Installed-Size;10}\t${Package}\n' | sort -k1,1n
dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n
source:
dpkg-query -W --showformat='${Installed-Size;10}\t${Package}\n' | sort -k1,1n
dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n
servers
configuration file to indicate which proxy to use. The file's location depends on your operating system. On Linux or Unix it is located in the directory ~/.subversion
. On Windows it is in %APPDATA%\Subversion
(try echo %APPDATA%
, note this is a hidden directory).servers
file and add something like at global session: [global] http-proxy-host = your.proxy.name http-proxy-port = 3128Check your internet browser setting, if you have only a proxy configuration, for example http://proxyconf.some.name. You can simply open this link using your browser and download the configuration script, I believe you can find the proxy server and the port.
/**************************************************************************** ** ** file: [filename] ** author: [your name] ** date: [date goes here] ** summary: ** Copyright (C) 2010 xxx GmbH and/or its subsidiary(-ies). ** All rights reserved. ** ****************************************************************************/
if [ $# -ne 1 ]; then echo "Usage: add-header.sh filename" exit 1 fi file=$1 # check if the header exists firstline=`head -1 ${file}` if [ "${firstline:0:2}" = "/*" ]; then echo "header exists. do nothing." else # add header.in at the begin of the file # and copy to a temp file ( cat header.in; cat ${file} ) > ${file}.new # replace the [filename] by current file name filename=`echo ${file}|sed "s,.*/\(.*\),\1,"` sed -i "s#\[filename\]#$filename#g" ${file}.new # replace the author name author='Jingfeng Han' sed -i "s#\[your name]#$author#g" ${file}.new # replace the date date=`date +"%y/%m/%d/"` sed -i "s#\[date goes here]#$date#g" ${file}.new # replace old file with the temp file rm ${file} mv ${file}.new ${file} fi exit 0
find $1 -type f -iname "*.h" -o -iname "*.cpp" -o -iname "*.qml" | while read file; do # display info echo ${file} ... # add header to the file ./add-header.sh ${file} done exit 0
int sqlite3_clear_bindings(sqlite3_stmt*);
int sqlite3_reset(sqlite3_stmt *pStmt);
startElement
endElement
characters
<Items>
<Item>
<Material>all purpose flour, stir before measuring</Material>
<Mount Unit="cups">3</Mount>
</Item>
<Item>
<Material>1 1/2 teaspoons baking soda</Material>
</Item>
<Item>
<Material>1 1/2 teaspoons ground cinnamon</Material>
</Item>
<Item>
<Material>8 ounces unsalted butter</Material>
</Item>
</Items>
#include <QtXml/qxml.h>
#include <QString>
static const char TAG_ITEM[] = "Item";
static const char TAG_MATERIAL[]= "Material";
static const char TAG_MOUNT[] = "Mount";
class MyParser : public QXmlDefaultHandler
{
public:
bool startElement( const QString & namespaceURI,
const QString & localName,
const QString & qName,
const QXmlAttributes & atts )
{
if( localName == TAG_ITEM) {}
else if( localName == TAG_MATERIAL ) {}
else if( localName == TAG_MOUNT ){}
else{return false;}
currElement_ = localName;
return true;
}
bool characters ( const QString& ch_in)
{
if( currElement_ == TAG_ITEM) {}
else if( currElement_ == TAG_MATERIAL ) {}
else if( currElement_ == TAG_MOUNT ){}
else{return false;}
return true;
}
bool endElement( const QString&, const QString& localName, const QString& )
{
if( localName == TAG_ITEM) {}
else if( localName == TAG_MATERIAL ) {}
else if( localName == TAG_MOUNT ){}
else{return false;}
currElement_ = localName;
return true;
}
private:
QString currElement_;
};
> find . -name "*.php" -print | xargs sed -i 's/foo/bar/g'
find . | xargs grep 'string'
find . -name "*.cpp" -o -name "*.h" -print
"select File from tb_image where ID=?1"
SqlHandler::prepare_sql(const char* sql_in, sqlite3_stmt*& pStmt_in)
The image object can be retrieved with different id.bool SqlHandler::getRecipeHeaderImage( const int& imageId_in, QImage& image_out)
//-----------------------Example Code---------------------
static const char SQL_SELECT_HEADERIMAGE[]= "select File from tb_image where ID=?1";
SqlHandler::SqlHandler()
:bIsDBAvailable_(false)
,db_(0)
,pStmtHeaderImage_(0)
{
// Open the database
sqlite3_open(COKI_DB_FILE, &db_);
if( SQLITE_OK!=sqlite3_errcode(db_) )
{
qCritical("DB error: fail to open db file.");
sqlite3_close(db_);
return;
}
//prepare the SQL statement for select header info
if(!prepare_sql(SQL_SELECT_HEADERINFO, pStmtHeaderInfo_))
{
return;
}
SqlHandler::~SqlHandler()
{
sqlite3_finalize(pStmtHeaderImage_);
sqlite3_close(db_);
}
bool SqlHandler::isDBAvailable()
{
return bIsDBAvailable_;
}
bool SqlHandler::getRecipeHeaderImage( const int& imageId_in,
QImage& image_out)
{
if(!isDBAvailable())
{
return false;
}
// add id into sql statement
int iReturnCode = sqlite3_bind_int( pStmtHeaderImage_, 1, imageId_in);
if(iReturnCode != SQLITE_OK)
{
qCritical("Error: sqlite3_bind_in fails for ImageId = %d",imageId_in);
return false;
}
QString strFileName = COKI_IMAGE_DIR;
//execute the statement
iReturnCode = sqlite3_step( pStmtHeaderImage_ );
switch (iReturnCode )
{
case SQLITE_DONE:
return false;
break;
case SQLITE_ROW:
//load image
strFileName.append ((const char*)sqlite3_column_text( pStmtHeaderImage_, 0));
image_out.load(strFileName);
return true;
break;
default:
return false;
}
}
bool SqlHandler::prepare_sql(const char* sql_in, sqlite3_stmt*& pStmt_in)
{
if(sqlite3_prepare_v2(db_, sql_in, -1, &pStmt_in, 0))
{
sqlite3_finalize(pStmt_in);
return false;
}
return true;
}
bool MyClass::initialize(int id_in)
{
sqlite3* db;
sqlite3_stmt * pSTmt;
int iReturnCode = 0;
bool bRet = true;
// Open the database
sqlite3_open("my.db", &db);
if( SQLITE_OK!=sqlite3_errcode(db) )
{
qWarning("DB error: fail to open db file.");
sqlite3_close(db);
return false;
}
//prepare the SQL statement
char sSql[1000];
sprintf(sSql, "select Name, Owner, Category, Duration from tb where ID=%d", id_in);
if(sqlite3_prepare_v2(db, sSql, -1, &pSTmt, 0))
{
qWarning("DB error: fail to prepare the sql statement: [%s]", sSql);
sqlite3_finalize(pSTmt);
sqlite3_close(db);
return false;
}
//execute the statement
iReturnCode = sqlite3_step(pSTmt);
switch (iReturnCode )
{
case SQLITE_DONE:
qWarning("Warning: No record is found!");
bRet = false;
break;
case SQLITE_ROW:
sName_ = (const char*)sqlite3_column_text(pSTmt, 0);
sCategory_ = (const char*)sqlite3_column_text(pSTmt, 1);
sOwner_ = (const char*)sqlite3_column_text(pSTmt, 2);
sDuration_ = (const char*)sqlite3_column_text(pSTmt, 3);
bRet = true;
break;
default:
qWarning("DB error: fail to step the sql statement: [%s]", sSql);
qWarning("DB error code:");
bRet = false;
}
//finialize the state statement
sqlite3_finalize(pSTmt);
sqlite3_close(db);
return bRet;
}
ListDialog::ListDialog()
{
QScrollArea *scrollArea = new QScrollArea(this);
QGroupBox *groupBox = new QGroupBox(scrollArea);
QVBoxLayout *vbox = new QVBoxLayout;
for (int i=0; i< 20; i++)
{
vbox->addWidget(new QRadioButton("item xxx"));
}
groupBox->setLayout(vbox);
scrollArea->setWidget(groupBox);
QHBoxLayout* layout = new QHBoxLayout();
layout->addWidget(scrollArea);
setLayout(layout);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
//abstract class, never be created because abstract
//functions is not yet implemented
public abstract class MarkerBase
{
protected MarkerBase( string req_in ) {}
protected abstract int getMarkerID();
}
//subclass implement the abstract function and
//its constructor reuses the protected
//constructor of its abstract parent.
public class MyMarker : MarkerBase
{
public MyMarker(string req_in) : base(req_in){}
protected override int getMarkerID(){return 0;}
}
class DBReader
{
public:
void insertRecord(const char* sql_in);
void select(const char* sql_in);
private:
sqlite3 * db_;
//for singleton design pattern
public:
static DBReader* getInstance();
private:
static DBReader* pDBReader_;
DBReader();
void databaseError();
};
DBReader* DBReader::pDBReader_ = NULL;
DBReader* DBReader::getInstance()
{
if(pDBReader_ == NULL)
{
pDBReader_ = new DBReader();
}
return pDBReader_;
}
DBReader::DBReader()
:db_(NULL)
{
// Open the database
sqlite3_open("coki.db", &db_);
if( SQLITE_OK!=sqlite3_errcode(db_) )
{
databaseError();
return;
}
}
...
int main()
{
....
//DBReader::getInstance() is the only
//way to get access database.
DBReader::getInstance()-> insertRecoard(sSQL_CM1);
DBReader::getInstance()-> select(sSQL_CM2);
return 0;