반응형

 

html 특수 코드표...

 jsp 에서 '(' 치환하려는데.. 요놈이 치환이 안되서 깽판좀 쳤다..ㅠㅠ

반응형
반응형

후우... params 로 값 넘겨서 작업 페이지에서 받은뒤에 처리함.. 그리고 화면에 뿌린 데이터를 가져와서 그걸로 처리...

ps. 일하면서.. 만들었다... 슬프다..ㅠㅠ

반응형
반응형
ArrayList와 HashMap을 한번에(합쳐서?) 사용하기.

ArrayList<HashMap<String, String>>

형태로 ArrayList를 만들어서 사용하면 된다.


사용 예제>
DB에 저장된 두개의 컬럼을 각각 다른 키값을 갖는 HashMap을 만들어 사용하고 싶다.
사용시 두 해시맵을 동시에 불러오고 싶다(?)

DB에서 값 가져오기.

<시작>
 
public ArrayList<HashMap<String, String>> getlist(){
ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
//하나로 만들 arraylist 선언
try{
conn = getConnection();//커넥션을 불러오는 사용자 함수.
Statement stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT CODE, NAME FROM TEST ORDER BY CODE");
//data를 가져와서.
while(rs.next()){
HashMap<String,String> sidmap = new HashMap<String,String>();
//그때그때 해시맵을 선언해 주어야 함.(키 값이 계속 동일 함으로)
sidmap.put("code", rs.getString("CODE"));
sidmap.put("name", rs.getString("NAME"));
//두개의 키 두개의 값
list.add(sidmap);//리스트에 추가.
}
return list;
}
catch(Exception e){
e.printStackTrace();
}
finally{
disConnection();//커넥션 종료하는 사용자 함수.
}
return null;
}
<끝>


DB에서 가져온 리스트를 사용 할때.

<시작>
 
 
 
 
 
 
 
 
 
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page language="java" import="java.util.*" %><!-- Arraylist와 hashmap을 쓰기위해 -->
<jsp:useBean id="getlist" class="test.list" scope="page" /><!-- 디비에서 값 가져오는 클래스 -->
<%
ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
list = getlist.getlist();
%>
<body>
<table>
<tr>
<td class="mx_td">
<select name="s_id"> <%
for(int i=0; i<list.size(); i++) {%>
<option value="<%=list.get(i).get("code")%>"><%=list.get(i).get("name")%></option>
<%} %>
</select>
</td>
</tr>
</table>
</body>
<끝>


결과



 

반응형

'공부거리 > JSP' 카테고리의 다른 글

배열 리스트 사용법..?  (0) 2012.10.31
달력 만들기  (0) 2012.09.27
text 파일 작성하기  (0) 2012.09.10
JAVA 코드 분석 툴(잠재적 위험도 등)  (0) 2012.08.25
java 형변환 모음  (0) 2012.01.10
반응형

 

 

일정 시간마다 동일한 함수를 실행하는 함수.

그리고 그 함수를 멈추는 함수.

자동실행 되게 셋팅하고

마우스 포커스 온 되면 멈추고 포커스 아웃되면 재실행 시키는 방식으로 활용

반응형
반응형

 

파일 쓰기..

 

ps. 읽기도 완벽히 익혀야돼..ㅠㅠ

반응형

'공부거리 > JSP' 카테고리의 다른 글

달력 만들기  (0) 2012.09.27
ArrayList 안에 HashMap 넣어쓰기(HashMapList??)  (0) 2012.09.11
JAVA 코드 분석 툴(잠재적 위험도 등)  (0) 2012.08.25
java 형변환 모음  (0) 2012.01.10
DATE 현재시간 및 하루전 시간  (0) 2011.12.21
반응형
klocwork

CheckStyle
- a development tool to help programmers write Java code that adheres to a coding standard

FindBugs™
- Find Bugs in Java Programs

PMD
- PMD scans Java source code and looks for potential problems like:
1) Possible bugs - empty try/catch/finally/switch statements
2) Dead code - unused local variables, parameters and private methods
3) Suboptimal code - wasteful String/StringBuffer usage
4) Overcomplicated expressions - unnecessary if statements, for loops that could be while loops
5) Duplicate code - copied/pasted code means copied/pasted bugs

출처 - http://302.pe.kr/295

반응형

'공부거리 > JSP' 카테고리의 다른 글

ArrayList 안에 HashMap 넣어쓰기(HashMapList??)  (0) 2012.09.11
text 파일 작성하기  (0) 2012.09.10
java 형변환 모음  (0) 2012.01.10
DATE 현재시간 및 하루전 시간  (0) 2011.12.21
간단 게시판 리스트 출력 소스  (0) 2011.12.19
반응형

2012년 7월 8일 오후...

길냥이가 집 옆의 물길에 있길래.. 가서 열심히 찍었습니다...

 

반응형
반응형

 

아이디 값별로 온클릭 효과를 주는것이 아닌

온클릭 리스너가 작동할때 버튼의 아이디 값을 체크해서

아이디 값별로 구분 해서 실행 가능한 소스 부분..

이런거도 되네..ㅋ

private OnClickListener click = new OnClickListener() {
  public void onClick(View v) {
   switch(v.getId()) {
    case R.id.btn_site:
     AlertDialog.Builder builder = new AlertDialog.Builder(XMLParsingActivity.this);
     builder.setTitle("지역선택");
     builder.setSingleChoiceItems(site, checkedItem, new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {
       checkedItem = which;
      }
     });
     builder.setNegativeButton("취 소", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {
      }
     });
     builder.setPositiveButton("선 택", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {
       select_site = site[checkedItem];
      }
     });
     builder.show();
     break;
    case R.id.btn_parsing:
      Parsing(select_site);
     break;
   }
  }
    };

 

 

출처 - http://kshzzang2012.tistory.com/14

