1. check : iptables -L
2. check : iptables --line -vnL
3. add rule : iptables -I INPUT 5 -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
4. check : iptables --line -vnL
ref : http://www.binarytides.com/open-http-port-iptables-centos/
kencclin@小英
2015年12月17日 星期四
2015年8月26日 星期三
[OS] Windows GPT to MBR
Windows GPT to MBR
1.使用Win7光碟或者USB引導,進入系統安裝界面。
2.按Shift + F10打開命令提示符。
3.輸入”Diskpart”(不用輸入引號,下同),並ENTET,進入操作界面
4.輸入:”list disk”,查看硬碟信息。
5.輸入:”select disk 0”,選擇disk 0爲當前操作的硬碟。
6.輸入:”Clean”,清空當前硬碟分區。
7.輸入:”convert mbr”,轉換爲MBR分區。
8.操作完成,關閉此命令提示符窗口,繼續按照正常的方法安裝Win7系統即可。
Ref : https://zh-tw.facebook.com/notes/fb%E5%A4%A7%E6%84%9B%E5%9E%8B%E7%94%B7%E6%97%A5%E8%AA%8C-%E5%90%B3%E5%BF%A0%E8%AB%BA/%E5%A6%82%E4%BD%95%E5%9C%A8win8-%E8%BD%89win7-gpt%E6%A0%BC%E5%BC%8F-%E5%AE%89%E8%A3%9D%E6%A8%A1%E5%BC%8F%E4%B8%AD-%E8%A7%A3%E6%B1%BA%E4%B8%8D%E8%83%BD%E5%AE%89%E8%A3%9D%E7%9A%84%E6%A0%BC%E5%BC%8F%E8%99%95%E7%90%86/694713627247563
2015年2月23日 星期一
[android] Android Image Crop
Android Image Crop
Intent intent = new Intent("com.android.camera.action.CROP");
// this will open all images in the Galery
intent.setDataAndType(photoUri, "image/*");
intent.putExtra("crop", "true");
// this defines the aspect ration
intent.putExtra("aspectX", aspectY);
intent.putExtra("aspectY", aspectX);
// this defines the output bitmap size
intent.putExtra("outputX", sizeX);
intent.putExtra("outputY", xizeY);
// true to return a Bitmap, false to directly save the cropped iamge
intent.putExtra("return-data", false);
//save output image in uri
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
Ref :
01 . http://stackoverflow.com/questions/3846338/how-to-crop-an-image-in-android
02. example source :
http://linux.linuxidc.com/2012%E5%B9%B4%E8%B5%84%E6%96%99/11%E6%9C%88/11%E6%97%A5/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8Android%20MediaStore%E8%A3%81%E5%89%AA%E5%A4%A7%E5%9B%BE%E7%89%87/
2015年2月9日 星期一
[Cross Compile] OpenSSL Cross Compile
UDP Socket Server & Client in C
source : ftp://ftp.openssl.org/source/
(1) cd into openssl-1.0.0d folder
(2) ./Configure linux-generic32 shared
(3) Edit Makefile Flag : CC, CFLAG, MAKEDEPPOG
(4) make clean
(5) make
2014年7月2日 星期三
[Qt4] How to change dynamically QWebFrame contents?
[Qt4] How to change dynamically QWebFrame contents?
Firstly, the setHtml will cause the loadFinished signal to be posted again, causing an infinite loop. I have attached working code of what you want to do.
#include "mainwindow.h"
Ref:
http://qt-project.org/forums/viewthread/6742/#39382
Firstly, the setHtml will cause the loadFinished signal to be posted again, causing an infinite loop. I have attached working code of what you want to do.
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtWebKit/QWebView>
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(slotloadFinished(bool)));
ui->webView->load(QUrl("http://www.google.com"));
}
MainWindow::~MainWindow()
{
disconnect(ui->webView, 0, this, 0);
delete ui;
}
void MainWindow::slotloadFinished(bool okay)
{
disconnect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(slotloadFinished(bool)));
ui->webView->setHtml("<html><body>test</body></html>");
connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(slotloadFinished(bool)));
}
Instead of the disconnect and connect, you could do this..
void MainWindow::slotloadFinished(bool okay)
{
ui->webView->blockSignals(true);
ui->webView->setHtml("<html><body>test</body></html>");
ui->webView->blockSignals(false);
}
Ref:
http://qt-project.org/forums/viewthread/6742/#39382
2014年7月1日 星期二
[Qt4] How I can get all “input” elements from webview ?
[Qt4] How I can get all “input” elements from webview ?
void Class::getElements()
https://qt-project.org/forums/viewthread/28920
http://qt-project.org/forums/viewthread/11604
http://stackoverflow.com/questions/2034981/how-to-manipulate-pages-content-inside-webkit-window-using-qt-and-qtwebkit
void Class::getElements()
{
QWebElementCollection collection = ui->cseriveOpenAPI_WebView->page()->mainFrame()->findAllElements("input");
foreach (QWebElement element, collection)
{
qDebug() << "title:" << element.attribute("title");
}
}
Ref : https://qt-project.org/forums/viewthread/28920
http://qt-project.org/forums/viewthread/11604
http://stackoverflow.com/questions/2034981/how-to-manipulate-pages-content-inside-webkit-window-using-qt-and-qtwebkit
2014年6月10日 星期二
[linux] bash return error : $? 2>&1
[linux] bash return error : $? 2>&1
bash 127 error return code
Description:
Bash scripting. Error value returned from bash script using $? variable. Simple bash script example:Code:$ cat bash-127.sh #bin/bash non-existing-command echo $?
Operating System:
Any Linux/Unix
Error:Code:$ ./bash-127.sh ./bash-127.sh: line 3: non-existing-command: command not found 127
Solution:
Value 127 is returned by your shell /bin/bash when any given command within your bash script or on bash command line is not found in any of the paths defined by PATH system environment variable. Make sure that the command your are using can be found within your $PATH. If the command is not in your path either include it or use absolute full path to it. For more information see EXIT STATUS section of the bash man page.
http://forum.linuxcareer.com/threads/1626-bash-127-error-return-code
訂閱:
文章 (Atom)
