Tuesday, April 19, 2011

copy text from Vim in PuTTY by highlighting text

copy text from Vim in PuTTY by highlighting text

Method 1:

Holding shift while highlighting.

Method 2:

In ~/.vimrc

" Set mouse equals to nothing stopping vim from interpreting the mouse clicks.
set mouse=

Method 3:

Using Putty ... .to copy whole contains to your clipboard then ... what you do is ...

1. Clear the screen ..
2. Clear the scrollback by right click on the top bar and select the option "clear scrollback".
3. From the same option you will find "change settings" --> select this option and againg select "window" option where specify the huge no. say 99999 in no. line for scrollback where it is 200 by default.

4. Now run the file by using the cat <filename>
5. Right click on the top bar and select the "copy all to clipboard"
6. paste it in the notepad.

Method 4:

you get file in the other way also.

1. You can select the "logging " -> and select the radio button "Log all session output" in Session logging.
2. In the log file name .. specify the log file location by clicking the browse button.
3. Now run the file by cat <filename>.
4. After the file contains end. you can see the the log file which you specified in the log file.

Reference:
https://bbs.archlinux.org/viewtopic.php?id=52862
http://www.unix.com/unix-dummies-questions-answers/31386-copy-text-file-vi-editor-windows-clipboard-2.html

Sunday, April 17, 2011

running wireshark as root on Mac OSX

running wireshark as root on Mac OSX
In Python on February 22, 2010 by Tzury Bar Yochay Tagged: mac, wireshark

After installing the .dmg packge you should run

$ sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark
In order to capture traffic on the interfaces

Reference:
http://evalinux.wordpress.com/2010/02/22/running-wireshark-as-root-on-mac-osx/

Monday, April 11, 2011

相信我,有一天你會遇到一個讓你願意付出一切的女人,你會不自覺再度流露出純真的笑容

我有習慣把平常看到的文章 or 討論區 看到 很棒的 句子 收集起來

這是在一個討論區看到有人的回文:「以前我沒錢 也被拋棄過 現在我有點錢了 卻也不想再交女友 (雖然前鎮子有脫團過一個月 就分了) 因為 我會很敏感的猜測 他是不是只>想要我的錢說實在的 想起來還真有點可悲 有時候我在想 我寧願回到以前有穩定工作但不是很有錢的時候 至少我會覺得比較開心 笑的時
候 是發自內心的笑 那純真好像已經回不來了」

然後,底下有另外一個人的回覆,讓我印象深刻:「我不認識你,但是看你這樣,也會覺得很難過. 相信我,有一天你會遇到一個讓你願意付出一切的女人,你會不自覺再度流露出純真的笑容.

這幾天,獨自走在路上的時候,常常會想起這句話 ↑↑

Thursday, April 7, 2011

Theming the Drupal 6 User Login Form

Note: for myself, this method seems good at first glance. However, it did not cache the form. That means, the form gets rebuild every time you reload the page.

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

There are a great deal of articles out there on theming the Drupal User Login Form, but most don't give you granular control over each individual form element. Rather, you are restricted to mainly editing the css. Here is a way to have complete granular control over each element within the user login form...

1. Place this function either in a module or in your template.php:


function get_user_login_form() {
$form_id = 'user_login';
$form = array();
$form['name'] = array(
'#type' => 'textfield',
'#maxlength' => USERNAME_MAX_LENGTH,
'#required' => TRUE,
'#attributes' => array('tabindex' => '1'),
);
$form['pass'] = array(
'#type' => 'password',
'#required' => TRUE,
'#attributes' => array('tabindex' => '2'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Log in'),
'#weight' => 2,
'#attributes' => array('tabindex' => '3')
);
$form['#validate'] = user_login_default_validators();
$form['#build_id'] = sprintf('form-%s', md5(uniqid(mt_rand(), TRUE)));
$form_state = array(
'storage' => NULL,
'submitted' => FALSE,
);

$form['#post'] = $_POST;
drupal_prepare_form($form_id, $form, $form_state);
drupal_process_form($form_id, $form, $form_state);
$out = new stdClass;
$out->form_start =
sprintf("<form method='post' accept-charset='UTF-8' action='%s'>",
url('user/login'));
$out->form_end = "</form>";
$out->name = drupal_render($form['name']);
$out->pass = drupal_render($form['pass']);
$out->submit =
drupal_render($form['submit']) .
drupal_render($form['form_id']) .
drupal_render($form['form_build_id']) .
drupal_render($form['form_token']);
return $out;
}


2. In your .tpl.php file, output the fields


<?php
$login_form = get_user_login_form();
?>
<?php print $login_form->form_start; ?>
Username: <?php print $login_form->name; ?><br />
Password: <?php print $login_form->pass; ?><br />
<?php print $login_form->submit; ?>
<?php print $login_form->form_end; ?>

Reference:
http://blog.aphexcreations.net/2009/04/theming-drupal-user-login-form.html