31 07 2017
Haeng Ho Kang | Programming, Swift |
설치
|
$sudo gem install cocoapods |
프로젝트에 cocoapod 적용
|
$cd /적용대상 Project $pod init 이렇게 하면 초기화(Podfile)이 생성된다. $vi Podfile 수정 platform :ios, '9.0' target "적용대상 Project " do pod 'Firebase' // 가져오고자 하는 library end |
프로젝트를 오픈 “적용대상 Project”.xcworkspace를 오픈한다. 반드시 *.xcworkspace를 오픈한다. 끝 삭제할 경우 https://stackoverflow.com/questions/16427421/how-to-remove-cocoapods-from-a-project 1.Delete the standalone files (Podfile Podfile.lock and your Pods directory) 2.Delete the generated xcworkspace 3.Open your xcodeproj file, delete the references to Pods.xcconfig and libPods.a (in the Frameworks group) 4.Under your Build Phases delete the Copy Pods Resources, Embed Pods Frameworks andCheck Pods Manifest.lock phases. 5.This may seem obvious but you’ll need […]
21 07 2017
Haeng Ho Kang | Programming, Swift |
별도 safari 브라우저 창 뛰우기
|
import SafariServices if let url = URL(string: "https://google.co.kr") { let viewController = SFSafariViewController(url: url) present(viewController, animated: true, completion: nil) } |
이미지 가져오기
|
if let url = URL(string: "https://wikibook.github.io/swift3-textbook/sample.jpg") { if let data = NSData(contentsOf: url) { let image = UIImage(data: data as Data) } } |
text 읽어오기
|
if let url = URL(string: "https://wikibook.github.io/swift3-textbook/test.txt") { let urlSession = URLSession.shared let task = urlSession.dataTask(with: url, completionHandler: { (data, response, erro) in if let nsstr = NSString(data: data!, encoding: String.Encoding.utf8.rawValue){ let str = String(nsstr) print("문자열=[\(str)]") } }) task.resume() } |
앱에서 전화걸기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
let url = NSURL(string: "tel://01012345678")! if #available(iOS 10.0, *) { UIApplication.shared.open(url as URL) } else { UIApplication.shared.openURL(url as URL) } func open(scheme: String){ if let url = URL(string: scheme) { if #available(iOS 10.0, *) { UIApplication.shared.open(url, options: [:], completionHandler: { (success) in print("open \(scheme): \(success)") }) } else { // Fallback on earlier versions let success = UIApplication.shared.openURL(url) print("open \(scheme): \(success)") } } } |
UserDefaults 사용하기 Save: UserDefaults.standard.set(“value”, forKey: “key”) Get : if let x = UserDefaults.standard.object(forKey: “key”) as? String Firebase login https://www.youtube.com/watch?v=_hHohEa0H-Q 다양한 팁 http://g-y-e-o-m.tistory.com/ 로그인 유지 1.http://www.kaleidosblog.com/how-to-create-a-login-screen-page-in-swift-3-authenticate-an-user-and-keep-the-session-active2.https://www.raywenderlich.com/147308/secure-ios-user-data-keychain-touch-id 키체인 http://taehyun71.tistory.com/20 기타 http://blog.naver.com/writer0713/221040662262
11 07 2017
Haeng Ho Kang | Programming, Java |
javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
function fnCmdLogin() { var captcha = $('#captcha').val(); if(captcha == ''){ alert("자동등록 방지 문자를 입력해 주세요."); $('#captcha').focus(); return; } var captchaOk = $.commandAjax('<c:url value="/mngr/com/login/checkCaptcha.do"/>', 'loginForm'); if (captchaOk.status == 'FAIL') { alert(captchaOk.message); return; } var logId = $('#logId').val(); var pwd = $('#logPw').val(); if(logId == ''){ alert("아이디를 입력하세요."); $('#logId').focus(); return; } if(pwd == ''){ alert("비밀번호를 입력하세요."); $('#logPw').focus(); return; } var login = $.commandAjax('LoginConfirm.do', 'loginForm'); if (login.status == 'SUCCESS') { location.href = login.message; } else { alert(login.message); } return false; } function fnCmdReCaptcha() { var $captchaLoader = $("#loginForm .box.captcha .loading"); var $captchaImg = $("#loginForm .box.captcha img"); $captchaLoader.show(); $('#captchaImg').attr("src", "/captcha?ran=" + Math.random()); $captchaLoader.fadeOut(500); } |
html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
<table class="logintb"><colgroup> <col style="width: 32%;" /> <col /> <col style="width: 20%;" /> </colgroup> <tbody> <tr class="box captcha"> <td style="padding-left: 30px;" colspan="3"> <div class="loading"></div> <img id="captchaImg" title="캡차 이미지" src="/captcha" alt="캡차 이미지" /></td> </tr> <tr> <th><label for="captcha">자동 로그인 방지</label></th> <td><input id="captcha" autocomplete="off" name="captcha" required="" type="text" /></td> <td><a class="reflashbtn" onclick="fnCmdReCaptcha();" tabindex="3" href="#none">새로고침</a></td> </tr> <tr> <th>ID</th> <td><input id="logId" style="ime-mode: inactive;" tabindex="1" maxlength="20" name="logId" type="text" placeholder="Login Id" /></td> <td rowspan="2"><a class="loginbtn" tabindex="3" href="#none">로그인</a></td> </tr> <tr> <th>Password</th> <td><input id="logPw" tabindex="2" maxlength="20" name="logPw" type="password" placeholder="Password" /></td> </tr> </tbody> </table> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
//자동등록 문자 확인 URL @ResponseBody @RequestMapping(value = "/mngr/com/login/checkCaptcha.do") public ValidationResponse checkCaptcha(HttpServletRequest request, HttpServletResponse response) throws Exception { ValidationResponse validationResponse = new ValidationResponse(); Captcha captchaService = (Captcha) request.getSession().getAttribute(Captcha.NAME); request.setCharacterEncoding("UTF-8"); // Do this so we can capture non-Latin chars String captcha = request.getParameter("captcha");// captcha.value if (captchaService.isCorrect(captcha)) { validationResponse.setStatus(ValidationMessage.SUCCESS); validationResponse.setResult(""); } else { validationResponse.setStatus(ValidationMessage.FAIL); validationResponse.setResult("자동 등록 방지를 위한 문자를 잘못 입력했습니다."); } return validationResponse; } //로그인 처리부분에 아래 부분 포함 Captcha captchaService = (Captcha) request.getSession().getAttribute(Captcha.NAME); String captcha = request.getParameter("captcha");// captcha.value if (!captchaService.isCorrect(captcha)) { validationResponse.setStatus(ValidationMessage.FAIL); validationResponse.setResult("자동 등록 방지를 위한 문자를 잘못 입력했습니다."); return validationResponse; } |
Web.xml
|
<servlet> <servlet-name>SimpleCaptcha</servlet-name> <servlet-class>nl.captcha.servlet.SimpleCaptchaServlet</servlet-class> <init-param> <param-name>captcha-width</param-name> <param-value>300</param-value> </init-param> <init-param> <param-name>captcha-height</param-name> <param-value>100</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>SimpleCaptcha</servlet-name> <url-pattern>/captcha</url-pattern> </servlet-mapping> |
Maven pom.xml
|
<dependency> <groupId>nl.captcha</groupId> <artifactId>SimpleCaptcha</artifactId> <version>1.2.1</version> </dependency> |
또는 SimpleCaptcha-1.2.1.jar 추가
11 07 2017
Haeng Ho Kang | OS, Linux/Unix |
윈도우에서 잘돌아 가는 SimpleCaptcha가 Unix/Linux 서버에서 에러가 날 경우
|
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment |
이 경우 Tomcat의 경우 catalina.sh 파일 제일위에 -Djava.awt.headless=true
|
CATALINA_OPTS="-Djava.awt.headless=true" |
제우스 같은 경우는 config 디렉토리 디벼보면 JEUSMain.xml 파일이 있는데 요걸 바로 수정해 주거나 아니면 webadmin 을 이용해서 수정해 주면 된다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
<jeus-system xmlns="http://www.tmaxsoft.com/xml/ns/jeus"> <node> ... ... <engine-container> <name>testContainer</name> <id>121</id> <base-port>11011</base-port> <command-option>-Xms256m -Xmx512m -Djava.awt.headless=true</command-option> <engine-command> <type>servlet</type> <name>test</name> </engine-command> <sequential-start>true</sequential-start> </engine-container> ... ... </jeus-system> |
출처: http://stove99.tistory.com/166 [스토브 훌로구] 아래 링크 설정파일 변경 적용의 예 1.3.3 – Configuring options and paths for Tomcat Configure the setenv.sh file […]
22 05 2017
Haeng Ho Kang | DataBase, Oracle |
http://cafe.naver.com/ocmkorea/book5085531/17192 테이블 수정
|
#>su - oracle $>sqlplus /nolog SQL>connect sys /as sysdba SQL> alter table ABC_OPEN add(FILE_NAME varchar2(30)); SQL> alter table ABC_COURSECODE add(FILE_NAME1 varchar2(30), FILE_NAME2 varchar2(30), FILE_NAME3 varchar2(30), FILE_NAME4 varchar2(30), FILE_NAME5 varchar2(30)); SQL> alter table ABC_COMPLETEUSER add(DIPLOMANUM NUMBER(7,0)); |
테이블 변경
|
ALTER TABLE ABC_OPEN ADD( birth DATE) ; ALTER TABLE ABC_OPEN MODIFY ename VARCHAR2(30) ; ALTER TABLE ABC_OPEN DROP COLUMN ename ; ALTER TABLE ABC_OPEN SET UNUSED (eno) ; ALTER TABLE ABC_OPEN DROP UNUSED COLUMNS ; |
17 05 2017
Haeng Ho Kang | OS, Linux/Unix |
Mac의 Finder에서 환경파일또는 .으로 시작하는 파일이 안보이는데 이걸 보이게 하는 명령어는 Terminal에서
|
$defaults write com.apple.finder AppleShowAllFiles -bool true |
또는 false하면 된다. 그리고 적용하기 위해서는 재시작또는 재로그인하면 됩니다. Terminal 을 이용하여 ssh접속 $ssh -p port 계정@아이피(도메인)
|
$ssh -p 1111 abc@blog.nuriware.com |
scp order : File upload scp -P [remote port] [local file] [remote server]:[remote folder path]
|
scp -P 1111 ROOT.war abc@blog.nuriware.com:/application/webapps/ |
27 04 2017
Haeng Ho Kang | Programming, Swift |
1.키체인에 접근( 상단의 spotlight 검색에서 키체인) (1) Apple Worldwide Developer Relations Certification Authority (2) iPhone Developer : (사용자이름) (고유번호) (3) iPhone Distribution : (사용자이름) (고유번호) 를 옮기면 된다. 1번의 경우는 키체인에서 왼쪽 시스템 클릭하면 오른쪽에 Apple Worldwide Developer Relations Certification Authority 항목에 오른쪽 마우스하고 보내기를 누르면 된다. ==> 등록시에는 drag and drop 하면됨 2번,3번의 경우는 로그인의 인증서를 선택하고 오른쪽 마우스하고 […]
19 04 2017
Haeng Ho Kang | Programming, Swift |
소스변경 : WebFrame –> UIWebView로 변경 1)Error: ld: library not found for -lcrt1.3.1.o Solution: If your project source have deployment target from iOS 5.0 then change it to iOS 6.0 or later and your error will be fix. Now that work fine for device too. 2)Apple Match-O Linker (id)Error – Product > Clean Enable BitCode를 […]
7 04 2017
Haeng Ho Kang | Programming, Swift |
Loading Local HTML to WebView
|
override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. //getting local file let localHtmlFile = NSBundle.mainBundle().URLForResource("index", withExtension: "html"); //creating request let request = NSURLRequest(URL: localHtmlFile!); //loading request webView.loadRequest(request); } |
7 04 2017
Haeng Ho Kang | Programming, Swift |
ios 에서 이쁜 차트 Graph 사용하기 http://m.blog.naver.com/syowoo/220770292459