Sunday, November 29, 2009

Linux command

* Listing files/folder
ls -lht
-l: long format
-h: human readable size (ex: 2k, 2M,..)
-t: sort by time (default = sort by name)
* Count number of line in file
wl -l filename
* Get last 100 line of a file and numbering
tail -100 source | nl > dest
* Remove whole directory and all files inside
rm -r folder_name
-r: recursive
* Backup a folder
tar -cvf file.tar folder_name
* Extract a file
tar -xvf file.tar
* Disk use:
du - sh
-s: only total sum
-h: size human format
du | sort -n (unix)
du | sort -g (fedora)
* Install package
sudo apt-get install vim-runtime
* Check disk space
df -h
* Check memory
prstat -a
vmstat
* Find file
find / -name filepattern
locate filepattern
* Mound a pen drive
mount /dev/sda1 /mnt/usbdisk
* Change mode
chmod ugo+rwx directory1
* Find text in files
find . -type f -exec grep "pattern" {} \;
* Make a pdf of a manual page
man -t man |ps2pdf - > man.pdf
* Go to previous directory
cd -

Thursday, November 26, 2009

IE security settings




General

  1. .Net framework: related to .NET itself

  2. .Net framework-reliant component: related to component which is developed base on .NET

  3. ActiveX control and plug-ins: (ActiveX = Java applets)

  4. Download: file and font download setting

  5. Enable .NET framework setup: .NET framework again.

  6. Scripting: Control script langauge (ex: javascript)

  7. User authentication: auto log on machenics

  8. Miscelaneous: Not belong to any categories



Miscelaneous

  1. Access data sources cross domain: ???

  2. Allow META REFRESH: a method of instructing a web browser to automatically refresh the current web page or frame after a given time interval.

Monday, November 23, 2009

SaIQ1RiNlnVxc

caaspw02: SaIQ1RiNlnVxc

Sunday, November 22, 2009

Insert checkbox to Excel 2010 (2007)


  1. Display the Developer tab


    • Click Microsoft Office Button and then click Excel Option.

    • Click Customize Ribbon in the Left Pannel

    • Select "Main Tabs" Ribbon below "Customize the Ribbons"

    • Check in to Developer checkbox

    • Click OK to save your change


  2. Click on Developer tab

  3. Click Insert button on Rubbon to insert form controls: checkbox/radio/...





Thursday, November 19, 2009

Some Oracle queries


  1. List all tables: select * from tab;

  2. Print database name: select ora_database_name from dual;

  3. Run a script file: SQL> @/oracle/scripts/script.sql




Oracle error: java.lang.Exception: Exception in sending Request :: null

Go to your emd.properties file and change agentTZRegion parameter
In our case it was: agentTZregion=Singapore (for a list of supported region, refer to oracle\product\10.2.0\db_1\sysman\admin\supportedtzs.lst file)

Reboot and watch dbconsole work.

Thursday, November 12, 2009

How to extend your monitor over two laptops

- You have two laptops but you are working on both of them.
- You don't want to waste the other monitor when using remote desktop.
- You don't want to continuously leave and grab mouse.

Question: how to extend the monitor? Then, when I move the mouse over the edge of the primary screen, the mouse will move to the screen of the secondary laptop. Below is my solution for doing that. You need to tools (all free) to do this.


  1. Download and run TightVNC on the secondary laptop. This will be the VNC server.

  2. Run TightVNC as a Viewer on the primary laptop and connect to the secondary one



  3. Extend your primary laptop by using Projector mode (for Windows 7, press Win+P)





  4. Now, move your VNC Viewer window to the extended area of the primary laptop. You will not able to see the VNC Viewer windows. But when you move your mouse over the hidden area, you can see the mouse in the secondary laptop's screen.

  5. Now, it's nearly done. Except that when you maximize a windows in primary laptop, the VNC automatically minimize to the taskbar. To prevent this, install the OnTop utility and make the VNC Viewer ontop of all windows.

Wednesday, November 11, 2009

