'7. Tips'에 해당되는 글 118건
- 2016.12.10 마우스 가운데 버튼 활용하기
- 2016.11.23 특정 포트(Port)를 사용중인 프로세스 확인하는 방법
- 2016.02.09 Advanced tips for Chrome Developer Tools
- 2015.02.03 Move window to the monitor
- 2015.02.03 Useful Shortcuts in Eclipse
- 2015.02.02 Prevent symptom that debugging does not reflect latest source code
- 2014.11.29 AsEclipse extension
- 2014.11.29 Shortcut to "Navigate to ..."
- 2014.10.03 URL Rewrite
- 2014.07.10 How to change chef-server's nginx configure
- 2014.07.10 sudo: cd: command not found
- 2014.06.17 WebScarab
- 2014.06.14 Check available HTTP methods
- 2014.06.14 CSRF - Cross Site Request Forgery
- 2014.06.10 Difference between bin and sbin
- 2014.06.10 Memory Structure
- 2014.06.08 Binary Portablity
- 2014.06.08 Dirty Read, Non-Repeatable Read and Phantom row
- 2014.06.06 Check where the data directory is on MySQL
- 2014.06.06 Use explain
요즘 Logitech M705 마우스를 사용하고 있는데, 평소 가운데 휠 버튼을 자주 사용하는데 이 마우스는 가운데 버튼을 누르면 잘 동작하지 않아서 너무 불편하다고 생각했다.
그래서 다른 마우스를 사려고 몇주동안 검색만 하다가 딱 맞는게 없어서 구입을 안하고 있었는데, M705 의 엄지 버튼을 가운데 휠로 사용하니 문제가 해결되었다.
로지텍의 초고속 휠은 스크롤은 편한데 내가 자주 사용하는 가운데 버튼이 잘 눌러지지 않아서 못쓰겠다고 생각했는데 그냥 엄지 쪽에 있는 버튼을 가운데 버튼으로 사용하니 문제가 해결되었다.
그래서 가운데 버튼을 대체하는 엄지 버튼을 막 테스트해보다가 새로운 걸 알았다.
1. 크롬이나 익스플로어의 탭에서 마우스 가운데 버튼을 누르면 창이 닫힌다. 와우!
2. 원래 알고 있는 기능인데 태스크바에서 실행 중인 앱 위에서 마우스 가운데 버튼을 누르면 하나 더 실행된다.
휴, 돈 굳었다. ㅋ
기존엔 netstat -ab 명령으로 확인했었는데, 이 명령은 확인하기가 좀 어렵다. 그래서 구글링 해보니 역시 좋은 방법이 있었네.
Resource Monitor 가 있었어. 그래도 이런건 리눅스 처럼 명령어로 간단하게 뽑아낼 수 있으면 좋겠구만.
Advanced tips for Chrome Developer Tools

Here are some advanced tips for chrome developer tools.
About Console
You can run javascript function by entering its name. If you set a breakpoint in it, it will work.
You can see the source code of any function and jump to the definition
: Type a function name without round brackets and hit the enter key then console will show its source
Then click the right mouse button on the function name as below, then select 'Show function definition'. it will jump to the definition except for native function,
You can use selectors which are the command line api within the console.
: https://developer.chrome.com/devtools/docs/commandline-api
Set or unset a breakpoint using debug and undebug function
: call the debug function passing the function name to debug as below. This is really helpful when you don't know where its source is so you cannot set the breakpoint there.
About source
If you want to search some text within the whole javascripts, use ctrl + shift + f short cut. This will show you the search window.
When you blackbox a JavaScript source file, you will not jump into that file when stepping through code you're debugging. You are able to debug just the code you are interested in.
Pause On Caught Exceptions
Pretty Print
: By clicking on the curly brace ("Pretty Print") icon in the bottom left corner, the JavaScript is transformed into a more human readable form.
The end.
If you have more than one monitor:
- Win + Shift + Left arrow : Move window to the monitor on the left
- Win + Shift + Right arrow : Move window to the monitor on the right
As you know, there are the useful shortcuts for manipulating the active window:
- Win + Left arrow : Snap to the left half of the screen
- Win + Right arrow : Snap to the right half of the screen
- Win + Up arrow: Maximize the window
- Win + Down arrow: Minimize/Restore if it's maximized
Here are the shortcuts that is used very often by me.
Ctrl + Shift + O |
imports all classes in a file automatically |
Ctrl + O |
show code outline / structure |
Atl + Shift + F | Correct indentation in a file |
Ctrl + I | Correct indentation in a selection |
Ctrl + D | delete a line |
Ctrl + 1 | Quick fix |
Ctrl + B | Build all. Change this short cut to "Build Project" to save your time. |
F11 | Debug |
Ctrl + F11 | Run |
F3 | Open declaration. Go to source. |
Alt + Left Arrow | Go to back |
Alt + Right Arrow | Go to forward |
Ctrl + Shift + R | Open resource like a file |
Ctrl + Shift + B | Toggle break point |
Alt + Shift + J | Add |
Alt + Shift + E | Show in navigator. Not default. Need to set this short cut by yourself |
Ctrl + K | Find next |
Ctrl + Shift + K | Find previous |
Ctrl + Shift + W | Close others. |
Ctrl + H | Show search dialog with various options |
Ctrl + / | Toggle line comment |
Ctrl + Shift + / | Add block comment |
Ctrl + Shift + \ | Remove block comment |
Alt + G | Open implementation |
Alt + Shift + G | Open super implementation |
Prevent symptom that debugging does not reflect latest source code

