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
package controllers; | |
import java.util.ArrayList; | |
import org.zkoss.zk.ui.Component; | |
import org.zkoss.zk.ui.util.GenericForwardComposer; | |
import org.zkoss.zul.ListModelList; | |
import org.zkoss.zul.Listbox; | |
import org.zkoss.zul.Listcell; | |
import org.zkoss.zul.Listitem; |
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 defined('BASEPATH') OR exit('No direct script access allowed'); | |
/** | |
* Example | |
* | |
* This is an example of a few basic user interaction methods you could use | |
* all done with a hardcoded array. | |
* | |
* @package CodeIgniter | |
* @subpackage Rest Server |
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
<? | |
// Encrypt Function | |
function mc_encrypt($encrypt, $mc_key) { | |
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); | |
$passcrypt = trim(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $mc_key, trim($encrypt), MCRYPT_MODE_ECB, $iv)); | |
$encode = base64_encode($passcrypt); | |
return $encode; | |
} | |
// Decrypt Function |
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
$(document).ready(function () { | |
$.ajax({ | |
type: "GET", | |
url: "http://localhost/MyRESTService/ProductRESTService.svc/GetProductList/", | |
dataType: "xml", | |
success: function (xml) { | |
$(xml).find('Product').each(function () { | |
var id = $(this).find('ProductId').text(); | |
var name = $(this).find('Name').text(); | |
var price = $(this).find('Price').text(); |
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
$.ajax( { | |
url : '/model/user.json', | |
dataType : 'json', | |
beforeSend : function(xhr) { | |
var bytes = Crypto.charenc.Binary.stringToBytes(username + ":" + password); | |
var base64 = Crypto.util.bytesToBase64(bytes); | |
xhr.setRequestHeader("Authorization", "Basic " + base64); | |
}, | |
error : function(xhr, ajaxOptions, thrownError) { | |
reset(); |
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
$("#myButton").click(function() { | |
var artistURL = "http://development.dlwelch.com/examples/restservice/JazzArtists.svc/json/Shirley"; | |
var returnData = ""; | |
$.ajax({ | |
type: "GET", | |
dataType: "json", | |
async: true, | |
url: artistURL, | |
error: function(request, status, error) { alert(request.responseText) }, | |
success: function(data) { |
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
import os | |
import json | |
json_data = open("trayek_data.json").read() | |
print json_data | |
data = json_load(json_data) | |
json_data = open("trayek_data.json") | |
data = json.load(json_data) | |
jsondata = json_data.read() | |
jsondata | |
json_data = open("trayek_data.json") |
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
import requests | |
def upload_file_to_gcs(): | |
url = 'http://127.0.0.1:8500/save-data-to-gcs/' | |
f = {'file': ('Product_Master.csv', open('C:/Projects/bf/Product_Master.csv', 'rb')), 'file_name': 'Product_Master.csv'} | |
r = requests.post(url, files=f) | |
print r | |
upload_file_to_gcs() | |
def save_data_to_gcs(request): |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
<title>Tornado Upload Application</title> | |
</head> | |
<body> | |
<p><h1>Tornado Upload App</h1></p> | |
<form enctype="multipart/form-data" action="/upload" method="post"> | |
File: <input type="file" name="file1" /> |
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
import tornado.httpserver, tornado.ioloop, tornado.options, tornado.web, os.path, random, string | |
#Actually we didn't need this class | |
class Application(tornado.web.Application): | |
def __init__(self): | |
handlers = [ | |
(r"/", IndexHandler), | |
(r"/upload", UploadHandler) | |
] | |
tornado.web.Application.__init__(self, handlers) |
OlderNewer