windows 7 activation keys

Windows 7 32 bits: 6JKV2-QPB8H-RQ893-FW7TM-PBJ73

Sunday, November 8, 2009

Remove in xml/html file

Find: ^\s*<!--((?!-->).)+-->\s*\n
Replace by empty
Regular Expression: Yes
Option: - Multiline: Yes; Single line: Yes

Thursday, November 5, 2009

Basic config mail server (James)


<?xml version="1.0"?>
<!DOCTYPE config [
<!ENTITY fetchmailConfig SYSTEM "../conf/james-fetchmail.xml">
]>
<config>
<James>
<postmaster>error@sonle.com</postmaster>
<servernames autodetect="false" autodetectIP="false">
<servername>sonle.com</servername>
</servernames>
<usernames ignoreCase="true" enableAliases="true" enableForwarding="true"/>
<inboxRepository>
<repository destinationURL="file://var/mail/inboxes/" type="MAIL"/>
</inboxRepository>
</James>
&fetchmailConfig;
<mailetpackages>
<mailetpackage>org.apache.james.transport.mailets</mailetpackage>
<mailetpackage>org.apache.james.transport.mailets.smime</mailetpackage>
</mailetpackages>
<matcherpackages>
<matcherpackage>org.apache.james.transport.matchers</matcherpackage>
<matcherpackage>org.apache.james.transport.matchers.smime</matcherpackage>
</matcherpackages>
<spoolmanager>
<threads> 10 </threads>
<processor name="root">
<mailet match="All" class="PostmasterAlias"/>
<mailet match="RelayLimit=30" class="Null"/>
<mailet match="HasMailAttributeWithValue=org.apache.james.infected, true" class="ToProcessor">
<processor> virus </processor>
</mailet>
<mailet match="HasMailAttribute=spamChecked" class="ToProcessor">
<processor> transport </processor>
</mailet>
<mailet match="All" class="SetMailAttribute">
<spamChecked>true</spamChecked>
</mailet>
<mailet match="SMTPAuthSuccessful" class="ToProcessor">
<processor> transport </processor>
</mailet>
<mailet match="InSpammerBlacklist=query.bondedsender.org."
class="ToProcessor">
<processor> transport </processor>
</mailet>
<mailet match="InSpammerBlacklist=dnsbl.njabl.org."
class="ToProcessor">
<processor> spam </processor>
<notice>550 Requested action not taken: rejected - see http://njabl.org/ </notice>
</mailet>
<mailet match="All" class="ToProcessor">
<processor> transport </processor>
</mailet>
</processor>
<processor name="error">
<mailet match="All" class="ToRepository">
<repositoryPath> file://var/mail/error/</repositoryPath>
</mailet>
</processor>
<processor name="transport">
<mailet match="SMTPAuthSuccessful" class="SetMimeHeader">
<name>X-UserIsAuth</name>
<value>true</value>
</mailet>

<mailet match="HasMailAttribute=org.apache.james.SMIMECheckSignature" class="SetMimeHeader">
<name>X-WasSigned</name>
<value>true</value>
</mailet>
<mailet match="RecipientIsLocal" class="LocalDelivery"/>
<mailet match="HostIsLocal" class="ToProcessor">
<processor> local-address-error </processor>
<notice>550 - Requested action not taken: no such user here</notice>
</mailet>
<mailet match="RemoteAddrNotInNetwork=127.0.0.1" class="ToProcessor">
<processor> relay-denied </processor>
<notice>550 - Requested action not taken: relaying denied</notice>
</mailet>
<mailet match="All" class="RemoteDelivery">
<outgoing> file://var/mail/outgoing/ </outgoing>
<delayTime> 5 minutes </delayTime>
<delayTime> 10 minutes </delayTime>
<delayTime> 45 minutes </delayTime>
<delayTime> 2 hours </delayTime>
<delayTime> 3 hours </delayTime>
<delayTime> 6 hours </delayTime>
<maxRetries> 25 </maxRetries>
<deliveryThreads> 1 </deliveryThreads>
<sendpartial>false</sendpartial>
<bounceProcessor>bounces</bounceProcessor>
</mailet>

