I'm looking for advice. I have been playing with Konfabulator which
embeds SpiderMonkey (apparently using the JavaScript 1.5 api) for
scripting "widgets" - various bits of eye candy that sit on your
desktop.
One widget I would like to build is a display of a person's flickr
photostream. Flickr has a nice API, available via REST, XML/RPC, and
SOAP. I'd like to map the flickr API to javascript, having it do url
fetches and parsing the resultant XML results "behind the scenes", but
I don't want to manually create every function, especially since there
would be a huge amount of redundancy in doing so. The scheme
programmer in me immediately reaches for macros, but it does not appear
that JavaScript has macros. It does appear to have first-order
functions, so my gears are still turning.
So my idea is to build an array of function names (as strings), args
(as an array of objects), and xpath expressions (as strings) and
somehow dynamically generate the necessary functions at load time. I'm
a bit stumped on how to get these functions to be available at the top
scoping level. I'm going to sit down with the ECMAScript ed. 3 spec
tonight, but, again, am interested in general advice.
Does anyone have any suggestions on a) how to do this or even better b)
other, better ideas on making this REST api available seamlessly via
JavaScript? 1 1652 jk******@gmail. com wrote: I'm looking for advice. I have been playing with Konfabulator which embeds SpiderMonkey (apparently using the JavaScript 1.5 api) for scripting "widgets" - various bits of eye candy that sit on your desktop.
One widget I would like to build is a display of a person's flickr photostream. Flickr has a nice API, available via REST, XML/RPC, and SOAP. I'd like to map the flickr API to javascript, having it do url fetches and parsing the resultant XML results "behind the scenes", but I don't want to manually create every function, especially since there would be a huge amount of redundancy in doing so. The scheme programmer in me immediately reaches for macros, but it does not appear that JavaScript has macros. It does appear to have first-order functions, so my gears are still turning.
I understand little of what you're saying, but I gather that you need
to either use a small number of functions to perform lots of tricks but
have a large number of names, or logically create a large number of
functions to each do a single, slightly different trick?
well...
Synopsis:
x = function ( arg1, arg2 ) {
// a function that does a large number of things, depending on args
}
y = x; // What's in a name?
z = x; // Just a reference, really.
x = 'code' +
'more code' +
'even more code!';
y = new Function( 'arg1', 'arg2', x );
z = new Function( 'arg1', x + 'still more code' );
So my idea is to build an array of function names (as strings), args (as an array of objects), and xpath expressions (as strings) and
Don't know what an xpath is, but hey-- why use an array of function
names (as strings) when you can use an array of functions (as
references)?
x = [
function ( args ) { /* things that we do */ },
function ( args ) { /* other things that need doing */ },
function ( args ) { /* so much to do... */ }
];
x[0]( args ); // things that we do
x[1]( args ); // other things that need doing
somehow dynamically generate the necessary functions at load time. I'm a bit stumped on how to get these functions to be available at the top scoping level. I'm going to sit down with the ECMAScript ed. 3 spec tonight, but, again, am interested in general advice.
See Synopsis above.
Does anyone have any suggestions on a) how to do this or even better b) other, better ideas on making this REST api available seamlessly via JavaScript?
Don't know the API, but hopefully the Synopsis helps.
It occurs to me that you might be trying to call functions in the API
by using same-named functions in JS.
REST = {
call: function ( fname, fargs ) {
// do the call for fname using fargs
// however it is that REST actually does these things
// Use other properties of your new REST object as needed
}
}
REST.call( 'get', [ thing1, thing2 ] );
Hopefully that helped you in some way. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Richard Shea |
last post by:
Hi - Is there a tool available which given a set of PHP scripts will
analyse them and show you which function is called by which other
function ? I'm looking for something which would allow me to see all
the functions which call foo().
I feel like I've seen the output of something like this but I can't
think where.
thanks
|
by: Edward Patrick |
last post by:
Hello,
I would like to have one servlet serve all requests that do not
require any "processing". For example, CSS's, JPG's, etc.
I know I can accomlish this with an entry in WEB.XML:
<servlet-mapping>
<servlet-name>ForwardServlet</servlet-name>
<url-pattern>*.css</url-pattern>
|
by: Nicola Mingotti |
last post by:
Hi ,
I obtained this result :
------
>>> '1' > 1
True
------
with python2.2.3 and 2.3.3 .
(Yes , in python 2.2 i get 1 instead of True)
|
by: Heejeong Lee |
last post by:
I am going to begin following project
Description of the project:
One of the proposed ways of storing XML is to "shred" the structure of
the XML document and
insert it into a relational DBMS. To do this, I will consider the
query
workload over the XML document. The purpose of this project is to
|
by: Tommy |
last post by:
I'm new to database design and management. I'm presently taking a
course in this area. At the moment I just wanted to know when you have
the following relationship:
Entity 1 <---Relationship----> Entity 2 Integrity Contraint is 1 to N
from Entity 1 to Entity 2
Then you would have to include the primary key of Entity 1 to Entity 2.
So effectively Entity 2 would have a foreign key for Entity 1 ? What
would be the primary key for Entity...
| |
by: Mike Strieder |
last post by:
How can i get the text of the System.Type e.g. "base64Binary" from the .Net
type "byte"
I can not found any Function to give back this Schematype as string.
thx for your help
|
by: myeates |
last post by:
Hi
Anyone ever done this? It looks like Python2.4 won't take a length arg
Mathew
|
by: Electric Co. |
last post by:
Hello,
note: This is for a Faculty web site that is undergoing a migration to
an open source solution so my motives are legit.
I need to build a relay from IIS handling URL_A to a PHP server
(URL_B), get the content from the PHP server (if it exists) and then
serve it out via IIS. If the content does not exist then I need to
pass the request through to the IIS server and serve the pages from
there. All of this needs to be done...
|
by: David Thielen |
last post by:
Hi;
I have a small XML file that I need to read/change from my app. Is
there some easy way to map from XML to my objects so I can just read
it in to my objects, change the objects as needed, then write the
whole thing back out?
thanks - dave
david@at-at-at@windward.dot.dot.net
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |