异度部落格

学习是一种生活态度。

0%

备份

sudo tar cizvf backup.tar.gz /var/cache/apt/archives --exclude=/var/cache/apt/archives/partial/* --exclude=/var/cache/apt/archives/lock

清理

sudo apt-get clean
sudo rm -rf ~/.thumbnails/fail/gnome-thumbnail-factory/*

还原

sudo apt-get update 
sudo tar xzvf backup.tar.gz -C /

系统:Ubuntu 9.04

方案一:

需要有软件包 mid3iconv

sudo apt-get install python-mutagen

进入 mp3 目录在终端输入

mid3iconv -e GBK *.mp3
mid3iconv -e GBK */*.mp3 #如果包含子目录

方案二:

下载一个 easytag

sudo apt-get install easytag

在设置->首选项里面修改设置,将读取 ID3 标签使用的字符集和 ID3v1 修改为 GB2312

首先先去官网下载一个 qt-sdk-linux-x86-opensource,然后安装

配置 Qt4 开发环境

sudo apt-get install libqt4-dev qt4-designer qt4-doc

系统:Ubuntu 9.04

安装中文环境 系统-> 系统管理 -> 语言支持

或者

sudo apt-get install xpdf-chinese-simplified xpdf-chinese-traditional poppler-data

中文方块问题

某些软件中文字体显示为方块的问题:

sudo gedit /etc/fonts/conf.d/49-sansserif.conf

找到倒数第4行的 sans-serif 替换为 文泉驿正黑

<string>文泉驿正黑</string>

系统:Ubuntu 9.04

浏览器:Firefox 3

加速 DNS 解析 地址栏中输入:about:config 忽略警告 在页面最上部的 Filter(过滤器)中输入:network.dns.disableIPv6 页面自动刷新显示。双击 network.dns.disableIPv6 这一行,这时这一行将加粗。 重启 Firefox

安装 firefox 扩展(xpi)文件的简便方法: 将 xpi 文件拖拽到 firefox 的 窗口里面即可启动扩展安装向导。

常用插件:

IE Tab

让您可以直接在 Firefox 的标签页中以内嵌的 IE 引擎浏览网页。

MediaWrap

它能够将 ActiveX 控件方式的网页内嵌媒体转换成 Firefox 能够支持的 Plugin 方式,从而使 Firefox 也能够象 IE 一样正常播放 Wmplayer、Rmplayer、QtPlayer 和 FlashPlayer 格式的媒体文件。当然,你的系统中首先要安装过相应的播放软件及解码器,比如,Windows Media Player 和 RealPlayer 等。

FlashGot

允许 Firefox、Mozilla Suite、Netscape 和 Thunderbird 使用大多数流行的外部下载管理器处理单一的和全部("全部" 和 "选择")下载,支持 Windows, Mac OS X, Linux 和 FreeBSD 系统。

Adblock Plus

您是否仍为网页上比其他任何内容都占用加载时间的广告和条幅而烦恼?安装 Adblock Plus 扩展您就可以摆脱它们。 右键单击一个条幅广告,在上下文菜单中选择“Adblock”,它就再也不会被载入了。或者在侧栏打开 Adblock Plus 查看页面的所有元素,然后选择阻止条幅广告。您可以在过滤器中使用通配符或正则表达式来阻挡所有广告。

DownThemAll

Firefox 下非常不错的下载工具。只需一次点击即可下载网页中的所有链接;可以使用正则表达式自定义监视的文件类型;支持断点续传;多线程下载,大大提高下载速度。

DownloadHelper

DownloadHelper 是一个网页内容提取工具。他的目标是从尽可能多的站点抓取视频和图片。 他会在您的工具菜单和右键菜单添加相关菜单项,在工具栏添加图标按钮(需要您手动从自定义窗口拖出)。 您只需要象往常一样浏览网页,当 DownloadHelper 检测到它能为您做些什么的时候,他的图标就会活动起来,并允许您简单的通过单击下拉菜单项来下载识别出来的视频或图片文件。