Some times eclipse did not seems to launch applications well in debugging.
You might experience like debugging did not reflect latest source code you just edited. Though you set the break point into the line you want, next step by pressing F6 for stepping over, break point hit the wrong line.
Mostly this is caused by not saving the source codes. By default, eclipse does not prompt before launching the application though it's not still saved.
To prevent this mistake, I recommend to set the following two option!
1. Save automatically before build
Window > Preferences > General > Workspace
Check 'Save automatically before build' like the following:
2. Save required dirty editors before launching : Prompt
Window > Preferences > Run/Debug > Launching
Set an option to 'Prompt' like the following for 'Save required dirty editors before launching' option.
This trivial two options will reduce your complaint against eclipse!
When using eclipse, ctrl + o is very usefull to move to the member within a file. AsEclipse supports this feature.
Here are the description for AsEclipse and link to it.
AsEclipse is an add-in for MS Visual Studio, which enables you to use some convenient Eclipse editing functions in MS Visual Studio with almost the same shortcut keys. No matter whether you are familiar with Eclipse, AsEclipse will be helpful in coding with VS.
https://visualstudiogallery.msdn.microsoft.com/99ede732-544c-4f3b-8e38-49e4b8395075/
To find something like class, function, or file in a solution, "Navigate to..." is very useful.
Ctrl + ,
lets you direct to that dialog.
HTTP Redirect VS URL Rewrite
1. HTTP Redirect
Redirecting sends a HTTP 301 or 302 to the client,
telling the client that it should try to access the page using another URL.
The client knows that there is another URL that should be used.
2. URL Rewrite
Rewriting happens on the server, and simply is a translation of one URL to another,
that is used by your web application.
The client does not know that internally there is another URL,
it just sees the one it sent to the server.
(http://forums.iis.net/t/1174487.aspx?How+does+URL+Rewrite+differ+from+HTTP+Redirect+)
Installing ARR manually without WebPI (Web Platform Installer)
1. Stop IIS
2. Download and install the Web Farm Framework module.
2.1 Web Platform Installer
2.2 WebDeploy 2.0
2.3 http://www.iis.net/downloads/microsoft/web-farm-framework
3. Download and install the External cache
4. Download and install the URL Rewrite
http://www.iis.net/downloads/microsoft/url-rewrite
5. Download and install the Application Request Routing
http://www.iis.net/downloads/microsoft/application-request-routing
6. Restart IIS
Example
Assume that we want to forward the url ending with "/test" like http://localhost/test to http://localhost:81/.
The following example shows how to do this.
{R:2} means that the rest of url excepting 'http://host/test' address. You can check this from the test pattern.
☞ Tip
To check what the problem is when setting the URL rewrite rule, access it in the server that owns the rule. Then, the browser will give you more information. In addition, use fiddler to check the whole access URL.
References
- http://www.iis.net/learn/extensions/url-rewrite-module/modifying-http-response-headers
How to change chef-server's nginx configure

There are two ways to achieve this.
First is to use nginx's config file directly. chef-server's nginx config file is located under
/var/opt/chef-server/nginx/etc/nginx.conf |
After changing some settings, restart chef-server as below:
sudo chef-server-ctl restart |
Second is to use chef-server.rb file instead of using nginx.conf file
This file is located under /etc/chef-server. If it doesn't exist, just create it. put some values you want in it as below:
nginx['ssl_port'] = 449 |
To see the more detailed information about this, visit the following link:
http://docs.opscode.com/config_rb_chef_server_optional_settings.html
After specifying some options, run the following commands to apply those.
sudo chef-server-ctl reconfigure sudo chef-server-ctl restart |
just type following command
sudo su
and use cd command.
https://www.owasp.org/index.php/Category:OWASP_WebScarab_Project
WebScarab is a framework for analysing applications that communicate using the HTTP and HTTPS protocols.
WebScarab operates as an intercepting proxy, allowing the operator to review and modify requests created by the browser before they are sent to the server, and to review and modify responses returned from the server before they are received by the browser.
It's very simple to check what kind of methods are available on target site using telnet.
This example assumes that you are using windows.
1. Run cmd.exe after typing Windows + R keys
2, Check if the telnet client is installed by typing 'telnet' as below.
If it's installed, following message will be shown
If not, install it first.
3. Enter following command:
telnet [server url or ip address] 80
4. Enter the following text after changing host info according to yours
OPTIONS / HTTP/1.1 Host: [server url or ip address] |
This example used the following text
OPTIONS / HTTP/1.1 Host: 192.168.0.6 |
After sending this text, the result will be shown as below:
For the HTTP 1.0, following text can be used as text
OPTIONS * HTTP/1.0 |
Note: Some famous sites such as naver and other portals was already prohibited to this kind of access.
But we can find out naver is using nginx as its HTTP server.
From Wikipedia
Cross-site request forgery, also known as a one-click attack or session riding and abbreviated as CSRF (sometimes pronounced sea-surf[1]) or XSRF, is a type of malicious exploit of a website whereby unauthorized commands are transmitted from a user that the website trusts.[2] Unlike cross-site scripting (XSS), which exploits the trust a user has for a particular site, CSRF exploits the trust that a site has in a user's browser. |
To understand difference between XSS and CSRF, read the highlighted sentences with color.
For more detail:
http://linuxtroubleshoot.blogspot.kr/2011/03/difference-between-bin-vs-sbin-vs.html?m=1
The following diagram shows three different memory categories that server allocates.
Server / Shared |
|
Storage Engine / Shared |
|
Connection / Session |
|
Now check each item in more detail.
Query Cache
The query cache stores results of SELECT queries so that if the identical query is received in future, the results can be quickly returned.
Queries are examined in a case-sensitive manner, so
SELECT * FROM t
is different to
select * from t
Comments are also considered and can make the queries differ, so
/* retry */ SELECT * FROM t
is different to
/* retry 2 */ SELECT * FROM t
Thread cache
By default, connection manager threads associate each client connection with a thread dedicated to it that handles authentication and request processing for that connection. Manager threads create a new thread when necessary but try to avoid doing so by consulting the thread cache first to see whether it contains a thread that can be used for the connection. When a connection ends, its thread is returned to the thread cache if the cache is not full.
The thread cache has a size determined by the thread_cache_size system variable. The default value is 0 (no caching), which causes a thread to be set up for each new connection and disposed of when the connection terminates.
(http://dev.mysql.com/doc/refman/5.5/en/connection-threads.html)
** I need to write more items that were not covered here **
Both MyISAM and InnoDB tablespaces are binary portable from one host to another if two conditions are met:
- Both machines must use two's-complement integer arithmetic
- Both machines must use IEEE floating-point format or else the tables must contain no floating-point columns (FLOAT or DOUBLE)
[mysqld]
lower_case_table_names=1
To sum up,
MyIsam
- Both machines must use two's-complement integer arithmetic
- Both machines must use IEEE floating-point format or else the tables must contain no floating-point columns (FLOAT or DOUBLE)
- Both machines must use two's-complement integer arithmetic
- Both machines must use IEEE floating-point format or else the tables must contain no floating-point columns (FLOAT or DOUBLE)
- Database and table names must use lowercase format
Dirty Read, Non-Repeatable Read and Phantom row

A dirty read occurs when a transaction is allowed to read data from a row that has been modified by another running transaction and not yet committed.
A non-repeatable read occurs, when during the course of a transaction, a row is retrieved twice and the values within the row differ between reads.
A phantom read occurs when, in the course of a transaction, two identical queries are executed, and the collection of rows returned by the second query is different from the first. The phantom reads anomaly is a special case of Non-repeatable reads.
The following command will show:
mysql> show variables like 'datadir'; |
To get query execution plan, explain is used. but not just for this, explain is more useful to get the table information such as column list and its detail.
mysql> explain [schema_name].[table_name]
or
mysql > explain table_name
mysql> explain world.city; +-------------+----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+----------+------+-----+---------+----------------+ | ID | int(11) | NO | PRI | NULL | auto_increment | | Name | char(35) | NO | | | | | CountryCode | char(3) | NO | | | | | District | char(20) | NO | | | | | Population | int(11) | NO | | 0 | | +-------------+----------+------+-----+---------+----------------+ 5 rows in set (0.01 sec) |
describe is same with this.
mysql> describe information_schema.tables; +-----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+---------------------+------+-----+---------+-------+ | TABLE_CATALOG | varchar(512) | NO | | | | | TABLE_SCHEMA | varchar(64) | NO | | | | | TABLE_NAME | varchar(64) | NO | | | | | TABLE_TYPE | varchar(64) | NO | | | | | ENGINE | varchar(64) | YES | | NULL | | | VERSION | bigint(21) unsigned | YES | | NULL | | | ROW_FORMAT | varchar(10) | YES | | NULL | | | TABLE_ROWS | bigint(21) unsigned | YES | | NULL | | | AVG_ROW_LENGTH | bigint(21) unsigned | YES | | NULL | | | DATA_LENGTH | bigint(21) unsigned | YES | | NULL | | | MAX_DATA_LENGTH | bigint(21) unsigned | YES | | NULL | | | INDEX_LENGTH | bigint(21) unsigned | YES | | NULL | | | DATA_FREE | bigint(21) unsigned | YES | | NULL | | | AUTO_INCREMENT | bigint(21) unsigned | YES | | NULL | | | CREATE_TIME | datetime | YES | | NULL | | | UPDATE_TIME | datetime | YES | | NULL | | | CHECK_TIME | datetime | YES | | NULL | | | TABLE_COLLATION | varchar(32) | YES | | NULL | | | CHECKSUM | bigint(21) unsigned | YES | | NULL | | | CREATE_OPTIONS | varchar(255) | YES | | NULL | | | TABLE_COMMENT | varchar(2048) | NO | | | | +-----------------+---------------------+------+-----+---------+-------+ 21 rows in set (0.01 sec) |