반응형
반응형

//get방식
/*
HttpClient client = new DefaultHttpClient();
String url = "http://localhost:8080";
HttpGet get = new HttpGet(url);
HttpResponse response = client.execute(get);
HttpEntity resEntity = response.getEntity();
if(resEntity != null){
Log.w("reponse", EntityUtils.toString(resEntity));
}
*/



//post방식
/*
HttpClient client = new DefaultHttpClient();
String postUrl = "http://222.jsp";
HttpPost post = new HttpPost(postUrl);
List params = new ArrayList();
params.add(new BasicNameValuePair("deliveryDate", "1111111111"));

UrlEncodedFormEntity ent = new UrlEncodedFormEntity(params, HTTP.UTF_8);
post.setEntity(ent);
HttpResponse responsePost = client.execute(post);
HttpEntity resEntity = responsePost.getEntity();
if(resEntity != null){
Log.w("Response", EntityUtils.toString(resEntity));
}
*/

반응형
반응형

HTTP 환경변수의 HTTP_REFERER를 이용해봅시다'ㅂ'

(import javax.servlet.http.HttpServletRequest;)

각 언어별로 HTTP_REFERER를 확인하는 방법은 아래와 같습니다. 리턴값은 스트링이구요.

ASP => Request.ServerVariables("HTTP_REFERER")
PHP => $_SERVER['HTTP_REFERER']
JSP => request.getHeader("REFERER")

HTTP_REFERER의 값의 유무와 각 웹서버의 로그파일을 이용해서
어떻게 방문했는지를 추출할 수 있습니다.

1. 주소창에 주소를 입력해서 들어오는 경우
- HTTP_REFERER의 값이 없음

ex)strReferPath = Trim(Request.Servervariables("HTTP_REFERER"))

strReferPath == null ? 1 : 0 -> 1이 반환 되겠져

2. '즐겨찾기'를 이용해서 들어오는 경우(IE의 경우)
- HTTP_REFERER의 값이 없음
- 로그파일에 ..../favicon.ico로그가 먼저 남는다.
- 이는 IE가 즐겨찾기를 눌러서 사이트를 방문할 경우 favicon.ico 요청을 하고, 해당 URL의 요청을 하기때문입니다.

3. 링크를 통해서 들어오는 경우.(쉽게 말해서 <a>태그를 통해)
- HTTP_REFERER에 이전 URL정보가 들어있음.

이렇게 3가지 패턴으로 어느정도 확인을 할 수가 있습니다만-!

자바스크립트로 location.href를 통해 설정된 주소로 들어왔을경우

이전의 주소를 알아 낼 수 없다는 거겠죠; 그 밖에도 여러가지가 있겠지만...

 

출처 - http://blog.naver.com/wimeprana/110019137746

반응형

'공부거리 > PHP' 카테고리의 다른 글

PHP 문자열 함수  (0) 2013.05.29
[PHP] $_SERVER[] 값  (0) 2013.04.04
이클립스+php셋팅  (0) 2012.05.11
PHP 게시판 리스트 샘플 소스  (0) 2011.12.19
PHP3 문법 기초  (0) 2011.10.12
반응형

아우... 찍었는데 대각선에서 찍었더니 수평이 안맞아..ㅠㅠ...수평계는 맞춰놓고 찍었지만..

 

반응형
반응형

우우... 열심히ㅣ 찍었쥐만.. 나온건 그닥이네요... 뭐 초짜의 슬픔인가..

고양이는 풀 오토로 찍었고

야경은 iso 100 , f5.6 , 6~10초 대로 찍어서 나온것들중

흔들리지 않게 나온것만 뽑앗씁눼닥..ㅎㅎ

반응형

'Human Life > 사진 촬영' 카테고리의 다른 글

우리집 어린 길냥이...  (0) 2012.07.09
이순신대교 주간 야간?  (0) 2012.06.03
반응형

<script type="text/javascript">
function resizeHeight(id)
{
    var the_height = document.getElementById(id).contentWindow.document.body.scrollHeight;
    document.getElementById(id).height = the_height + 30;
}
</script>
<iframe src="#" id="commentFrame"frameborder="0" onLoad="resizeHeight('commentFrame');"></iframe>


출처 - http://eyecandyzero.tistory.com/173

반응형
반응형


Step 1: Download and Install Eclipse

Go to http://www.eclipse.org/download and download 'Eclipse Classic' (Don't download Eclipse PHP package), at the time of writing this Indigo (3.7) was the most current release.

Once downloaded, un tar ball/unzip and install Eclipse.

Next start up eclipse and choose your workspace folder.

Step 2: Settings up PHP PDT Plugin

Alright once you have Eclipse up and running, your going to want to navigate to 'Help > Install New Software'.

This will bring you to a screen like so

If you look twords the top of that window you will see a drop down that says 'Wok With', click that and select '--All Available Sites--'.

Next you are going to want to search for 'PHP', this will list the same plugin in three different categories. Just select the first one that says 'PHP Development Tools (PDT)...' and then click 'Next' and run though the install process. Its is pretty straight forward. It will ask you to restart Eclipse click 'Restart Now'. Thats it you now have the PHP PDT plugin installed. This plugin by its self is not super useful because of the way the it is encased in Exlipses 'project' mentality.

From here on out when ever I say go and install new software, you should follow these steps.

Step 3: Install Remote System

You are going to follow the same instruction as above, but you are going to search for 'Remote System', remeber to select '--All Available Sites--' in the 'work with' drop down. Click 'Remote System Explorer End-User Runtime' and 'Remote System Explorer User Actions' and run through the install process like before.

Step 4: Install Theme Switcher (Optional)

The setup for the theme switch is same as the above EXCEPT next to the 'work with' drop down you will see a 'add' button, click that. Fill out the form and enter this as the 'Location':

