2010. 6. 30. 00:36

// Emits an audio beep

Toolkit.getDefaultToolkit().beep();

Posted by 짱가쟁이
사용하기 전에 몇가지 제약이 존재하는듯.

1. google account 가 있어야 한다.
2. google calendar "모바일 설정"에서 자신의 phone number 인증을 받아야 한다.
3. 인증 받은 후 내 킬린더의 SMS 수신 여부를 설정해야 함.
4. gdata-src.java-1.40.0.zip 다운로드 받고.. lib 목록에 추가해야함.
5. 잘 사용해서 만들어 주면 땡.

sample
- 우선은 구글 계정 정보(id, pw)를 알아야 SMS를 전송할 수 있다.
- title에 입력된 데이터가 SMS로 전송된다.
- title이 길면 여러개로 쪼개져서 오기 때문에 받아보기 귀찮음. 알아서 사이즈를 맞춰야 할듯.

package google.sms;

import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.util.Date;

import com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.DateTime;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.calendar.CalendarEntry;
import com.google.gdata.data.calendar.CalendarEventEntry;
import com.google.gdata.data.calendar.CalendarFeed;
import com.google.gdata.data.extensions.Reminder;
import com.google.gdata.data.extensions.When;
import com.google.gdata.data.extensions.Reminder.Method;
import com.google.gdata.util.ServiceException;

public class Launcher {

 String id = "id@gmail.com";
 String pw = "password";
 String calendarName = "SMS";
 
 public void test() throws IOException, ServiceException {
  CalendarService service = new CalendarService("sms notify");
 
  service.setUserCredentials(id, pw);

  String title = "문자 테스트 잘 받아보아라...11";
  String description = "테스트입니다.2";
 
  URL metafeedUrl = new URL("http://www.google.com/calendar/feeds/default/allcalendars/full");
  CalendarFeed resultFeed = service.getFeed(metafeedUrl, CalendarFeed.class);
  List entries = resultFeed.getEntries();
 
  for (int i = 0; i < entries.size(); i++) {
   CalendarEntry entry = (CalendarEntry)entries.get(i);
   String currCalendarName = entry.getTitle().getPlainText();
   System.out.println("\t" + currCalendarName);
 
   if (currCalendarName.equals(calendarName)) {
    sendDowntimeAlert(service, entry, title, description);
   }
  }
 
  System.out.println("\nTotal Entries: " + entries.size());

 }
 
 private void sendDowntimeAlert(CalendarService myService,
         CalendarEntry entry,
         String title,
         String description) throws IOException,
  ServiceException {
 
  String postUrlString = entry.getLink("alternate", "application/atom+xml").getHref();
 
  URL postUrl = new URL(postUrlString); //was: "http://www.google.com/calendar/feeds/jo@gmail.com/private/full"
 
  CalendarEventEntry myEntry = new CalendarEventEntry();
 
  myEntry.setTitle(new PlainTextConstruct(title));
  myEntry.setContent(new PlainTextConstruct(description));
 
  Date now = new Date();
 
  // 이거는 뭐.. 시간이 우떻게 되는 거임?? 도통..
  Long tzOffset = new Double(Double.parseDouble("9")).longValue() * 60 * 60 * 1000 + 1000 * 5;
 
  Date startDate = new Date(now.getTime());
  Date endDate = new Date(now.getTime());
  
 
  DateTime startTime  = new DateTime(startDate.getTime()  + tzOffset);
  DateTime endTime  = new DateTime(endDate.getTime()  + tzOffset);
 
  When eventTimes = new When();
  eventTimes.setStartTime(startTime);
  eventTimes.setEndTime(endTime);
  myEntry.addTime(eventTimes);
 
  // Send the request and receive the response:
  CalendarEventEntry insertedEntry = myService.insert(postUrl, myEntry);
  System.err.println("Got response for: "+insertedEntry.getTitle().getPlainText());
 
  for(When when : insertedEntry.getTimes()) {
   System.err.println("When: "+when.getStartTime()+" to "+when.getEndTime());
  }
 
  Reminder reminder = new Reminder();
  reminder.setMinutes(0);
  reminder.setMethod(Method.SMS);
  insertedEntry.getReminder().add(reminder);
  insertedEntry.update();
 }
 
 public static void main(String[] args) {
  try {
   new Launcher().test();
  } catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (ServiceException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
 }
}

Posted by 짱가쟁이
1. 서비스 시간, 대기 시간, 처리량, 효율성, 확장성, 용량 등
  : 서비스 시간 과 대기 시간은 특정 작업을 처리하는 속도가 "얼마나 빠르냐"를 말한다.
  : 용량 과 처리량은 동일한 자원을 갖고 있을때 "얼마나 많은" 양의 일을 할 수 있는지를 말한다.
Posted by 짱가쟁이
jdbc.driverClassName=sun.jdbc.odbc.JdbcOdbcDriver

jdbc.url=jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=config/db.mdb
jdbc.username=Admin
jdbc.password=

jdbc.maxActive=20
jdbc.maxIdle = 5
jdbc.maxWait = 10000

Posted by 짱가쟁이
<script src="http://java.com/js/deployJava.js"></script>

<script>
 if (deployJava.isPluginInstalled()) {
  if (!deployJava.versionCheck('1.6.0_10+')) {
   deployJava.installJRE('1.6.0_10+');
  }
 } else {
  deployJava.installLatestJRE();
 }
</script>

요 스크립트를 추가하면 .. JRE 다운로드 페이지로 자동이동 됨.
Posted by 짱가쟁이
Java Performance Fundamental 40page 를 보면 알기 쉽게 설명해 놓음.
 

붕어빵틀(Class)과 붕어빵 관계(Instance)
위의 책을 토대로 설명하면.. Class Loading 시 Class 정보를 추출하여 Method Area 에 붕어빵틀을 생성한다. 여기서 누군가가 Instance를 생성할려고 하면 Method Area 의 Class 정보를 틀로 하여 Heap 에 Object를 하나 찍어낸다. 이것이 Instance 이다.

Posted by 짱가쟁이
참조
Java Performance Fundamental(김한도) 참조

Field
- Instance Variable
  : non-static field

- Class Variable     
  : Class 에서 static 으로 선언된 변수(static field) 이며 Class 에서는 하나의 값으로 유지됨
  : Class 를 사용하기 전부터 Method Area 에 미리 메모리를 할당 받는다.

Variable
- Local Variable
- Parameter

Posted by 짱가쟁이
이전버튼 1 2 이전버튼