Tab Mix Lite CE

Tab Mix Lite CE 可辅助 Firefox 的标签式浏览功能。它是 Sociz(原 Mozine)开发团队在 Tab Mix Lite 的基础上开发的社区定制版,适合追求简洁明快的轻度标签式浏览使用者。

Split Browser

此扩展根据您的喜好拆分浏览器的内容区域。它会在各个方面帮助您。例如,比较多个页面,总是显示日历,等等类似的情况

Extended Copy Menu

这个扩展提供了将所选区域作为纯文本或者 HTML 来复制的选项。 在右键菜单中增加了“作为 HTML 复制”和“作为纯文本复制”两个选项。如果你想从网页中复制文本或者相应的 HTML 到文件、邮件或者其他程序,它将显得很有用。

Download Statusbar

在浏览器底部显示一个状态栏,可以方便地查看和管理下载项。

PDF Download

当您点击一个 PDF 连接时会弹出一个对话框,让您选择是在标签页中打开还是下载它,打开后的文件格式可以选择 pdf 或者 html

本来是将硬盘分成两块,然后装双系统的。可是最近grub老师挂掉,然后就又要修复xp的启动实在太麻烦了

所以改用wubi来装,可是安装的过程中出现一直停留在creating the virual disks那里,无法进行下去。

解决方法如下:这个问题是由于文件系统造成的,本来我是用fat32的,不能创建虚拟文件系统,后来格式化为ntfs就可以了。(这个难道跟MS那次fat专利起诉案由关??)

顺便补充下:要是系统有装ghost的,最好先删除,不然可能会出现启动时候会有乱码问题,应是说是根本进不去…..貌似8.04有这个问题,不知道9.04有没

安装完以后编译 Qt 程序出现错误: No valid Qt version set. Set one in Tools/Options

查看 Tools/Options 重装也是这样的….

解决方案如下: 安装时关闭杀毒软件,我用的是 KAV 8 不知道会不会是这个问题 PS:貌似安装 Ecilipse 的 Qt 插件也会遇到一些 dll 模块无法注入的问题,解决方案相同

咱习惯用遨游了,所以习惯双击标签栏,firefox 默认是没有这个功能的,需要一个插件,

下载插件:Tab Mix Plus

首选项-> 鼠标点击 -> 双击左键 设置如下: 标签页上:关闭标签页 标签栏上:打开新标签页

或者

下载: Tab mix lite ce

这个就不用设置了,默认就可以了,咱推荐用这个,nice

这次写了一个简单的 Icon 编辑器,功能很简单的说.....详见代码

=================================================================

iconeditor.h

#ifndef ICONEDITOR_H
#define ICONEDITOR_H
#include <QtGui/QWidget>
#include <QImage>
#include <QWidget>
class IconEditor : public QWidget
{
Q_OBJECT
Q_PROPERTY(QColor penColor READ penClor WRITE setPenColor);
Q_PROPERTY(QImage iconImage READ iconImage WRITE setIconImage);
Q_PROPERTY(int zoomFactor READ zoomFactor WRITE setZoomFactor);
public:
IconEditor(QWidget *parent = 0);
~IconEditor();
void setPenColor(const QColor &newColor);
QColor penColor();
void setZoomFactor(int newZoom);
int zoomFactor() const;
void setIconImage(const QImage &newImage);
QImage iconImage() const;
QSize sizeHint() const;
protected:
void mousePressEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *);
void paintEvent(QPaintEvent *event);
private:
void setImagePixel(const QPoint &pos,bool opaque);
QRect pixelRect(int i,int j) const;
QColor curColor;
QImage image;
int zoom;
};
#endif // ICONEDITOR_H

iconeditor.cpp