http://eclipse-color-theme.github.com/update

click ok, and in the list of available plugins to install you should only see one choice 'Eclipse Color Theme'. Check the box and run through the install process, it may give you a warning about installing software from outside sources, just click ok and continue.

Once Eclipse Theme is install you can navigate to Ecplise Preference, on mac they are in 'Eclipse > Preferences', on windows I think they are in 'File > Preferences'.

This will open a window with tons of options. All I want you to be aware of at this point is under 'General > Appearance > Color Theme'. This was added by the theme plugin. Here you can change your theme to what ever you prefer.

Step 5: Install Drupal plugin (Optional)

I work a lot with the content management system Drupal and thought it would be nice to note that there is an Drupal Eclipse Plugin.

To install the plugin it is going to be similar to the theme plugin above. Navigate to 'Help > Install New Software' and add a new site like above and enter the location as:

http://xtnd.us/downloads/eclipse

Again after adding this new location you will be prompted with only once choice. Just select 'Drupal for Eclipse' and run though the setup.

Step 6: Configuring PHP

By defualt in Eclipse 3.7 and greater php file will not automatically open in Eclipse.

Go to 'Eclipse >Preferences' (Mac) or 'File > Preferences'(Windows) and then go to 'general > editors > file associations'.

click the add button on the left and enter '*.php' with out the quotes.

After you hit ok you will see a list of editors below. Click on 'PHP Editor' and then click the default button on the right. And then click ok.

Step 7: Configuring Remote System Explorer

First thing you need to do is add the Remote System Explorer perspective to your eclipse workspace.

Go to 'Window > Open Perspective > Other'. now look for Remote System Explorer and add that.

Now you will have a new tab in your Eclipse workspace. By defualt you can browse and edit local files on your hard drive with RSE.

Now the fun part setting up a new conennection.Clcik the little down arrow in the 'Remote System' tab and select 'New Connection'

The next screen shows you all diffecent types of connection. I am going to walk through setting up a ssh connection. So on the next screen select 'SSh Only' and select Next.

the next screen you will need to enter in your host. I am not going to show a picture of this step.

Now you have a new connection in your 'Remote System' tab if you unfold it you will see 'My home' and 'Root'. By default RSE gives you these two file filters to choose from.

If you want to add another filter you want to right click on 'Sftp Files' and go to 'New > Filter'.

Next you will enter in the file location you would like to start from, like /home/test. Select next, give the filter and name and click ok.

Step 8: Fixing PHP autocomplete with Remote System Explorer

The last step is fixing the php autocomplete feature. To do this you are going to have edit a hidden file in your workspace folder. But first we are going to enable hidden files on RSE. Go to 'Eclipse > Preferences' (Mac) or 'File > Preferences' (Windows) and then unfold 'Remote Systems > Files'.

Check 'Show Hidden Files' and click ok.

Now we are going to use RSE to edit an eclipse RSE .project file. So in your 'Remote System' tab open up your local files and navigate to you workspace folder. Look for a folder called 'RemoteSystemsTempFiles' and open that. Now you are going to edit the '.project' file. Open up that file.

You are going to add two line in between the <natures> tag, those lines are

1
2
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.php.core.PHPNature</nature>
Save that file and restart eclipse. If you did everything correctly you should now have auto complete that will look like so
Well thats it, you should now have a fully fuction Eclipse web developing enviornment. Hope you enjoyed it, let me know if you find any errors in my work.




출처 - http://onlybible.tistory.com/7514

반응형

'공부거리 > PHP' 카테고리의 다른 글

PHP 문자열 함수  (0) 2013.05.29
[PHP] $_SERVER[] 값  (0) 2013.04.04
php,jsp,asp 이전 페이지 URL 얻어오기  (0) 2012.06.14
PHP 게시판 리스트 샘플 소스  (0) 2011.12.19
PHP3 문법 기초  (0) 2011.10.12
반응형

<script type="text/javascript">


var uAgent = navigator.userAgent.toLowerCase();

 

 //모바일 기기 추가시 등록

 var mobilePhones = new Array('iphone','ipod','ipad','android','blackberry','windows ce',

 'nokia','webos','opera mini','sonyericsson','opera mobi','iemobile', 'windows phone');

 var isMobile = false;

 

 for(var i=0;i < mobilePhones.length ; i++){

  if(uAgent.indexOf(mobilePhones[i]) > -1){

   isMobile = true;

   break;

  }

 }

 //모바일 기기가 아닌경우 특정 페이지로 GOGO

 if(!isMobile || document.referrer.substr(0,19) == "http://m.ystour.kr/"){

  window.location.href = "여기에 pc용 페이지";

 }else{

window.location.href = "여기에 모바일 페이지";

 }

</script>


출처 - http://blog.naver.com/soccerma?Redirect=Log&logNo=140119375246

ps. 모바일 기기에서 pc버전 버튼 눌렀을 경우 예외처리 추가

ps2. for문 소스 소실 부분 추가

반응형

'공부거리 > JAVASCRIPT' 카테고리의 다른 글

일정 시간마다 스크립트 실행 하는 함수  (0) 2012.09.11
iframe Height 자동 리사이징  (0) 2012.05.24
숫자 체크  (0) 2012.04.09
날짜 유효성 검사  (0) 2012.03.07
스크립트 정규식 소스 조금  (0) 2012.01.10
반응형



@Override

    public boolean onKeyDown(int keyCode, KeyEvent event){

    if(keyCode==KeyEvent.KEYCODE_BACK){

    뒤로가기키 눌렀을때 작동할것을 적는것..ㅋ

    return true;

    }

    return super.onKeyDown(keyCode, event);

    }

반응형
반응형

안드로이드 어플 상단바 없애기 or 전체 화면 모드

android:theme="@android:style/Theme.NoTitleBar"

android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 