</processor>
<processor name="spam">
<mailet match="All" class="ToRepository">
<repositoryPath>file://var/mail/spam/</repositoryPath>
</mailet>
</processor>
<processor name="virus">
<mailet match="All" class="SetMailAttribute">
<org.apache.james.infected>true, bouncing</org.apache.james.infected>
</mailet>
<mailet match="SMTPAuthSuccessful" class="Bounce">
<inline>heads</inline>
<attachment>none</attachment>
<notice> Warning: We were unable to deliver the message below because it was found infected by virus(es). </notice>
</mailet>
<mailet match="All" class="Null" />
</processor>
<processor name="local-address-error">
<mailet match="All" class="ToRepository">
<repositoryPath> file://var/mail/address-error/ </repositoryPath>
</mailet>
</processor>
<processor name="relay-denied">
<mailet match="All" class="ToRepository">
<repositoryPath>file://var/mail/relay-denied/</repositoryPath>
</mailet>
</processor>
<processor name="bounces">
<mailet match="All" class="DSNBounce">
<passThrough>false</passThrough>
</mailet>
</processor>
</spoolmanager>
<dnsserver>
<servers>
</servers>
<autodiscover>true</autodiscover>
<authoritative>true</authoritative>
<maxcachesize>50000</maxcachesize>
</dnsserver>
<remotemanager enabled="true">
<port>4555</port>
<handler>
<helloName autodetect="true">sgsv-minhle01</helloName>
<administrator_accounts>
<account login="root" password="root"/>
</administrator_accounts>
<connectiontimeout> 60000 </connectiontimeout>
<prompt>james&gt;</prompt>

</handler>
</remotemanager>
<pop3server enabled="true">
<port>110</port>
<handler>
<helloName autodetect="true">sgsv-minhle01</helloName>
<connectiontimeout>120000</connectiontimeout>
</handler>
</pop3server>

<smtpserver enabled="true">
<port>25</port>
<handler>
<helloName autodetect="true">sgsv-minhle01</helloName>
<connectiontimeout>360000</connectiontimeout>
<authRequired>true</authRequired>
<maxmessagesize>0</maxmessagesize>
</handler>
</smtpserver>
<nntpserver enabled="false">
</nntpserver>

<nntp-repository>
<readOnly>false</readOnly>
<rootPath>file://var/nntp/groups</rootPath>
<tempPath>file://var/nntp/temp</tempPath>
<articleIDPath>file://var/nntp/articleid</articleIDPath>
<articleIDDomainSuffix>news.james.apache.org</articleIDDomainSuffix>
<newsgroups>
<newsgroup>org.apache.avalon.user</newsgroup>
</newsgroups>

<spool>
<configuration>
<spoolPath>file://var/nntp/spool</spoolPath>
<threadCount>1</threadCount>
<threadIdleTime>60000</threadIdleTime>
</configuration>
</spool>
</nntp-repository>
<spoolrepository destinationURL="file://var/mail/spool/" type="SPOOL"/>
<mailstore>
<repositories>
<repository class="org.apache.james.mailrepository.AvalonMailRepository">
<protocols>
<protocol>file</protocol>
</protocols>
<types>
<type>MAIL</type>
</types>
</repository>
<repository class="org.apache.james.mailrepository.AvalonSpoolRepository">
<protocols>
<protocol>file</protocol>
</protocols>
<types>
<type>SPOOL</type>
</types>
</repository>

<repository class="org.apache.james.mailrepository.filepair.File_Persistent_Object_Repository">
<protocols>
<protocol>file</protocol>
</protocols>
<types>
<type>OBJECT</type>
</types>
<models>
<model>SYNCHRONOUS</model>
<model>ASYNCHRONOUS</model>
<model>CACHE</model>
</models>
</repository>