#include<QtGui>
#include "iconeditor.h"
IconEditor::IconEditor(QWidget *parent)
: QWidget(parent)
{
setAttribute(Qt::WA_StaticContents);
setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
curColor=Qt::black;
zoom=8;
image=QImage(16,16,QImage::Format_ARGB32);
image.fill(qRgba(0,0,0,0));
}
/*
Qt::WA_StaticContents 用法:
Indicates that the widget contents are north-west aligned and static.
On resize, such a widget will receive paint events only for parts of itself
that are newly visible. This flag is set or cleared by the widget's author.
*/
IconEditor::~IconEditor()
{
}
void IconEditor::setPenColor(const QColor &newColor)
{
curColor=newColor;
}
QColor IconEditor::penColor()
{
return curColor;
}
void IconEditor::setZoomFactor(int newZoom)
{
if(newZoom<1)
newZoom=1;
if(newZoom!=zoom){
zoom=newZoom;
this->update();
this->updateGeometry(); //调用update和updateGeometry进行重绘
}
}
int IconEditor::zoomFactor() const
{
return zoom;
}
void IconEditor::setIconImage(const QImage &newImage)
{
if(newImage!=image){
image=newImage.convertToFormat(QImage::Format_ARGB32);
this->update();
this->updateGeometry();
}
}
QImage IconEditor::iconImage() const
{
return image;
}
QSize IconEditor::sizeHint() const
{
QSize size=zoom*image.size();
if(zoom>=3)
size+=QSize(1,1); //当zoom>=3时,增加一个像素用存放网格线
return size;
}
/*只要重绘就会调用这个函数*/
void IconEditor::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
if(zoom>=3){
painter.setPen(palette().foreground().color());
//绘制垂直表格线
for(int i=0;i<=image.height();++i)
painter.drawLine(zoom*i,0,zoom*image.width(),zoom*i); //(x1,y1) to (x2,y2)
//绘制水平表格线
for(int j=0;j<image.width();++j)
painter.drawLine(0,zoom*j,zoom*image.width(),zoom*j);
}
for(int i=0;i<image.width();++i){
for(int j=0;j<image.height();++j){
QRect rect=pixelRect(i,j);
if(!event->region().intersect(rect).isEmpty()){ //region区域
QColor color=QColor::fromRgba(image.pixel(i,j)); //pixel(x,y)返回(x,y)的一个像素
if(color.alpha()<255)
painter.fillRect(rect,Qt::white);
painter.fillRect(rect,color);
}
}
}
}
QRect IconEditor::pixelRect(int i,int j) const
{
if(zoom>=3){
return QRect(zoom*i+1,zoom*j+1,zoom-1,zoom-1);
}else{
return QRect(zoom*i,zoom*j,zoom,zoom); //QRect其中一种构造函数,QRect ( int x, int y, int width, int height )
}
}
void IconEditor::mousePressEvent(QMouseEvent *event)
{
if(event->button()==Qt::LeftButton){
setImagePixel(event->pos(),true);
}else if(event->button()==Qt::RightButton){
setImagePixel(event->pos(),false);
}
}
void IconEditor::mouseMoveEvent(QMouseEvent *event)
{
if(event->buttons()& Qt::LeftButton){ //用Qt::LeftButton与buttons位或
setImagePixel(event->pos(),true);
}else if(event->buttons()& Qt::RightButton){
setImagePixel(event->pos(),false);
}
}
void IconEditor::setImagePixel(const QPoint &pos,bool opaque)
{
int i=pos.x()/zoom;
int j=pos.y()/zoom;
if(image.rect().contains(i,j)){
if(opaque){
image.setPixel(i,j,penColor().rgba());
}else{
image.setPixel(i,j,qRgba(0,0,0,0));
}
}
update(pixelRect(i,j));
}

main.cpp

#include <QtGui/QApplication>
#include "iconeditor.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
IconEditor *iconEditor=new IconEditor;
iconEditor->setWindowTitle("Icon Editor");
iconEditor->setIconImage(QImage(":/images/qt-logo.png"));
iconEditor->show();
return app.exec();
}

PS:貌似无话可说