<activity

            android:name=".WebViewActivity"

            android:label="@string/app_name"

            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

             >

       <!--  android:theme="@android:style/Theme.NoTitleBar" -->

       <!-- 타이틀바만 없애는것과 둘다 없애는것. -->

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />


                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>

        </activity>

 

 

ps. 저만 보려고 스크랩을 하던거라 위치를 안적어놨네요

위 옵션 추가하는 파일은 AndroidManifest.xml 파일에서 추가하시면 됩니다.

반응형
반응형

function checknum(chk_no){

var pattern = /^[0-9]+$/; //숫자패턴을 정해줌
var chk = document.frm.No1.value;

if(!pattern.test(chk)) //만약 값이 숫자가 아니면~
{
alert(!"숫자만 입력할 수 있습니다!");
document.frm.No1.value = "";
document.frm.No1.focus();
return;
}

if(pattern.test(chk) && document.frm.Coupon_No.value.length==7) //숫자이면서 자릿수가 7자리면
{
document.frm.No2.focus(); 다음 입력칸으로 포커스이동!
}

}

 

 

출처  - http://blog.daum.net/lexerj/18126200

반응형
반응형

function date_chk(year, month, day){
 date1 = new Date(year, month-1, day);
    year_chk = date1.getYear();
    month_chk = date1.getMonth();
    day_chk = date1.getDate();
 if( year == year_chk && month-1 == month_chk && day == day_chk ){
  alert("날짜 정상");
 }else{
  alert("날짜가 비정상");
 }
}

자바 스크립트에서 받아오는 날짜는 월이 0~11 로 계산됩니다.
그리고 자동으로 가감을 하여 날짜를 받아오기때문에 정상적인 날자를 받아오게 되고
이 받아온 날짜를 입력한 날짜와 대조하여 날짜가 서로 동일하면 유효한 날짜인거고
동일 하지 않으면 유효하지 않은 날짜인것입니다.
반응형
반응형
-asp
  
  Len  :  길이반환       > len(str)
  LenB:  바이트 수 반환>Len(str)
  Left  :  왼쪽부터 지정위치까지 반환   > left(str,5)
  Right  :  오른쪽부터 지정위치까지 반환  > right(str,3)
  Mid  : 지정위치부터 지정위치까지 반환  > mid(str,4,5)
  instr  :  문자검색 시작위치 반환    > instr(str,"bob")
  Ltrim  :  왼쪽공백 제거      > ltrim(str)
  Rtrim  :  왼쪽공백 제거      > rtrim(str)
  Trim  : 양끝공백 제거     > trim(str)
  Split  : 지정문자 기준으로 배열에 넣기 > i=split(str,"/")  response.write i(0),i(1)
  Join  : 배열값들을 구분자와 함께 합침 > i=join(i,",") i(0),i(1)
  Replace : 문자열 변경      > replace(str,"in","out")
  Ucase  : 대문자로 변경     > ucase(str)
  Lcase  : 대문자로 변경     > lcase(str)
  FormatCurrency:통화값으로 반환    > FormatCurrency("100000")
  FormatNumber: 숫자로 서식화된 식 반환   > formatnumber("200000")
  FormatPercent:백분율값으로 반환    > FormatPercent(0.83838)
  string : 지정한수만큼 지정한 문자열 반환 > string(5,*)   *****
  StrReverse: 지정한문자 거꾸로 반환   > StrReverse(str)
  space  : 공백 출력      > space(10)
 
  FormatDateTime:날짜와 시간으로 서식화된 식 반환>formatdatetime(now,1) {0~4}
  Cdate  : date 형식으로 변경    > cdate("2010년 10월 08일")
  Date  : 현시스템 날짜 반환    > response.write date
  Dateadd : 지정한날짜에 계산 +,-   > dateadd("m",3,day) {yyyy,q,m,y,d,w,ww,h,n,s}
  Datediff : 두 날짜 간격     > datediff("h",firstTime,now) {yyyy,q,m,y,d,w,ww,h,n,s}
  Datepart : 날짜 지정 부분 반환    > datepart("y",date)
  DateSerial: 수식값들을 날짜로 반환   > dateserial(2000+10,12+5,4+12)
  DateValue : 시간정보를 제외한 날짜 변환반환 > datevalue(date)
  Month  : 지정 날짜에서 월 반환   > month(now)
  Day  : 지정 날짜에서 일 반환   > day(now)
  Hour  : 지정 날짜에서 시 반환   > Hour(now)
  Minute : 지정 날짜에서 분 반환   > Minute(now)
  Sencond : 지정 날짜에서 초 반환   > Sencond(now)
  IsDate : 날짜 형식인지 부울값 반환  > isdate(date)
  MonthName : 월이름을 약어또는 완전어로 반환 > monthname(month,true)
  Now  : 시스템의 날짜 시간 반환   
  Time  : 시간반환
  Timer  : 자정 이후 경과한 초 반환  
  TimeSerial: 수식값들을 시간으로 반환  > timeserial(5+3,10+3,3)
  Timevalue : 시간형으로 반환     > timevalue("오후 3:10:50")
  WeekDay : 요일을 나타내는 정수로 반환  > weekday(date,[firstdayofweek])
 일요일부터 토요일순 1~7 {yyyy,q,m,y,d,w,ww,h,n,s}
  WeekDayName: 요일명을 반환     > weekdayname(date,[firstdayofweek]) {yyyy,q,m,y,d,w,ww,h,n,s}
  Year  : 년도를 반환      > year(now)
  
  
 -mssql
 ascii('abcd')    :  아스키코드 반환 97
 char(97)      :  아스키코드를 문자열로 반환 'a'
 charindex('c','abcde',2) : 지정한 문자를 지정한 문자열에서 지정한 범위에서 검색하여 위치를 반환 3
 left('mssql',3)    : 왼쪽부터 3위치까지
 right('mssql',3)   :  오른쪽부터 3위치까지
 lower()      : 소문자로 변환
 upper()      : 대문자로 변환
 ltrim()      : 왼쪽공백 제거
 rtrim()      : 오른쪽쪽공백 제거
 nchar()      : 유니코드로 변환
 replace('mssql','ms','my') : 문자열 변환 
 replicate('sql',3)   : 중복출력 sqlsqlsql
 reverse('mssql')   : 역순반환 lqssm
 space(10)     : 공백(10개) 출력
 substring('mssql',2,5)  : 2위치에서 5위치까지 출력
 unicode('a')    : 유니코드값 출력
 isnumeric('30')    : 숫자 판별 참1, 거짓0
 isdate('20100910')   : 날짜 판별 참1, 거짓0
 len('감사')     : 문자열수 반환 2
 datalength('감사')   : 바이트수 반환 4
 
 DATEADD (Part,n,date)/Part부분에 n만큼 더한 date {yy,qq,mm,dy,dd,wk,hh,mi,ss,ms}
 YEAR,MONTH,DAY    :  해당파트 반환 {yy,qq,mm,dy,dd,wk,hh,mi,ss,ms}
 Datediff(dd,'1999/02/15','2000/02/15') : 차이반환 {yy,qq,mm,dy,dd,wk,hh,mi,ss,ms}
 datepart(part,date)   : 해당판트 반환 {yy,qq,mm,dy,dd,wk,hh,mi,ss,ms}
 cast(30e392 as char)  : 문자열로 치환
 convert(varchar, getdate(), 120): 문자열 서식 변환
 convert(datetime,'20101025',112): 날짜열 서식으로 변환
 
 is null   / is not null : .. where name is null
 nullif(123,'123a4')   : 두 문자를 비교하여 같으면 null 틀리면 첫 문자열을 반환 123
 
 GROUP FUCTION
 avg('컬럼1','컬럼2')  : 컬럼별 평균값 구하기,
  집게 함수를 사용하지 않는 컬럼이 함께 열람될 경우 group by 컬럼3 해준다.
 count(*)     : count(disinct column), count(all column), count(column), count(*)
  집게 함수를 사용하지 않는 컬럼이 함께 열람될 경우 group by 컬럼3 해준다.
 MAX / MIN      : 최고, 최소값
  집게 함수를 사용하지 않는 컬럼이 함께 열람될 경우 group by 컬럼3 해준다.
 SUM       : 함계
  집게 함수를 사용하지 않는 컬럼이 함께 열람될 경우 group by 컬럼3 해준다.
 
 CASE WHEN 'MSSQL'='MSSQL THEN 'Y' ELSE 'N'END

