Skip to content

Instantly share code, notes, and snippets.

View AsyncTaskGetJson.java
package com.example.mizuno.prog17_02;
import android.os.AsyncTask;
import android.util.Log;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
View activity_prog1704.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_prog1704"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
View AsyncHttpGetJson.java
package com.example.mizuno.prog17_02;
import android.os.AsyncTask;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
View AsyncHttpGetJson.java
package com.example.mizuno.prog17_02;
import android.os.AsyncTask;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
@smzn
smzn / upload.ctp
Last active May 3, 2017
upload.ctp
View upload.ctp
<div class="schools form">
<?php echo $this->Form->create('School',array('url'=>'import','type'=>'file')); ?>
<fieldset>
<legend><?php echo __('Add School'); ?></legend>
<?php
echo $this->Form->input('XmlFile',array('label'=>'','type'=>'file'));
?>
</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>
View import
public function import(){
if($this->request->is('post')){
$up_file = $this->data['School']['XmlFile']['tmp_name'];
$fileName = 'post.xml';
if(is_uploaded_file($up_file)){
move_uploaded_file($up_file, $fileName);
$xmlArray = Xml::toArray(Xml::build($fileName));
$i = 0;
foreach($xmlArray['Dataset']['ksj:School'] as $line){
$latlng = explode(" ",$xmlArray['Dataset']['gml:Point'][$i++]['gml:pos']);
View mms action
public function mms($id = null) {
if (!$this->Zone->exists($id)) {
throw new NotFoundException(__('Invalid zone'));
}
$options = array('conditions' => array('Zone.' . $this->Zone->primaryKey => $id),'recursive' => 2);
$this->set('zone', $this->Zone->find('first', $options));
$zone = $this->Zone->find('first', $options);
$doctor = 0;
$hospital_num = 0;
View MyMMS
<?php
class MyMMS{
private $lambda, $mu, $row, $Q, $L, $W, $U, $s;
public function __construct($lambda, $mu, $s){
$this->lambda = $lambda;
$this->mu = $mu;
$this->s = $s;
}
View 20170519_2
using System;
namespace _2
{
class MainClass
{
public static void Main (string[] args)
{
Console.Write ("n -> ");
int n = int.Parse (Console.ReadLine ());
@smzn
smzn / import
Last active May 21, 2017
import
View import
public function import(){
APP::import('Model','Boundary');
$this->Boundary = new Boundary;
if($this->request->is('post')){
$up_file = $this->data['Zone']['XmlFile']['tmp_name'];
$fileName = 'post.xml';
if(is_uploaded_file($up_file)){
move_uploaded_file($up_file, $fileName);
$xmlArray = Xml::toArray(Xml::build($fileName));
You can’t perform that action at this time.