<repository class="org.apache.james.mailrepository.filepair.File_Persistent_Stream_Repository">
<protocols>
<protocol>file</protocol>
</protocols>
<types>
<type>STREAM</type>
</types>
<models>
<model>SYNCHRONOUS</model>
<model>ASYNCHRONOUS</model>
<model>CACHE</model>
</models>
</repository>
</repositories>

</mailstore>
<users-store>
<repository name="LocalUsers" class="org.apache.james.userrepository.UsersFileRepository">
<destination URL="file://var/users/"/>
</repository>
</users-store>
<database-connections>
</database-connections>
<connections>
<idle-timeout>300000</idle-timeout>
<max-connections>30</max-connections>
</connections>
<sockets>
<server-sockets>
<factory name="plain" class="org.apache.avalon.cornerstone.blocks.sockets.DefaultServerSocketFactory"/>
</server-sockets>
<client-sockets>
<factory name="plain" class="org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketFactory"/>
</client-sockets>
</sockets>
<thread-manager>
<thread-group>
<name>default</name>
<priority>5</priority>
<is-daemon>false</is-daemon>
<max-threads>100</max-threads>
<min-threads>20</min-threads>
<min-spare-threads>20</min-spare-threads>
</thread-group>
</thread-manager>
</config>

How to backup Oracle database


  • Export full database

  • $exp USERID=scott/tiger FULL=y FILE=myfull.dmp


  • Example of Exporting Schemas

  • $exp USERID=scott/tiger OWNER=(SCOTT,ALI) FILE=exp_own.dmp


    The above command will export all the objects stored in SCOTT and ALI’s schema.

  • Exporting Individual Tables

  • $exp USERID=scott/tiger TABLES=(scott.emp,scott.sales) FILE=exp_tab.dmp


    This will export scott’s emp and sales tables.

  • Using Import Utility

  • IMP SCOTT/TIGER

  • IMP KEYWORD=value or KEYWORD=(value1,value2,...,valueN)

  • IMP SCOTT/TIGER IGNORE=Y TABLES=(EMP,DEPT) FULL=N


    USERID must be the first parameter on the command line.

Wednesday, November 4, 2009

How to setup email section in weblogic

Login to weblogic console

Click on Mail link below Other services section

Click "Configure a New Mail Section"

Enter the mail section information.
- JNDI name is used for reference in souce code
- Host name is the mail server name
Click Apply button

Select an application to deploy to.

Verify steps:
- Click on the Console link on the left panel
- Click on the View JNDI tree

The created email section should be displayed on the left panel

How to align images in blogger


  • At first, two images are not aligned like this


  • Open the "Edit Html" tab, you will see this


  • Change the value of right margin from 10px to 1000px


  • Public your post and review the result.


NirSoft


  1. mailpv - view mail client password

  2. SkypeLogView - view Skype log without login

  3. SiteShoter - a small utility that allows you to save a screenshot of any Web page into a file

  4. HtmlDocEdit - Simple editor/designer for HTML files

  5. PasswordFox - Reveal the user names/passwords stored in Firefox

  6. ChromePass - Chrome Browser Password Recovery

  7. Asterisk Logger - Reveal/recover/monitor password behind asterisks ...

  8. AsterWin IE - Reveal asterisk passwords in Internet Explorer

  9. WirelessNetView - View the wireless sysnal around you

  10. SmartSniff - a network monitoring utility that allows you to capture TCP/IP packets that pass through your network adapter

  11. ServiWin - utility displays the list of installed drivers and services on your system.

  12. RunAsDate - a small utility that allows you to run a program in the date and time that you specify

  13. rdpv - remote desktop passview

  14. ProcessActivityView - is supposed to give you a summary of the files and folders being accessed by a specific process

  15. OpenedFilesView - View opened/locked files in your system

  16. Netpass - recovers all network passwords stored on your system for the current logged-on user

  17. MyLastSearch - utility scans the cache and history files of your Web browser, and locate all search queries that you made with the most popular search engines

  18. MyEventViewer – alternative utility for Windows logs

  19. MessenPass - Instant Messenger Password Recovery Tool

  20. MozillaHistoryView - View the list of visited web sites in Firefox

  21. MozillaCacheView - View the cache files of Firefox/Mozilla browsers

  22. IE PassView - Password Manager Program for Internet Explorer

  23. IE HistoryView: Freeware Internet Explorer History Viewer

  24. IECacheView - Internet Explorer Cache Viewer

  25. GACView - Alternative Global Assembly Cache (GAC) Viewer

  26. DriverView - Loaded Windows Drivers List

  27. Dialupassw2: Recover lost dialup/RAS/VPN password in Windows XP/Vista/9x

  28. cports: Monitoring TCP/IP network connections on Windows

  29. CleanAfterMe - Clean Registry entries and files in your system

  30. AsterWin IE - Reveal asterisk passwords in Internet Explorer

  31. NirCmd DLL is a sample dll that you can call in order to execute NirCmd Commands.