출처 - http://zietz.tistory.com/56
반응형

'공부거리 > ASP' 카테고리의 다른 글

ASP 엑셀 다운로드  (0) 2012.02.29
반응형

list.asp

<!--엑셀파일다운로드-->
 <form name="excel_form" action="excel.asp" method="post">
 <INPUT TYPE="hidden" name="sql" value="<%=sql%>">
  <%
  ' Writes a link to the newly created excel in the browser
  response.write "<a href='#' onclick='javascript:document.excel_form.submit();'><font color=red>특정 이력 사항</font></a> 엑셀 리스트 | 작성된 시간:  " & now() & "<br>"
  %>
 </form>
 </tr>
 <!--//엑셀파일다운로드-->

 


excel.asp

<!--#Include virtual=/include/DBconn.asp-->
<%
 Response.Buffer = TRUE
 Response.ContentType = "application/vnd.ms-excel"
 Response.CacheControl="public"
 Response.AddHeader "Content-Disposition", "attachment;filename=특정이력사항.xls"

 ''''''''''''''''''''' 리스트 가져오기''''''''''''''''''''''''''''''''''''''''''

sql=request("sql")
'response.write sql
'response.end
 'set result = dbConn.execute(sql)
 set Result = server.createobject("adodb.recordset")
 Result.open sql, DB, 1
 no=Result.RecordCount
 
 response.write "<font size=10>"& Result("buse_name") &"-"& Result("jiwon_type") &"</font>"

 if not result.eof then
  response.write "<table border=0 cellspacing=1 cellpadding=15 width=98% height=55 bgcolor='#454545'>" 
  response.write "<tr>"
  response.write "<td bgcolor='F3F3F3'>No.</td>"
  response.write "<td bgcolor='F3F3F3'>이름</td>"
  response.write "<td bgcolor='F3F3F3'>생년월일</td>"
  response.write "<td bgcolor='F3F3F3'>최종졸업학교</td>"
  response.write "<td bgcolor='F3F3F3'>전공</td>"
  response.write "<td bgcolor='F3F3F3'>졸업년도</td>"
  response.write "<td bgcolor='F3F3F3'>서류전형</td>"
  response.write "<td bgcolor='F3F3F3'>인적성검사</td>"
  response.write "<td bgcolor='F3F3F3'>1차면접</td>"
  response.write "<td bgcolor='F3F3F3'>2차면접</td>"
  response.write "<td bgcolor='F3F3F3'>3차면접</td>"
  response.write "<td bgcolor='F3F3F3'>경력</td>"
  response.write "</tr>"
  for i=1 to result.recordcount
   
   '서류 합격 여부
   If result("pass")<>"" Then
    pass=result("pass")
    If pass="ok" Then
    pass_result="합격"
    ElseIf pass="no" Then
    pass_result="불합격"
    End If
   End If
   
   '최종학교명
   If result("s_name1") <>"" Then
    school_name= result("s_name1")
    school_major=result("s_major1")
    gra_year=Left(result("s_year_E1") ,4)
   ElseIf result("s_name2") <>"" Then 
    school_name= result("s_name2")
    school_major=result("s_major2")
    gra_year=Left(result("s_year_E2") ,4)
   ElseIf result("s_name3") <>"" Then 
    school_name= result("s_name3")
    school_major=result("s_major3")
    gra_year=Left(result("s_year_E3") ,4)
   End If

   '전형별 점수
   SQL="select * from result where mem_id=" & result("idx")
   Set rs=server.createobject("ADODB.RECORDSET")
   rs.open sql,db,1,1
   If Not rs.eof then
    If rs("t_point")<>"" then
    t_point=rs("t_point")
    Else
    t_point="미응시"
    End If
    If rs("f_point")<>"" then
    f_point=rs("f_point")
    Else
    f_point="미응시"
    End if
    If rs("s_point")<>"" then
    s_point=rs("s_point")
    Else
    s_point="미응시"
    End if
    If rs("th_point")<>"" then
    th_point=rs("th_point")
    Else
    th_point="미응시"
    End if
   End If
   
   '경력사항
   If result("com_name1")<>"" Then
   company=result("com_name1")
   com_S1=result("com_S1")
   com_E1=result("com_E1")
   work=company & "("&com_S1&"~"&com_E1&")"
   End If
   If result("com_name2")<>"" Then
   company2=result("com_name2")
   com_S2=result("com_S2")
   com_E2=result("com_E2")
   work=work & "," & company2 & "("&com_S2&"~"&com_E2&")"
   End If
   If result("com_name3")<>"" Then
   company3=result("com_name3")
   com_S3=result("com_S3")
   com_E3=result("com_E3")
   work=work & "," & company3 & "("&com_S3&"~"&com_E3&")"
   End If
   If result("com_name4")<>"" Then
   company3=result("com_name4")
   com_S4=result("com_S4")
   com_E4=result("com_E4")
   work=work & "," & company4 & "("&com_S4&"~"&com_E4&")"
   End If
   response.write "<tr>"
   response.write  "<td bgcolor='FFFFFF'>" & i & "</td>"
   response.write  "<td bgcolor='FFFFFF'>" & result("u_name_H") & "</td>"
   response.write  "<td bgcolor='FFFFFF'>" & left(left(result("juminno"),6),2) &" 년 "& Right(left(result("juminno"),4),2) &" 월</td>"
   response.write  "<td bgcolor='FFFFFF'>" & school_name & "</td>"
   response.write  "<td bgcolor='FFFFFF'>" & school_major & "</td>"
   response.write  "<td bgcolor='FFFFFF'>" & gra_year & " 년</td>"
   response.write  "<td bgcolor='FFFFFF'>" & pass_result & "</td>"
   response.write  "<td bgcolor='FFFFFF'>" & t_point & "</td>"
   response.write  "<td bgcolor='FFFFFF'>" & f_point & "</td>"
   response.write  "<td bgcolor='FFFFFF'>" & s_point & "</td>"
   response.write  "<td bgcolor='FFFFFF'>" & th_point & "</td>"
   response.write  "<td bgcolor='FFFFFF'>" & work & "</td>"
   result.movenext
   response.write "</tr>"
  next
  response.write "</table>"
 end if
%>

 

페이지 결과를 엑셀파일로 저장하고 싶을때...

페이지 상단에 아래와 같은 코드를 넣으면 됩니다.

 

즉 웹브라우져에게 ContentType 를 엑셀이라고 알려주면 저장하거나 바로 웹브라우져에서 엑셀을 보여주거나

사용자의 설정에 따라 다르게 보여줄겁니다.

 

 Response.Buffer = False
 Response.Expires=0
 
 FileName = "" 


 Response.AddHeader "Content-Disposition","attachment;filename=" & FileName
 Response.ContentType = "application/vnd.ms-excel"  '''= 엑셀로 출력
 Response.CacheControl = "public"

 

