faceted search outline, read alt text for description.
I will add details to this post later.
faceted search outline, read alt text for description.
I will add details to this post later.
Here is a very high-level plan for my schedule for my new try at the faceted search. More fine-grained plan to come.
Week 2, 3, 4: “backend” functionality programming
Week 5, 6, 7: “frontend” GUI programming
Week 8, 9, 10, 11: documentation, debugging
I am still working on the faceted search system. However, I realized a completely different way to implement it. tl;dr it was a plan made by another developer for LMSAL that I initially didn’t understand but now do.
Good part: I know I am learning
Bad part: I am yet even more delayed by throwing away the original plan
updated updated plan coming soon!
* learning from stupid mistakes
* LOTS of mistakes = LOTS of time wasted.
* also LOTS of learning
* wasn’t taking JavaScript seriously
* I need to do more high-level design
source code, base_set.js:
/*
* base_set.js
*This is to represent a base set for Diamond faceted search.
*It represents a set of solar events that can be described by a HEK API URL.
*coded by Ian Ruotsala
*
*I use Yahoo's YUI library to parse the JSON into JavaScript Object.
*copyright info for YUI here: http://developer.yahoo.com/yui/license.html
*tl;dr: it's a BSD copyleft sorta thing
*--Ian Ruotsala, Mar. 8, 2010
*/
/*should be able to:
* report various details about the set it reps,
* e.g. count of various events. BUT, what if
* base_set doesn't do much besides hold info,
* and the root set, or super set or whatever
* does most of the work??? Yeah, I think that's
* a better idea, will put that burden on super
* sets and root sets
*--ICR, Feb. 15, 2010
*/
/*well, damn, that means base_set is actually
* very nearly done, just need to check if >200
* events returned
* --ICR, Feb. 15, 2010
*/
/*
* base_set.js finally working like I want it,
* --ICR, Mar. 5, 2010
*/
function base_set(url){
//should I also have an assemble_url???
//no, I'd save that for the root_set --ICR, Feb. 15, 2010
//what if url described over 200 events???
/*probably should just make super set by
* dividing set into two, then ANDing
* them into super set
* --ICR, Feb. 15, 2010
*/
this.url = url;
//I also need to store the JSON
var jsonDoc;
this.update_set = update_set;
this.set_url = set_url;
}
function update_set(){
//send present url to query, update the stored JSON
var httpQuery = new XMLHttpRequest();
httpQuery.open("GET",this.url,false);
httpQuery.send(null);
var returnString = httpQuery.responseText;
document.write(typeof(returnString));
var returnObj = YAHOO.lang.JSON.parse(returnString);
document.write(typeof(returnObj));
this.jsonDoc = returnObj;
//return true if >= 200 events returned
if (returnObj.result.length >= 200){
return true;
}
return false;
}
function set_url(url_string){
this.url = url_string;
}
function test(){
/*
*outputs: "foo test_urlbarhekbazstringobjectfoo1objectobject97bar1"
*/
test_bs = new base_set("test_url");
document.write("foo\n");
document.write(test_bs.url);
document.write("bar");
test_bs.set_url("hek");
document.write(test_bs.url);
document.write("baz");
test_bs.update_set();
document.write("foo1");
//test to see how many events are gotten
//i.e. how many items in jsonDoc.result?
document.write(typeof(test_bs.jsonDoc));
document.write(typeof(test_bs.jsonDoc.result));
document.write(test_bs.jsonDoc.result.length);
document.write("bar1");
}
I made the mistake early in this project of not taking JavaScript seriously. As if it weren’t actually a programming language. I have suffered from this mistake. I am learning more and more about this language (and web programming in general), which is a very good thing; but I learn from making many many mistakes, mistakes which eat up more of my very limited time.
This past week I finally finished up the base_set. I started looking at what I want for root_set, but realized there is yet more I need to learn about JavaScript, e.g. how to interact with GUIs, how to do the prototype object programming, etc.
Summary: behind schedule, .5 week
*project rebooted
*JS learning curve not as shallow as I thought
*haven’t been able to be as squared-away as I would prefer
*faceted search now only objective
*still drawing out new plan
-root_set.js: will hold the description of the current set. Will interact with GUI, will report various details of the set
-super_set.js: instances of these will mediate between root_set and the various base_set’s. Will form a binary tree with root_set at the root, base_set’s as leaves. Instances of super_set will be nodes with operators such as booleans (AND, OR, NOT, etc), or restrictions such as “All flares in Set A that are brighter than the median flare brightness in Set A”
-base_set: holds sets that can be represented by the HEK API
/*
* base_set.js
*This is to represent a base set for Diamond faceted search.
*It represents a set of solar events that can be described by a HEK API URL.
*coded by Ian Ruotsala
*/
/*should be able to:
* report various details about the set it reps,
* e.g. count of various events. BUT, what if
* base_set doesn't do much besides hold info,
* and the root set, or super set or whatever
* does most of the work??? Yeah, I think that's
* a better idea, will put that burden on super
* sets and root sets
*--ICR, Feb. 15, 2010
*/
/*well, damn, that means base_set is actually
* very nearly done, just need to check if >200
* events returned
* --ICR, Feb. 15, 2010
*/
//import external .js files for this file to use
function inc(filename)
{
var body = document.getElementsByTagName('body').item(0);
script = document.createElement('script');
script.src = filename;
script.type = 'text/javascript';
body.appendChild(script);
}
inc("json.js");
function base_set(url){
//should I also have an assemble_url???
//no, I'd save that for the root_set --ICR, Feb. 15, 2010
//what if url described over 200 events???
/*probably should just make super set by
* dividing set into two, then ANDing
* them into super set
* --ICR, Feb. 15, 2010
*/
this.url = url;
//I also need to store the JSON
var jsonDoc;
this.update_set = update_set;
this.set_url = set_url;
}
function update_set(){
//send present url to query, update the stored JSON
var httpQuery = new XMLHttpRequest();
httpQuery.open("GET",this.url,false);
httpQuery.send(null);
//this.jsonDoc = eval('(' + httpQuery.responceText + ')');
//eval is generall considered bad practice, security risk
//use parseJSON instead
var returnString = httpQuery.responseText;
//document.write(returnString);
this.jsonDoc = returnString.parseJSON;
//return true if >= 200 events returned
}
function set_url(url_string){
this.url = url_string;
}
function test(){
test_bs = new base_set("test_url");
document.write("foo\n");
document.write(test_bs.url);
document.write("bar");
test_bs.set_url("hek");
document.write(test_bs.url);
document.write("baz");
test_bs.update_set();
document.write("foo1");
//document.write(test_bs.jsonDoc);
//var test_comp = test_bs.jsonDoc.result[0].kb_archivid;
//test_comp
//document.write(test_bs.stringify(test_comp));
//document.write("bar1");
//test to see how many events are gotten
//i.e. how many items in jsonDoc.result?
document.write("bar1");
}
So, the last two days I’ve successfully and happily gotten back on track with the faceted search thing. I’m coming along swimmingly, hope to continue this trend for the rest of the project. Think, especially, JavaScript/web programming has a bit of a learning curve, not as bad as say, C, but still there. I am still somewhat of a newbie programmer. Updated task schedule shall be forthcoming.
I just realized a stupid mistake I had been commiting up to now: I had been attempting to use XMLHttpRequest to try to get the JSON docs off the LMSAL server. I totally missed this one fine point: “For security reasons, modern browsers do not allow access across domains.” I’ve wasted days trying to “debug” this. I was getting discouraged by it all, now I just feel stupid. Stupid, stupid, stupid.
status: BEHIND SCHEDULE, 2 WEEKS
Sluggish week, accomplished very little. Feel like I need to reboot this entire quarter.
status: BEHIND SCHEDULE, 1 WEEK