Skip to content

Instantly share code, notes, and snippets.

View hbina's full-sized avatar
🐕
hopefully doing something useful...

Hanif Ariffin hbina

🐕
hopefully doing something useful...
View GitHub Profile
#Grouped up for easier read
def run_prime_generator(start_value, initial_value, primes_list):
if start_value == None:
None
else:
print "Number %s is a prime!" %(start_value)
primes_list.append(start_value)
return primes_list
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
package com.example.topology.octranspoandroid;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import java.io.*;
public class Splitter {
private static BufferedReader bufferedReader;
/**
* Note -- If there are extra files it will create another files to store the remainder files
* @param writeName -- the name of the files that we are going to write
* @param readName -- the name of the file that we will parse from
agency_name,agency_url,agency_timezone,agency_lang,agency_phone
"OC Transpo",http://www.octranspo.com,America/Montreal,,
route_id,route_short_name,route_long_name,route_desc,route_type,route_url
1-251,1,,,3,
1-256,1,,,3,
2-251,2,,,3,
2-256,2,,,3,
4-251,4,,,3,
4-256,4,,,3,
5-251,5,,,3,
5-256,5,,,3,
6-251,6,,,3,
service_id,date,exception_type
JAN17B-JANSU17-Sunday-02,20170414,1
JAN17B-JANSA17-Saturday-03,20161226,1
JAN17B-JANSA17-Saturday-03,20161227,1
JAN17B-JANSA17-Saturday-03,20170102,1
JAN17B-MBWK17-Weekday-02,20170102,2
JAN17B-MBWK17-Weekday-02,20170109,2
JAN17B-MBWK17-Weekday-02,20170110,2
JAN17B-MBWK17-Weekday-02,20170111,2
JAN17B-MBWK17-Weekday-02,20170112,2
service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
SCOTIA-1900wSuP-Weekend-02,0,0,0,0,0,1,1,20161217,20161217
SCOTIA-1900LowR-Weekday-02,1,1,1,1,1,0,0,20161221,20161221
SCOTIA-1930SupP-Weekday-02,1,1,1,1,1,0,0,20161222,20161222
NYEVE16-NYEVE16-Saturday-03,0,0,0,0,0,1,0,20161231,20161231
SEPT16B-SEPDA16-Weekday-38,1,1,1,1,1,0,0,20161216,20161223
SEPT16B-SEPSA16-Saturday-02,0,0,0,0,0,1,0,20161217,20161224
SEPT16B-SEPSU16-Sunday-05,0,0,0,0,0,0,1,20161218,20161218
JAN17B-JANSU17-Sunday-02,0,0,0,0,0,0,1,20161225,20170416
JAN17B-JANSA17-Saturday-03,0,0,0,0,0,1,0,20161226,20170422
stop_id,stop_code,stop_name,stop_desc,stop_lat,stop_lon,zone_id,stop_url,location_type
AA010,8767,"SUSSEX / RIDEAU FALLS",,45.43987,-75.695842,,,0
AA020,6859,"SUSSEX / RIDEAU FALLS",,45.439572,-75.695693,,,0
AA030,7001,"SUSSEX / ALEXANDER",,45.442859,-75.693562,,,0
AA035,8762,"ALEXANDER / THOMAS",,45.442797,-75.692323,,,0
AA040,7000,"JOHN / SUSSEX",,45.442553,-75.693503,,,0
AA050,7002,"ALEXANDER / CHARLES",,45.44253,-75.691509,,,0
AA060,8766,"CRICHTON / CHARLES",,45.442222,-75.691219,,,0
AA070,7003,"CRICHTON / UNION",,45.441673,-75.689962,,,0
AA080,7005,"CRICHTON / UNION",,45.441706,-75.689527,,,0
private static String httpPost(String urlStr, String[] paramName, String[] paramValue) throws IOException {
//Create the header
URL url = new URL(urlStr);
HttpURLConnection conn =
(HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setDoInput(true);
System.setProperty("jsse.enableSNIExtension", "false");