그외

 

엑셀 : application/vnd.ms-excel

워드 : application/vnd.ms-word

파워포인트 : application/vnd.ms-powerpoint

 

 

덧 : Response.Buffer = False 와 Response.CacheControl = "public" 의 역할은 데이터를 버퍼링 하지 않고

바로 다운로드 창이 떠서 저장하기를 누르면 그때 데이터를 받아오도록 하는 기능입니다.


출처 - http://blog.naver.com/amoong25?Redirect=Log&logNo=100025985663
반응형

'공부거리 > ASP' 카테고리의 다른 글

asp - mssql - 함수모음  (0) 2012.03.07
반응형

onmouseover="this.style.backgroundColor='#E1E1E1'" onmouseout="this.style.backgroundColor=''"

style="cursor: hand;"  <-- 요건 웹표준 위반..

style="cursor:pointer;" <-- 요게 맞는거

추가하고.

마우스 내렸을시
onmouseout="$(this).attr('bgcolor','#ffffff')"

마우스 올렷을시
onmouseover="$(this).attr('bgcolor','#d0ffee')"



ex)
< table>
< tr bgcolor="#ffffff" style="cursor:cursor;" onmouseout="$(this).attr('bgcolor','#ffffff');" onmouseover="$(this).attr('bgcolor','#d0ffee');" >

<td>
가나다라마바사아자차카타파하
</td>
</tr>
< /table>

반응형

'공부거리 > HTML' 카테고리의 다른 글

html 특수코드 목록  (0) 2012.09.20
웹표준, 웹접근성 검사 사이트  (0) 2012.01.25
input 박스 숫자만 입력받기  (0) 2011.12.23
[Script]팝업 띄우기  (0) 2011.12.08
스크립트로 추정되는 정규식(?)  (0) 2011.11.10
반응형

1. http://validator.w3.org/unicorn/

W3C에서 제공하는 통합 웹표준 검사기입니다. 어설프게 한글을 지원합니다...

2. http://validator.w3.org/

역시 W3C에서 제공하고, HTML, XHTML 등 웹문서의 웹표준만을 검사합니다. 철저히 영어...

