Posts

Showing posts from July, 2014

I Just wanted get the Redis Manage Tools on windows like sqldeveloper

Image
I found good manage tool for redis on windows 
this show us datas and be able to use console like redis-cli
anyway 
I think I just prepare to enjoy redis

http://redisdesktop.com/




Redis java client Jedis

It is very easy to use

I just follow sample code

and output is excellent ~!!
Jedis jedis = new Jedis("localhost"); jedis.set("foo", "bar"); String value = jedis.get("foo");
System.out.println(value);

and if you access to multithread enviroment follow this article

Basic usage exampleusing Jedis in a multithreaded environment You shouldn't use the same instance from different threads because you'll have strange errors. And sometimes creating lots of Jedis instances is not good enough because it means lots of sockets and connections, which leads to strange errors as well. A single Jedis instance is not threadsafe! To avoid these problems, you should use JedisPool, which is a threadsafe pool of network connections. You can use the pool to reliably create several Jedis instances, given you return the Jedis instance to the pool when done. This way you can overcome those strange errors and achieve great performance. To use it, init a pool: JedisPool…

Redis installation

1. download redis latest file from http://www.redis.io/download

make make install
redis-server                 _._                                                              _.-``__ ''-._                                                    _.-``    `.  `_.  ''-._           Redis 2.8.13 (00000000/0) 64 bit   .-`` .-```.  ```\/    _.,_ ''-._                                     (    '      ,       .-`  | `,    )     Running in stand alone mode  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379  |    `-._   `._    /     _.-'    |     PID: 26766   `-._    `-._  `-./  _.-'    _.-'                                     |`-._`-._    `-.__.-'    _.-'_.-'|                                    |    `-._`-._        _.-'_.-'    |           http://redis.io           `-._    `-._`-.__.-'_.-'    _.-'                                     |`-._`-._    `-.__.-'    _.-'_.-'|                                    |    `-.…

redis simple command

############## Expire ###########
-- 입력 --  set resource:lock "redis demo"    
-- 시간 타임 -- expire resource:lock 120  - return 1 정상적으로 적용
-- 얼마나 남았는지 확인 -- ttl resource:lock 113 
113 second left
############ List ##############
command : rpush, lpush, llen, lrange, lpop, rpop
rpush  puts the new value at the end of the list  -> rpush friends "alice" 
plush puts the new value at the start of the list -> plush friends "sam"
large gives a subset of the list it takes the index of the first element you what to retrieve as its first parameter and the index of the last element you what to retrieve as tis second parameter. A value of -1 for the second parameter means to retrieve elements until the end of the list. -> lrange friends 0 -1  (All) -> lrange friends 0 1 -> lrange friends 1 2  
llen returns the current length of the list. -> llen friends 
lpop removes the first element from the list and return it -> lpop friends 
rpop removes the l…

Redis start

I don't exactly know why I want to know Redis

the point of redis is memory cache and key-value store

i will deeply study of it and will use for better computer program

make service what is not stopping

I recommend this post is really good to restart service after stopping.

and there are two ways~! read it

http://ccdev.tistory.com/22

javascript get parameters function

usually we want to parse data from url
this is good function ~
I'm not sure because I didn't test in all cases
so that use it before fully test

function  getQueryParams (url) { var params = {}; var parameters = (url.slice(url.indexOf('?') + 1, url.length)) .split('&'); for (var i = 0; i < parameters.length; i++) { var param = parameters[i].split('='); params[param[0]] = param[1]; } return params; }

Share site for checking function to use or not

Today I introduce


http://caniuse.com/queryselector

This is what I parsing in html tags

today I had to parse html tag and replace ~!


document.querySelector('.mailInfo'): query if document has the tag defined mailInfo in class

table. querySelectorAll('tr') : this will return array of tr object elements


table.getAttribute('summary') :  this will return value if summary attribute exist





This is Example

function bigMailInit(){ // 메일 인포를 찾음... var mailInfo = document.querySelector('.mailInfo'); var li = mailInfo.querySelectorAll('table'); // 널 체크, just in case if(li == null || li.length ==0){ return; } var i=0; var table; // 메일 인포안에 여러개의 테이블이 있지만 대용량 테이블이 아닐수도 있어서 Summary attribute에서 체크 해야함 for(i=0; i<li.length; i++){ table = li[i]; var summary = table.getAttribute('summary'); if(summary != null){ if(summary.indexOf('대용량') >= 0 && summary.indexOf('Mass') >= 0 ){ var tbody= table.querySelectorAll('tbody'); if(tbody[0].children.length <3){ break; } var start =3; // tr의 3번째부터 첨부파일들이 나열 for(start; start<tbody[0]…