function returnhighest(input) {
var donothing = 0
var temp = 0
var highest = 0
for (var i=0;i < idtotalarray.length;i++) { input == idrarray[i] ? temp=idtotalarray[i] : donothing=donothing
temp > highest ? highest=temp : donothing=donothing }
return highest
}
small code
Thursday, July 2, 2009
javascript return highest
Tuesday, June 30, 2009
Select option list access with Javascript
function populateselection(input) {
for (i=0;i < input.options.length; i++)
{ input.options[i].selected ? chosenoption=input.options[i].value : donothing=donothing }
window.status=chosenoption
}
<form name="selectinterface">
<select name="refererselect" onchange="populateselection(selectinterface.refererselect)">
<option name="topreferer" value="nothing">view stats per referer</option>
{% for referer in refererlist %}
<option name="{{ referer }}" value="{{ referer }}">{{ referer }}</option>
{% endfor %}
</select>
</form>
Saturday, April 18, 2009
Great narrative on compression
"Designing an embedded language requires two steps: first, design the language that'll allow you to express the things you want to express, and second, implement a processor, or processors, that accepts a "program" in that language and either performs the actions indicated by the program or translates the program into Common Lisp code that'll perform equivalent behaviors.
So, step one is to design the HTML-generating language. The key to designing a good domain-specific language is to strike the right balance between expressiveness and concision. For instance, a highly expressive but not very concise "language" for generating HTML is the language of literal HTML strings. The legal "forms" of this language are strings containing literal HTML. Language processors for this "language" could process such forms by simply emitting them as-is.
(defvar *html-output* *standard-output*) (defun emit-html (html) "An interpreter for the literal HTML language." (write-sequence html *html-output*)) (defmacro html (html) "A compiler for the literal HTML language." `(write-sequence ,html *html-output*))
This "language" is highly expressive since it can express any HTML you could possibly want to generate.1 On the other hand, this language doesn't win a lot of points for its concision because it gives you zero compression--its input is its output.
To design a language that gives you some useful compression without sacrificing too much expressiveness, you need to identify the details of the output that are either redundant or uninteresting. You can then make those aspects of the output implicit in the semantics of the language.
For instance, because of the structure of HTML, every opening tag is paired with a matching closing tag.2 When you write HTML by hand, you have to write those closing tags, but you can improve the concision of your HTML-generating language by making the closing tags implicit."
Sunday, April 12, 2009
Thursday, March 5, 2009
Sunday, March 1, 2009
Statistically Improbable Phrases within a CMS
Look at http://sip.s-anand.net/ for reference on what a Statistically Improbable Phrase is, and it has an immediate and fun way to play with the concept.
Here is my idea for a kind of Content Management System, with companies that make standardized widgets as the best use scenario.
The company's product names, model numbers, prices, and other specifics are recorded as the text corpus. In all data entry, even email composing, the live typing is compared to the corpus. A tag cloud with oddest words shown in high contrast is ever present in a box near the data entry.
Corpora could have various granularities. Speaking in extremes of large and small, a corpus of all (or almost all) company online dialogue is a large example, and a corpus of model names/numbers/prices could be a tiny corpus example.
I am not talking about Natural Language processing, although that could be more complex implementation of this role. I'm thinking more of a spellchecker data entry police that plugs all corporate dialogue into itself to show anomalous input. The easiest example is with a model number 5100AGT, I am writing an email and type 51000AGT, it shows up as anomalous.
The interesting place all this goes is A.I.-ish. The machine sees when the company is staying within behavioral bounds, and when the company is deviating from a norm. Example: the company normally does business in the midwest region around Chicago. Flights and hotels are regularly booked in Lansing, Minneapolis, and Milwaukee. The first trip by sales staff to Los Angeles stands out as a deviance from the norm, and in human terms can be expressed as gains in market territory. Funny: note that A.I. should only check sales trips with sales trips. The legal team suddenly traveling outside the normal sphere is not a sign of increased markets, but a sign of possible larger legal problems.
This is not to deprecate the humble and effective selection menu. Very narrow data entry tasks are fully served by these menus. This SIP idea is more for the open end of company dialogue, where language is a little more natural but still redundant.
I may be showing my ignorance more than my brilliance in this post. Google has long had the Google Search Appliance (GSA). A really smart company would have already cobbled together a CMS hack on top of the GSA service.