3. http://validator.kldp.org/

이건 KLDP에서 제공하는 위 사이트의 한국어 사이트입니다. 비공식 사이트이긴하지만 왠만큼 한국어를 지원합니다.

4, http://validator.w3.org/checklink

W3C에서 제공하는 사이트로 깨진 링크가 있는지를 검사합니다. 이것도 철저히 영어..

5. http://validator.kldp.org/checklink

위의 한국어 사이트로 KLDP에서 제공합니다.(비공식)

6. http://jigsaw.w3.org/css-validator/

이것도 W3C에서 제공하며, CSS의 웹표준을 검사합니다. ㅠㅜ 한국어 지원..ㅇㅅㅇ

http://css-validator.kldp.org/

이것도 역시 KLDP에서 제공하는 위 사이트의 한국어 사이트입니다.(비공식) 근데 이미 위에서 한국어 지원...

8. http://validator.w3.org/mobile/

모바일 사이트의 웹표준을 검사하는 사이트입니다.(W3C에서 제공, 영어)

9. http://wave.webaim.org/

여기는 웹표준 보단 웹접근성에 초점을 맞춘것 같네요. 물론 영어입니다.

10. https://developers.google.com/pagespeed/

구글에서 제공하고 웹표준 보단 최적화 쪽입니다. 그리고 영어..

11. http://www.wah.or.kr/Achive/Kadowah.asp

웹 접근성 연구소에서 제공하는 접근성 검사 프로그램입니다. 설치를 해야합니다..


출처 - http://joyfui.wo.tc/771

반응형

'공부거리 > HTML' 카테고리의 다른 글

html 특수코드 목록  (0) 2012.09.20
테이블 마우스 오버 및 아웃시 색상변경  (0) 2012.02.28
input 박스 숫자만 입력받기  (0) 2011.12.23
[Script]팝업 띄우기  (0) 2011.12.08
스크립트로 추정되는 정규식(?)  (0) 2011.11.10
반응형

문자관련 함수

lower(문자) : 소문자로

upper(문자) : 대문자로

initcap(문자) : 첫글자만 대문자로

concat(문자,문자) : 두문자 연결

substr(문자열,시작숫자,갯수) : 시작숫자부터 갯수 만큼 문자 추출

instr(문자열,찾을문자,시작위치,몇번째) : 찾을문자가 몇번째에 있나? 숫자 반환

length(문자열) : 문자열 문자갯수 반환

lpad(문자열,최대길이,채울문자) : 왼쪽문자 채움

rpad(                 ''                ) : 오른쪽 채움


숫자관련 함수

round(숫자,자릿수) : 자릿수 0-> 소수첫째자리에서 반올림, 자릿수 1-> 소수 둘째짜리에서 반올림

                             자릿수 -1 -> 정수 1의자리에서 반올림

trunc(숫자,자릿수) : 내림

mod(숫자,숫자) : 나머지


날짜관련 함수

select sysdate : sysdate는 현재 시각을 의미

months_between(날짜, 날짜) : 두 날짜사이의 개월 차이를 반환

add_month(날짜,숫자) : 월에 더한다.

next_day(날짜,요일) : 1=일요일, 7=토요일  날짜이후에 해당하는 요일의 날짜를 반환

last_day(날짜) : 날짜의 월에 마지막 날짜를 반환.

round(날짜,자릿수) : 자릿수는 day,month,year  해당하는 까지 나타냄. 기본값 day.

trunc(날짜,자릿수) : 반올림과 동일


변환 함수

to_char(인자,['문자열 형식']) : 문자로 변환, 문자열 형식대로 변환 가능

                                            ex) 날짜 yy-mm/mon/month-dd hh/hh12/hh24:mi:ss , am/pm, ddsp->영문

                                                 숫자 9->숫자위치,0->0으로채움, L->지역화폐

to_number(인자) : 숫자로 변환

to_date(인자) : 날짜로 변환

RR 날짜 타입= 50년 기준 00~49 는 2000년도 // 50~99 1900년도


널관련 함수(인자끼리는 모두 값은 데이터형이여야한다.)

NVL(대상,대상이 널이면 반환할값)

NYL2(대상,널이아니면,널이면)

NULLIF(인자1,인자2) : 두인자가 같은 값이면 널을 반환, 아니면 인자1 값 반환

COALESCE(1,2,3,4,5,6......) : 널이 아닌 인자의 값을 반환.

CASE 대상 WHEN 비교값 THEN 반환값 ELSE 반환값 END : ELSE 구문 없으면 널값 반환

DECODE(대상,비교값,반환값,비교값,반환값,ELSE반환값) : 케이스문을 콤마로만 구분.


날짜표시 함수

tz_offset(타임존명칭) : asia/seoul 한국의 타임셋표시해줌.


그룹 함수 : count(*) 을 제외한 널값에 대해서는 아예 계산에 포함하지 않음. 구문에 distinct 가능,group by시 중첩가능

count()

sum()

avg()

max()

min()

stddev() : 표준편차

variance() : 분산



출처 - http://manhdh.blog.me/120116168431
반응형

'공부거리 > SQL' 카테고리의 다른 글

PostGresql 백업 복구  (0) 2013.05.16
[ORACLE] 함수 모음집  (0) 2011.12.22
[오라클] 특수문자 코드  (0) 2011.12.14
SQL - INSERT문, DELETE문, UPDATE문  (0) 2011.10.27
반응형

int to string
String myString = Integer.toString(my int value);
String str = "" + i;


String to int
int i = Integer.parseInt(str);
int i = Integer.valueOf(str).intValue();


double to String
String str = Double.toString(i);


long to String
String str = Long.toString(l);


float to String
String str = Float.toString(f);


String to double
double d = Double.valueOf(str).doubleValue();


