Skip to content

Instantly share code, notes, and snippets.

View cfjedimaster's full-sized avatar
😺
Happy, and tired.

Raymond Camden cfjedimaster

😺
Happy, and tired.
View GitHub Profile
<cfparam name="url.id" default="">
<cfset artService = new art()>
<cfset art = artService.getArt(url.id)>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
component {
public struct function getArt(required numeric id) {
var q = new com.adobe.coldfusion.query();
q.setDatasource("cfartgallery");
q.setSQL("select artid, artname, description, price, issold, largeimage from art where artid = :artid");
q.addParam(name="artid", value=arguments.id, cfsqltype="cf_sql_integer");
var result = q.execute().getResult();
//convert the Query into a simple structure
var art = {id=result.artid[1], name=result.artname[1], description=result.description[1], price=result.price[1], sold=result.issold[1], image=result.largeimage[1]};
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Art Lister</title>
<link rel="stylesheet" href="css/jquery.mobile-1.1.0.min.css" />
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/jquery.mobile-1.1.0.min.js"></script>
$("#indexPage").live("pageinit", function() {
console.log("Getting remote list");
$.mobile.showPageLoadingMsg();
$.get("http://localhost/testingzone/phonegaptests/conversion/service/artservice.cfc?method=getArtList&returnformat=json", {}, function(res) {
$.mobile.hidePageLoadingMsg();
var s = "";
for(var i=0; i<res.length; i++) {
s+= "<li><a href='detail.html?id=" + res[i].id + "'>" + res[i].name + "</a></li>";
}
$("#artList").html(s);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="css/jquery.mobile-1.1.0.min.css" />
<script src="js/jquery-1.7.2.min.js"></script>
$("#detailPage").live("pageshow", function() {
var page = $(this);
var query = page.data("url").split("?")[1];
var id = query.split("=")[1];
console.log("Getting remote detail for "+id);
$.mobile.showPageLoadingMsg();
$.get("http://localhost/testingzone/phonegaptests/conversion/service/artservice.cfc?method=getArt&returnformat=json", {id:id}, function(res) {
$.mobile.hidePageLoadingMsg();
$("h1",page).text("Art: " + res.name);
var s = "<p>" + res.description + "</p>";
Answered Questions (45)
--------------------------
1. Crystal McDonald: What would cause a default set up not to produce a www folder where you are creating an app for testing?
* Andrew Trice: If you are on iOS in Xcode, the folder gets created automaticlaly, but you have to add it to your project manually. Right click on the project, then select "Add Files"
2. Mikel: I ran across a interesting issue the other day. Is there a way to tell device functionality? I want to show phone numbers for devices that have that capability and not show them for other devices. I was going to make a "table" edition and a "phone" edition but some tablets have phone capabilities.
* Ray Camden: I think there are a couple of answers to this. One is to use what you would on the desktop - feature detection using JavaScript. You can also use the Device 'struct' you get via the PhoneGap api to detect ios versus Android for example. But in general, I'd lean towards JS feature detection.
* Andrew Trice: There is no phonegap API me
Andrew Trice:Hi everyone, we'll be starting at 2:00 EST (in about 13 minutes)
Andrew Trice:Remember to enter questions in the "Questions" panel
Andrew Trice:We're going to start out purely with the "Questions" panel, there will not be an audio
Andrew Trice:*any* audio
Mikel:Will we be able to get a archive of the chat for future reference?
Ray Camden:While we aren't officially starting yet - feel free to put in some Questions (in the panel of
course)
Andrew Trice:yes
Ray Camden:hey Chad - no need to raise your hand :) use the Questions panel
Andrew Trice:Feel free to enter questions at any time
var thisDir = FileUtils.getNativeBracketsDirectoryPath() + "/" + module.uri.replace('main.js', '');
NativeFileSystem.requestNativeFileSystem(thisDir,
function (rootEntry) {
rootEntry.getFile("config.js", {}, function (fileEntry) {
console.log("in get file");
fileEntry.file(function (file) {
var reader = new FileReader();
reader.onloadend = function(e) {
console.log("in the end");
//alert(this.result);
var fullPath = FileUtils.getNativeBracketsDirectoryPath() + "/" + module.uri.replace('main.js', 'config.js');
var fileEntry = new NativeFileSystem.FileEntry(fullPath);
FileUtils.readAsText(fileEntry)
.done(function (text, readTimestamp) {
try {
try {
var config = JSON.parse(text);
var directory;
//Look for any marker of a non relative path
if (config.dataDirectory.indexOf("/") != -1 || config.dataDirectory.indexOf("\\") != -1) {