This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static String consoleInput (String prompt) throws IOException { | |
if (prompt != null) { | |
System.out.print(prompt); | |
} | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
return br.readLine(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ストーリーボード上でセグエにgoSampleというIDをつけておく | |
- (void)method | |
{ | |
[self performSegueWithIdentifier:@"goSample" sender:self]; | |
} | |
// 画面遷移する前に呼ばれる | |
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resp.setContentType("text/html; charset=UTF-8"); | |
PrintWriter out = resp.getWriter(); | |
この順番じゃないと文字化けする |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NearestSta | |
{ | |
Coord coord; | |
List<Station> station = new ArrayList<Station>(); | |
} | |
public class Coord | |
{ | |
public float lon; // Request longitude | |
public float lat; // Request latitude |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewWillAppear:(BOOL)animated | |
{ | |
[super viewWillAppear:animated]; | |
[self startSensor]; | |
} | |
- (void)viewWillDisappear:(BOOL)animated | |
{ | |
[super viewWillDisappear:animated]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function read_file ($filename) | |
{ | |
$str = null; | |
$fp = fopen($filename, 'r'); | |
if ($fp) { | |
if (flock($fp, LOCK_EX)) { | |
$str = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* input: 2点の緯度経度(10進数) | |
* output: 2点間距離の2乗(km^2) | |
*/ | |
function geo_distance2 ($lat1, $lng1, $lat2, $lng2) { | |
$earth_r = 6378.137; // 地球の半径(km) | |
$deltaLat = deg2rad($lat2 - $lat1); // 緯度差(角度ラジアン) | |
$deltaLng = deg2rad($lng2 - $lng1); // 経度差(角度ラジアン) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
/* prevent callout to copy image, etc when tap to hold */ | |
-webkit-touch-callout: none; | |
/* prevent webkit from resizing text to fit */ | |
-webkit-text-size-adjust: none; | |
/* make transparent link selection, adjust last value opacity 0 to 1.0 */ | |
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); | |
/* prevent copy paste, to allow, change 'none' to 'text' */ | |
-webkit-user-select: none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select id="selXxx" onchange="onChange(this)"> | |
<option value="hoge" selected>hoge</option> | |
<option value="foo">foo</option> | |
<option value="bar">bar</option> | |
</select> | |
<script> | |
function onChange (selector) { | |
var val = selector.options[selector.selectedIndex].value; | |
if (val == "hoge") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// info.plistの"View controller-based status bar appearance"をYESにする | |
// 各ViewControllerで下記のように実装する | |
// "View controller-based status bar appearance"をNOにした場合はinfo.plistの"Status bar style"が全ViewControllerに適用される | |
// "View controller-based status bar appearance"をinfo.plistに追加していない場合は変更は適用されない | |
- (void) viewDidLoad { | |
[super viewDidLoad]; | |
// 変更を通知 | |
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { | |
[self setNeedsStatusBarAppearanceUpdate]; |
OlderNewer