String to long
long l = Long.valueOf(str).longValue();
long l = Long.parseLong(str);


String to float
float f = Float.valueOf(str).floatValue();


decimal to binary
int i = 42;
String binstr = Integer.toBinaryString(i);


decimal to hexadecimal
int i = 42;
String hexstr = Integer.toString(i, 16);
String hexstr = Integer.toHexString(i);
--(with leading zeroes and uppercase)
public class Hex {
    public static void main(String args[]){
        int i = 42;
        System.out.print(Integer.toHexString( 0x10000 | i).substring(1).toUpperCase());}
}


hexadecimal (String) to integer
int i = Integer.valueOf("B8DA3", 16).intValue();
int i = Integer.parseInt("B8DA3", 16);    


ASCII code to String
int i = 64;
String aChar = new Character((char)i).toString();


integer to ASCII code (byte)
char c = 'A';
int i = (int) c; // i will have the value 65 decimal


integer to boolean
b = (i != 0);


boolean to integer
i = (b)?1:0;


출처 - http://blog.naver.com/free2824?Redirect=Log&logNo=60098226071
반응형
반응형

String removeTags(input)

HTML tag부분을 없애준다
function removeTags(input) {
    return input.replace(/<[^>]+>/g, ""); 
};
example>
var str = "<b>Tmax</b> <i>soft</i>";
document.write(str +"<br>");
document.write(removeTags(str));
result>
Tmax soft
Tmax soft

String String.trim()

문자열의 앞뒤 공백을 없애준다.
String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, ''); 
};
example>
var str = "         untrimed string            ";
document.write("========" + str+ "==============<br>");
document.write("========" + str.trim() + "==============");
result>
======== untrimed string ==============
========untrimed string==============

String String.capitalize()

단어의 첫 글자를 대문자로 바꿔준다.
String.prototype.capitalize = function() {
    return this.replace(/\b([a-z])/g, function($1){
        return $1.toUpperCase();
    }) ;  
};
example>
var str = "korea first world best";
document.write(str.capitalize());
result>
Korea First World Best

String number_format(input)

입력된 숫자를 ,를 찍은 형태로 돌려준다
function number_format(input){
    var input = String(input);
    var reg = /(\-?\d+)(\d{3})($|\.\d+)/;
    if(reg.test(input)){
        return input.replace(reg, function(str, p1,p2,p3){
                return number_format(p1) + "," + p2 + "" + p3;
            }    
        );
    }else{
        return input;
    }
}
example>
document.write(number_format(1234562.12) + "<br>");
document.write(number_format("-9876543.21987")+ "<br>");
document.write(number_format("-123456789.12")+ "<br>");
result>
1,234,562.12
-9,876,543.21987
-123,456,789.12


출처 - http://cafe.naver.com/q69.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=115820&
반응형
반응형

코드 활용시 영어만 입력 가능으로 수정 가능.

<input name="tel2" type="text" size="4" onkeyPress="if ((event.keyCode<48) || (event.keyCode>57)) event.returnValue=false;"style="ime-mode:disabled"> 

function langcheck_eng(str){
 var pattern = /[^(a-zA-Z)]/; //영문만 허용
 if(pattern.test(str)){
  return false;//영문만 가능합니다
 }else{
  return true;//정상
 }
}

function langcheck_eng_num(str){
 var pattern = /[^(a-zA-Z0-9)]/; //영문,숫자만 허용
 if(pattern.test(str)){
  return false;//불합격
 }else{
  return true;//정상
 }
}

function langcheck_num(str){
 var pattern = /[^(0-9)]/; //숫자만 허용
 if(pattern.test(str)){
  return false;//불합격
 }else{
  return true;//정상
 }
}

function isNumber(upw) {
 var chk_num = upw.search(/[0-9]/g); 
 if(chk_num < 0) {
  return false;
 }
 return true;
}

반응형
반응형

내용 이미지 스크롤 주의


 

 

출처 -  http://blog.naver.com/bleu_ciel
반응형

'공부거리 > SQL' 카테고리의 다른 글

PostGresql 백업 복구  (0) 2013.05.16
오라클 SQL 함수  (0) 2012.01.20
[오라클] 특수문자 코드  (0) 2011.12.14
SQL - INSERT문, DELETE문, UPDATE문  (0) 2011.10.27
반응형
java.util.Date thisDate = new java.util.Date();
java.util.Date yesterday = new java.util.Date ( );

SimpleDateFormat dateFormatTime = new SimpleDateFormat("yyyyMMddHH24mmss");
String nowDateTime = dateFormatTime.format(thisDate);//현재시간
   
yesterday.setTime ( thisDate.getTime() - ( (long) 1000 * 3600 * 24 ) );//전부 초로 바꿔서 변경
yesterDate = dateFormatTime.format(yesterday);//하루전 시간



반응형
반응형


스크립트 소스

<script language="javascript" type="text/javascript">//체크박스 전체 선택용 스크립트
function checkAll(idx){
  var all_check = document.getElementsByName("i_t_idx");
  for(var i=0;i<all_check.length;i++){
   if(all_check[i].type == "checkbox")
   {
    all_check[i].checked = idx;
   }
  }
 }
</script>

체크박스 소스
<input type="checkbox" onclick="checkAll(this.checked)"/>



출처 - 수호천사의 블로그 (http://blog.naver.com/cobin?Redirect=Log&logNo=140133643136)
반응형

'공부거리 > JAVASCRIPT' 카테고리의 다른 글

숫자 체크  (0) 2012.04.09
날짜 유효성 검사  (0) 2012.03.07
스크립트 정규식 소스 조금  (0) 2012.01.10
[스크립트]window.open() 스크립트 옵션 및 예제  (0) 2011.12.15
[SCRIPT] 라디오 버튼 자동 선택  (0) 2011.12.12

+ Recent posts