Tuesday, November 3, 2009

Build up a mail server/client for tesing purpose

Mail server - James


  1. Download James and extract to a local folder.

  2. Open Jame-x.y.z\apps\james\SAR-INF\config.xml to configure mail server as follow:


    • <servername>sonle.com</servername>. This can be not the same as your computer name. (My email has xxx@sonle.com format in this example)

    • <helloName autodetect="true">sonle.com</helloName>. There are more than one place for you to set this value.


  3. Start server: double click to run file james-x.y.z\bin\run.bat

  4. Add accounts


    • Open command line

    • issue command telnet [computername] 4555

    • When you are asked for userid and password, enter root for both username and password (which is the defalt value in config.xml file

    • adduser [username] [password]


    • Repeat the adduser to add as many users as you like. After finish, type quit to exit the telnet.


  5. Now, the server is ready. It's time to setup a client to test mail server by user the mail accounts you just created



Mail client: Thunderbird


  1. Download Thunderbird and install to your machine. I prefer this tool because it's lightweight, fast and free!

  2. Open Thunderbird. Since the first time, you will be asked for setting up email account. Just lick Ok to accept.

  3. Enter name and email address which is setup before.

  4. Enter your machine name where you setup James. If you not sure what to enter, go to commandline and type: ipconfig/all to get the name.
    Remember to uncheck the checkbox. It's clearer to setup each account on a separated folder.






  5. Click finish to complete setting up mail client.

    Repleat your steps until you have already add all your account to Thunderbird. Now try to send and email to see whether the mail server is working already.





* Notice: When you want to add an account to ThunderBird, open File --> New --> Account, and thing will be fine.
If you go to Tools --> Account Settings and click the button "Add Account..." Then, if you uncheck the check box "Use Global Inbox" --> There is an error when receive POP email.

How to recover email password


  1. Mail PassView - Recover passwords stored in Email clients (Outlook, Windows Live Mail, Thunderbird, and so on).

  2. Asterisk Logger - Recover passwords stored behind asterisk (**) characters.

Monday, November 2, 2009

Shortcut keys

Chrome


  1. Ctrl+U - View source

  2. Ctrl+Shift+V – Paste current content from the clipboard without formatting

  3. Ctrl+L or Alt+D - Highlight URL

  4. Ctrl+Backspace - Fast delete

  5. Shift & wheel - Scrolls horizontally on the page



Windows 7


  1. Win+Left: Move windows to half left of the screen

  2. Win+Right: Move windows to half right of the screen

  3. Win+Up: Maximize the windows

  4. Win+P: Projector mode



Eclipse


  1. Ctrl+Shift+P: Find matched braces

  2. Alt+Shift+P: Select the outer block

  3. Ctrl+Shift+R: Open resource

  4. Alt+Shift+W: Open file in Navigator/Project Explorer/...



Total Commander


  1. CTRL+P: Copy current path to cmd line

  2. Ctrl+Shift+Ins: Copy file path to clipboard