Where to put javascript as global function
Hi,
Most of threads i read (which have simple javascript codes), the codes are written in 'HTML HEADER' on each pages and later can be call by items or else. If i have the same javascript but is used by many pages, so far my understanding is i have to duplicate the code on each pages. So my question is, where can i write the javascript in apex so it can be called by many pages ? ('Global' function).
Thanks
Gamez
Hello,
It looks like your confusing a couple concepts.
Oh i see, i thought theres something like 'Application Process' where people can put some code inside.If your build AJAX functionality the easiest way to do it in APEX is using PL/SQL code in Application OnDemand Process.
Andy, since i also totally new in java, what SIMPLE tool to use for compiling the script ? (need to compile?).In APEX you don't use java you use javascript and you don't need a compiler. Since your just starting out with javascript you should spend an hour or two at this site [http://www.w3schools.com/JS/default.asp]. It will save you countless hours in the future and is applicable in any web development environment.
Martin, i'v created Page 0, but i dont see any place to put the javascript inside the page. Theres no kinds of HTML Header/Footer/Body where i can put it.So to your main question what is the best place to put a global javascript. There are four answers and I will put them in order from best to worse.
1. In an external javascript file included in you page template between the head tags.
2. In an external javascript file included in Page 0, put it in a HTML Region with No Template in the After Header region position.
3. In an inline script section in the page template between the head tags.
4. In an inline script section in the page template between the head tags in Page 0, put it in a HTML Region with No Template in the After Header region position.
PS. I'm not kidding about the w3schools link it will save you hours!
Regards,
Carl
Similar Messages
-
Where to put javascript code?
Hello,
I am trying to set some columns in a list as "read-only" and is using the following code:
<script type=”text/javascript”>
function SetReadOnly()
var elements=document.getElementById(’4_ctl00_ctl00_TextField’);
elements.readOnly=true;
_spBodyOnLoadFunctionNames.push(“SetReadOnly()”);
</script>
But I am not sure where to put the code in. Should I put it in the space in Content Editor Web Part,
or through a link to a txt file, or in "Edit HTML"? I've tried them but none works.
Thanks a lot!
PatrickYou can try this:
1) Open your Sharepoint List. Go to List edit view.
2) On right side of Ribbon you will find "Form Web Parts" option as shown in figure.
3) Choose your List form which you want to edit.
4) Now you can add web part in new window.
5) Add Content Editor Web part.
6) In content editor web part add the path of your "txt" file in which you have written your script, for eg.
<!DOCTYPE html>
<html>
<body>
<script type=”text/javascript”>
function SetReadOnly()
var elements=document.getElementById('4_ctl00_ctl00_TextField');
elements.readOnly=true;
_spBodyOnLoadFunctionNames.push("SetReadOnly()");
</script>
</body>
</html>
I haven't tried this method so I am not sure but hope it works...:D
***If my post is answer for your query please mark as answer***
***If my answer is helpful please vote*** -
Where to put javascript?
Following suggestions on this forum I put some javascript functions in the header part of my theme. This somehow doesn't seem right.
1) Once you switch theme your app. stops working.
2) Themes should be about the look of your app. and not about the functioning of it.
So, what is a good place to put it?
thanks ReneBut where do I put javascript functions that I want to use on more than 1 page?
-
Where to put javascript files.
I am working in Apex 4.0.
I have found javascript code titled accounting.js. It is available at http://josscrowcroft.github.com/accounting.js/
The instruction on use of the code are as follows:
"Download the script and put it somewhere, then do this:
<script src="path/to/accounting.js"></script>
<script type="text/javascript">
// You can do this now:
accounting.formatMoney(5318008);
</script>"
The accounting.js file is over 30,000 characters. Where do I put it so that I can reference it from any page in my application?
Then what do I need to do on a page where I want to use it?You have two options. Both involve modifying your page template to include the file, but you have options on where to place the file.
1) Place it in the images folder in your application server, and refer to it using the IMAGE_PREFIX substitution string
<script src="#IMAGE_PREFIX#accounting.js" type="text/javascript"></script>2) Upload it into your Apex repository as a workspace file (Shared Components -> Static Files) and access it from the database.
<script src="#WORKSPACE_IMAGES#accounting.js" type="text/javascript"></script>Scott -
Where to put javascript file?
I currently have my javascript file in 'ViewController\public_html' of my project. Do I have to specify the entire file path to see the iuid.js file?
<script src="iuid.js"></script>
<script language="JavaScript">
ThanksAssuming you are using adf faces, we have something like the following structure for our js files:
ViewController\public_html\js
the corresponding script files will be included by inserting the following code after <afh:html> start tag:
<afh:script source="/js/myJSfile.js"/> -
Where to put custom function at?
Let's say I make a custom function, do I make it a CFC or a tag?
Here is some sample code (I put in bold my function call)
<cfif IsDefined("form.submit")>
<cfset data.comment = Trim(HTMLEditFormat(form.comment))>
<cfset data.name = Trim(REReplace(form.name, "[^A-Za-z0-9 ]", "", "all"))>
<cfset data.location = Trim(CustomFunction(form.location))><!--- where to put it? as cfc or as a tag? --->
<cfif data.comment NEQ "">
<cfif data.name EQ "">
<cfset data.name = "Anonymous">
</cfif>
<cfinvoke
component="guestbook.cfc.db"
method="insert_comment">
<cfinvokeargument name="form_data" value="#data#"/>
</cfinvoke>
<cfelse>
<cfset message="Comment is required!">
</cfif>
</cfif>Custom tags are different than udfs. Let's stick with udfs. Your location choices are:
1. If only one template is going to use it, you can put it in that template. Otherwise,
2. You can put it in a .cfm file and cfinclude that file whenever you want to call the function, or
3. You can put it into a .cfc.
A little while back, someone ran some tests and posted the results on one of these forums. The gist of it was that Option 2 would run faster than Option 3. -
How to write global functions?
Hi,
I have some functionality in my app that I feel will be used
in multiple places. Typically in HTML/Javascript I could do:
<script type="Javascript"
src="js/functions.js"></script>
In the functions.js file I could have various functions and
call them from any display page.
How can I have a set of functions like this in
Flex/ActionScript? For example I have a couple of places where a
user can "Add an Employee" for example. I'd like to call the same
function.
How can I globally include some functions so they can be
called from anywhere in my application.
-Westside2 things:
instead of doing
<mx:Script>
<![CDATA[
functions here...
]]>
</mx:Script>
make a new actionscript file, code.as or whatever you want to
call it.
then you can do <mx:Script source="code.as"/> and put
your actionscript code inside the file like you would inside of
CDATA.
also, SharedObjects are useful for sharing variables between
different mxml files.
they go something like this:
public var sharedVariables:SharedObject =
SharedObject.getLocal("variables");
(this will need to be decalred in each script)
to set or retrieve a value you do this:
sharedVariables.data.myVariable = new String();
sharedVariables.data.myVariable = 'string here';
on a further note: SharedObjects are written to the local
file system, the user's/client's file system, useful if you need to
store keep settings for a user or something like that. Also,
getLocal will create the file if it doesn't exsist already, if it
does.. it just reads it. Read the docs on SharedObject.
you will probably find those 2 things useful if you dont
already know about them. -
Where to put js that should show on every page, like Appex have?
In every page header there are entry like:
<+html lang="hr" xmlns:htmldb="http://htmldb.oracle.com">
<+head>
<+script src="/i/javascript/htmldb_html_elements.js" type="text/javascript"></script>
<+script src="/i/javascript/htmldb_get.js" type="text/javascript"></script>
<+script language="JavaScript" type="text/javascript">
<+!--
/*Global JS Variables*/
+var htmldb_Img_Dir = "/i/";1) I would like to know where to put some of my js to be loaded automatically on every page regardless current theme (like in above example).
2) If I want to some js be shown on template based filter.
What is bothering me is that i would like to put some js on every page where for instance report template is loaded...what is the best way for that?
THX!Hello,
If you only want it to load on pages with a certain template on way to do it just put the link into the footer of the template itself.
So the end of you report template would look like
....</table>
<script src="/i/mystuff/my.js" type="text/javascript"></script>
It doesn't make for the best html code but the effect is what you want without having to do any conditions or run a separate page template or do to much on a bunch of different pages.
Carl -
All of a sudden yesterday I can no longer click the star twice to tell it where to put the bookmark, and even when I click it once it doesn't save the bookmark anywhere. Also many of my toolbar bookmarks are now suddenly missing. I've tried to restore bookmarks and it says it's unable to perform that function. Help!
You can check for problems with the <b>places.sqlite</b> database file in the Firefox profile folder.
*http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox
*https://support.mozilla.org/kb/Bookmarks+not+saved#w_fix-the-bookmarks-file
*Places Maintenance: https://addons.mozilla.org/firefox/addon/places-maintenance/ -
Where to put the commit in the FORALL BULK COLLECT LOOP
Hi,
Have the following LOOP code using FORALL and bulk collect, but didnt know where to put the
'commit' :
open f_viewed;
LOOP
fetch f_viewed bulk collect into f_viewed_rec LIMIT 2000;
forall i in 1..f_viewed_rec.count
insert into jwoodman.jw_job_history_112300
values f_viewed_rec(i);
--commit; [Can I put this 'commit' here? - Jenny]
EXIT when f_viewed%NOTFOUND;
END LOOP;
commit;
Thanks,
- Jennymc**** wrote:
Bulk collect normally used with large data sets. If you have less dataset such as 1000-2000 records then you canot get such a performance improvent using bulk collect.(Please see oracle documents for this)
When you update records Oracle acquire exclusive lock for that. So if you use commit inside the loop then it will process number of records defined by limit parameter at ones and then commit those changes.
That will release all locks acquired by Oracle and also teh memory used to keep those uncommited transactions.
If you use commit outside the loop,
Just assume that you insert 100,000 records, all those records will store in oracle memory and it will affect all other users performance as well.
Further more if you update 100,000 records then it will hold exclusive lock for all 100,000 records addtion to the usage of the oracle memory.
I am using this for telco application which we process over 30 million complex records (one row has 234 columns).
When we work with large data sets we do not depends with the oracle basic rollback function. because when you keep records without commit itb uses oracle memory and badly slowdown all other processes.Hi mc****,
What a load of dangerous and inaccurate rubbish to be telling a new Oracle developer. Commit processing should be driven by the logical unit of a transaction. This should hold true whether that transaction involves a few rows or millions. If, and only if, the transaction is so large that it affects the size constraints of the database resources, in particular, rollback or redo space, then you can consider breaking that transaction up to smaller transactions.
Why is frequent committing undesirable I hear you ask?
First of all it is hugely wasteful of rollback or redo space. This is because while the database is capable of locking at a row level, redo is written at a block level, which means that if you update, delete or insert a million rows and commit after each individual statement, then that is a million blocks that need to go into redo. As many of these rows will be in the same block, if you instead do these as one transaction, then the same block in redo can be transacted upon, making the operation more efficient. True, locks will be held for longer, but if this is new data being done in batches then users will rarely be inconvenienced. If locking is a problem then I would suggest that you should be looking at how you are doing your processing.
Secondly, committing brings into play one of the major serialization points in the database, log sync. When a transaction is committed, the log buffer needs to be written to disc. This occurs serially for multiple commits. Each commit has to wait until the commit before has completed. This becomes even more of a bottleneck if you are using Data Guard in SYNC mode, as the commit cycle does not complete until the remote log is notified as written.
This then brings us two rules of thumb that will always lead a developer in the right direction.
1. Commit as infrequently as possible, usually at the logical unit of a transaction
2. When building transactions, first of all seek to do it using straight SQL (CTAS, insert select, update where etc). If this can't be easily achieved, then use PL/SQL bulk operations.
Regards
Andre -
JUnit, where to put my unit test
Hi all,
I have a question regarding unit test.
I am working on a project which has multiple packages. I need to unit test every package using JUnit. One question I have is where to put my unit test. The options are:
1. Write unit test as a separate package. This makes the code clear but only the public functions get tested or I have to make all functions public.
2. Write unit test in the same package of the code to be tested. This makes writing test easier but putting test and code together makes the structure dirty.
Please let me know your opinion and tell me how do you normally do this?
Many thanks,
Regards,
KevinIt sounds like you're probably a beginner, so this might be overkill, but here goes anyway: You might want to investigate Maven, which defines a standard directory structure that includes a test tree separate from the production tree, but yet still in the same overall folder. The beauty of this design is that you can keep both production & test code together in source control, IDE projects, etc. but they don't interfere with each other.
Even if you don't use Maven now, you might want to consider using their standard directory structure, as it is has stood the test of time, & would facilitate using Maven if you ever decide to in the future. -
Architecture question...where to put the code
Newbie here, so please be gentle and explicit (no detail is
too much to give or insulting to me).
I'm hoping one of you architecture/design gurus can help me
with this. I am trying to use good principals of design and not
have code scattered all over the place and also use OO as much as
possible. Therefore I would appreciate very much some advice on
best practices/good design for the following situation.
On my main timeline I have a frame where I instantiate all my
objects. These objects refer to movieClips and textFields etc. that
are on a content frame on that timeline. I have all the
instantiation code in a function called initialize() which I call
from the content frame. All this works just fine. One of the
objects on the content frame is a movieClip which I allow the user
to go forward and backward in using some navigation controls.
Again, the object that manages all that is instantiated on the main
timeline in the initialize() function and works fine too. So here's
my question. I would like to add some interactive objects on some
of the frames of the movieClip I allow the user to navigate forward
and backward in (lets call it NavClip) . For example on frame 1 I
might have a button, on frame 2 and 3 nothing, on frame 4 maybe a
clip I allow the user to drag around etc. So I thought I would add
a layer to NavClip where I will have key frames and put the various
interactive assets on the appropriate key frames. So now I don't
know where to put the code that instantiates these objects (i.e.
the objects that know how to deal with the events and such for each
of these interactive assets). I tried putting the code on my main
timeline, but realized that I can't address the interactive assets
until the NavClip is on the frame that holds the particular asset.
I'm trying not to sprinkle code all over the place, so what do I
do? I thought I might be able to address the assets by just
providing a name for the asset and not a reference to the asset
itself, and then address the asset that way (i.e.
NavClip["interactive_mc"] instead of NavClip.interactive_mc), but
then I thought that's not good since I think there is no type
checking when you use the NavClip["interactive_mc"] form.
I hope I'm not being too dim a bulb on this and have missed
something really obvious. Thanks in advance to anyone who can help
me use a best practice.1. First of all, the code should be:
var myDraggable:Draggable=new Draggable(myClip_mc);
myDraggable.initDrag();
Where initDrag() is defined in the Draggable class. When you
start coding functions on the timeline... that's asking for
problems.
>>Do I wind up with another object each time this
function is called
Well, no, but. That would totally depend on the code in the
(Draggable) class. Let's say you would have a private static var
counter (private static, so a class property instead of an instance
property) and you would increment that counter using a
setInterval(). The second time you enter the frame and create a new
Draggable object... the counter starts at the last value of the
'old' object. So, you don't get another object with your function
literal but you still end up with a faulty program. And the same
goes for listener objects that are not removed, tweens that are
running and so on.
The destroy() method in a custom class (=object, I can't
stress that enough...) needs to do the cleanup, removing anything
you don't need anymore.
2. if myDraggable != undefined
You shouldn't be using that, period. If you don't need the
asset anymore, delete it using the destroy() method. Again, if you
want to make sure only one instance of a custom object is alive,
use the Singleton design pattern. To elaborate on inheritance:
define the Draggable class (class Draggable extends MovieClip) and
connect it to the myClip_mc using the linkage identifier in the
library). In the Draggable class you can define a function unOnLoad
(an event fired when myClip_mc is removed using
myClip_mc.removeMovieClip()...) and do the cleanup there.
3. A destroy() method performs a cleanup of any assets we
don't need anymore to make sure we don't end up with all kinds of
stuff hanging around in the memory. When you extend the MovieClip
Class you can (additionally) use the onUnLoad event. And with the
code you posted, no it wouldn't delete the myClip_mc unless you
program it to do so. -
Where to put removeChild (Away3d 4.x)
Hey guys i need some help on how to change primitives and removing the previous primitive showing in the scene and also changing materials on the primitive with a click of a button.
Mainly just where to put removeChild.
This is for Away3d
package
import away3d.cameras.*;
import away3d.containers.*;
import away3d.controllers.*;
import away3d.core.base.SubGeometry;
import away3d.core.base.data.Vertex;
import away3d.debug.*;
import away3d.entities.Mesh;
import away3d.extrusions.*;
import away3d.filters.*;
import away3d.lights.*;
import away3d.materials.*;
import away3d.materials.lightpickers.*;
import away3d.materials.methods.*;
import away3d.primitives.*;
import away3d.textures.*;
import away3dplus.controllers.SimpleHoverController;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Vector3D;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
[SWF(backgroundColor="#000000",frameRate="30",quality="LOW")]
public class Main extends Sprite
//engine variables
private var view:View3D;
private var scene:Scene3D;
// debug
private var awayStats:AwayStats;
//light objects
private var pointLight:PointLight;
private var lightPicker:StaticLightPicker;
//material objects
private var redColorMaterial:ColorMaterial;
private var skyBoxCubeTexture:BitmapCubeTexture;
//Buttons
private var btnCube:Sprite = new Sprite
private var btnSphere:Sprite = new Sprite
private var btnCylinder:Sprite = new Sprite
private var btnTorus:Sprite = new Sprite
private var btnMaterial:Sprite = new Sprite
private var btnWireframe:Sprite = new Sprite
public function Main() {
init();
private function init():void {
initEngine();
initLights();
initCamera();
initMaterials();
initObjects();
initListeners();
drawButton()
btnCube.addEventListener(MouseEvent.CLICK, changeCube);
btnCube.x = 400;
btnCube.y = 25;
addChild(btnCube);
btnSphere.addEventListener(MouseEvent.CLICK, changeSphere);
btnSphere.x = 400;
btnSphere.y = 60;
addChild(btnSphere);
btnCylinder.addEventListener(MouseEvent.CLICK, changeCylinder);
btnCylinder.x = 400;
btnCylinder.y = 95;
addChild(btnCylinder);
btnTorus.addEventListener(MouseEvent.CLICK, changeTorus);
btnTorus.x = 400;
btnTorus.y = 130;
addChild(btnTorus);
//btnMaterial.addEventListener(MouseEvent.CLICK, changeMaterial);
btnMaterial.x = 15;
btnMaterial.y = 95;
addChild(btnMaterial);
btnWireframe.addEventListener(MouseEvent.CLICK, changeWireframe);
btnWireframe.x = 15;
btnWireframe.y = 130;
addChild(btnWireframe);
* Initialise the engine
private function initEngine():void {
//stage setup
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
// 3d view - window into 3d scene
view = new View3D();
addChild(view);
// 3d scene.
scene = view.scene;
// stats
awayStats = new AwayStats(view);
addChild(awayStats);
* Initialise the lights
private function initLights():void {
//point light
pointLight = new PointLight();
scene.addChild(pointLight);
lightPicker = new StaticLightPicker([pointLight]);
private function initCamera():void {
var hoverCameraManager:SimpleHoverController = new SimpleHoverController(view, 700, [pointLight]);
* Initialise Buttons
private function drawButton():void {
var textLabel:TextField = new TextField()
btnCube.graphics.clear();
btnCube.graphics.beginFill(0xFFFFFF); // white
btnCube.graphics.drawRoundRect(0, 0, 80, 25, 10, 10); // x, y, width, height, ellipseW, ellipseH
textLabel.text = "CUBE";
textLabel.x = 22;
textLabel.y = 4;
textLabel.selectable = false;
btnCube.addChild(textLabel)
var textLabel01:TextField = new TextField()
btnSphere.graphics.clear();
btnSphere.graphics.beginFill(0xFFFFFF); // white
btnSphere.graphics.drawRoundRect(0, 0, 80, 25, 10, 10); // x, y, width, height, ellipseW, ellipseH
textLabel01.text = "SPHERE";
textLabel01.x = 18;
textLabel01.y = 3;
textLabel01.selectable = false;
btnSphere.addChild(textLabel01)
var textLabel03:TextField = new TextField()
btnCylinder.graphics.clear();
btnCylinder.graphics.beginFill(0xFFFFFF); // white
btnCylinder.graphics.drawRoundRect(0, 0, 80, 25, 10, 10); // x, y, width, height, ellipseW, ellipseH
textLabel03.text = "CYLINDER";
textLabel03.x = 10;
textLabel03.y = 3;
textLabel03.selectable = false;
btnCylinder.addChild(textLabel03)
var textLabel04:TextField = new TextField()
btnTorus.graphics.clear();
btnTorus.graphics.beginFill(0xFFFFFF); // white
btnTorus.graphics.drawRoundRect(0, 0, 80, 25, 10, 10); // x, y, width, height, ellipseW, ellipseH
textLabel04.text = "TORUS";
textLabel04.x = 17;
textLabel04.y = 3;
textLabel04.selectable = false;
btnTorus.addChild(textLabel04)
var textLabel05:TextField = new TextField()
btnMaterial.graphics.clear();
btnMaterial.graphics.beginFill(0xFFFFFF); // white
btnMaterial.graphics.drawRoundRect(0, 0, 80, 25, 10, 10); // x, y, width, height, ellipseW, ellipseH
textLabel05.text = "MATERIAL";
textLabel05.x = 6;
textLabel05.y = 3;
textLabel05.selectable = false;
btnMaterial.addChild(textLabel05)
var textLabel06:TextField = new TextField()
btnWireframe.graphics.clear();
btnWireframe.graphics.beginFill(0xFFFFFF); // white
btnWireframe.graphics.drawRoundRect(0, 0, 80, 25, 10, 10); // x, y, width, height, ellipseW, ellipseH
textLabel06.text = "WIREFRAME";
textLabel06.x = 2;
textLabel06.y = 3;
textLabel06.selectable = false;
btnWireframe.addChild(textLabel06)
* Initialise the materials
private function initMaterials():void {
// red color
redColorMaterial = new ColorMaterial(0xFF0000, 0.8);
redColorMaterial.lightPicker = lightPicker;
skyBoxCubeTexture = new BitmapCubeTexture(new EnvPosX().bitmapData, new EnvNegX().bitmapData, new EnvPosY().bitmapData, new EnvNegY().bitmapData, new EnvPosZ().bitmapData, new EnvNegZ().bitmapData);
* Initialise the scene objects
private function initObjects():void {
var trident:Trident = new Trident(100);
trident.x = 0;
trident.y = 0;
scene.addChild(trident);
//Geometry - Geometry is a collection of SubGeometries, each of which contain the actual geometrical data such as vertices, normals, uvs, etc.
////PrimitiveBase - PrimitiveBase is an abstract base class for mesh primitives, which are prebuilt simple meshes.
//CubeGeometry A Cube primitive mesh.
var newCubeGeometry:CubeGeometry = new CubeGeometry(200, 200, 200, 50, 50, 50, true);
//SphereGeometry - A UV Sphere primitive mesh.
var newSphereGeometry:SphereGeometry = new SphereGeometry(50, 16, 12, true);
//CapsuleGeometry A UV Capsule primitive mesh.
var newCapsuleGeometry:CapsuleGeometry = new CapsuleGeometry(50, 100, 16, 12, true);
//ConeGeometry A UV Cone primitive mesh.
//var newConeGeometry:ConeGeometry = new ConeGeometry(50, 100, 16, 1, true, true);
//CylinderGeometry A UV Cylinder primitive mesh.
var newCylinderGeometry:CylinderGeometry = new CylinderGeometry(50, 50, 100, 16, 1, true, true);
//PlaneGeometry A Plane primitive mesh.
var newPlaneGeometry:PlaneGeometry = new PlaneGeometry(100, 100, 1, 1, true);
//RegularPolygonGeometry A UV RegularPolygon primitive mesh.
var newRegularPoligonGeometry:RegularPolygonGeometry = new RegularPolygonGeometry(100, 16, true);
//TorusGeometry A UV Torus primitive mesh.
var newTorusGeomentry:TorusGeometry = new TorusGeometry(50, 50, 15, 8, true);
// Entity - The Entity class provides an abstract base class for all scene graph objects that are considered having a "presence" in the scene,
// in the sense that it can be considered an actual object with a position and a size (even if infinite or idealised), rather than a grouping.
//Mesh - Mesh agregates instance of a Geometry, augmenting it with a presence in the scene graph, a material, and an animations tate.
// It consists out of SubMeshes, which in turn correspond to SubGeometries. SubMeshes allow different parts of the geometry to be assigned different materials.
//var cube:Mesh = new Mesh(newCubeGeometry, redColorMaterial);
//cube.x = 100;
//cube.y = 100;
//cube.z = 100;
//scene.addChild(cube);
//var sphere:Mesh = new Mesh(newSphereGeometry, redColorMaterial);
//sphere.x = -75;
//sphere.y = -150;
//scene.addChild(sphere);
//var capsule:Mesh = new Mesh(newCapsuleGeometry, redColorMaterial);
//capsule.x = -200;
//capsule.y = -150
//scene.addChild(capsule);
//var cone:Mesh = new Mesh(newConeGeometry, redColorMaterial);
//cone.x = -200;
//cone.y = 150;
//cone.showBounds = true;
//scene.addChild(cone);
//var cylinder:Mesh = new Mesh(newCylinderGeometry, redColorMaterial);
//cylinder.x = -75;
//cylinder.y = 150;
//scene.addChild(cylinder);
//var plane:Mesh = new Mesh(newPlaneGeometry, redColorMaterial);
//plane.x = -75;
//plane.y = 275;
//scene.addChild(plane);
//var poligon:Mesh = new Mesh(newRegularPoligonGeometry, redColorMaterial);
//poligon.x = -275;
//poligon.y = 275;
//scene.addChild(poligon);
//var torus:Mesh = new Mesh(newTorusGeomentry, redColorMaterial);
//torus.x = -275;
//scene.addChild(torus);
//SkyBox A SkyBox class is used to render a sky in the scene.
//var skyBox:SkyBox = new SkyBox(skyBoxCubeTexture);
//scene.addChild(skyBox);
// SegmentSet
//WireframeAxesGrid - Class WireframeAxesGrid generates a grid of lines on a given planeWireframeAxesGrid
//var wireFrameAxesGrid:WireframeAxesGrid = new WireframeAxesGrid(4, 400, 1);
//scene.addChild(wireFrameAxesGrid);
//WireframeGrid Class WireframeGrid generates a grid of lines on a given planeWireframeGrid
//var wireframeGrid:WireframeGrid = new WireframeGrid(10, 100, 5, 0x0000FF);
//wireframeGrid.x = 75;
//wireframeGrid.y = 275;
//scene.addChild(wireframeGrid);
//WireframePrimitiveBase
//WireframeCube - Class WireFrameGrid generates a grid of lines on a given planeWireFrameGrid
//var wireFrameCube:WireframeCube = new WireframeCube(100, 100, 100, 0x0000FF, 5);
//wireFrameCube.x = 75;
//scene.addChild(wireFrameCube);
//WireframeSphere - Class WireFrameGrid generates a grid of lines on a given planeWireFrameGrid
//var wireFrameSphere:WireframeSphere = new WireframeSphere(50, 16, 12, 0x0000FF, 5);
//wireFrameSphere.x = 75;
//wireFrameSphere.y = -150;
//scene.addChild(wireFrameSphere);
//WireframePlane
//var wireframePlane:WireframePlane = new WireframePlane(100, 100, 10, 10, 0x0000FF, 5);
//wireframePlane.x = 175;
//wireframePlane.y = 275;
//scene.addChild(wireframePlane);
* Initialise the listeners
private function initListeners():void {
addEventListener(Event.ENTER_FRAME, onEnterFrame);
* render loop
private function onEnterFrame(event:Event):void {
view.render();
* Intialise the buttons events
private function changeCube(event:MouseEvent):void {
var newCubeGeometry:CubeGeometry = new CubeGeometry(200, 200, 200, 50, 50, 50, true);
var cube:Mesh = new Mesh(newCubeGeometry, redColorMaterial);
cube.x = 100;
cube.y = 100;
cube.z = 100;
scene.addChild(cube);
private function changeSphere(event:MouseEvent):void {
var newSphereGeometry:SphereGeometry = new SphereGeometry(50, 16, 12, true);
var sphere:Mesh = new Mesh(newSphereGeometry, redColorMaterial);
scene.addChild(sphere);
private function changeCylinder(event:MouseEvent):void {
var newCylinderGeometry:CylinderGeometry = new CylinderGeometry(50, 50, 100, 16, 1, true, true);
var cylinder:Mesh = new Mesh(newCylinderGeometry, redColorMaterial);
scene.addChild(cylinder);
private function changeTorus(event:MouseEvent):void {
var newTorusGeomentry:TorusGeometry = new TorusGeometry(50, 50, 15, 8, true);
var torus:Mesh = new Mesh(newTorusGeomentry, redColorMaterial);
scene.addChild(torus);
private function changeWireframe(event:MouseEvent):void {
var wireFrameCube:WireframeCube = new WireframeCube(100, 100, 100, 0x0000FF, 5);
scene.addChild(wireFrameCube);
Thanks, MatthewFraudulent seller.
I received an empty package.- -
Back to the drawing board.
Thanks for your replies.
eBay is going through their required steps.
It will take a week or better to get my refund.
Thanks
Shopping for another "Mac Pro Late 2013" or I might settle for my "Mac Mini 2012 i7 16 Gig 256 SSD Intel 4000" refurb with warranty bought from Apple that I already have on hand.
Thank You
I don't know how this ended upon two threads.
I'm pretty sure I'm going to go with my 2012 Mac Mini i7 16 gig 256 SSD and Lacie Little Big Thunderbolt 1 512 SSD
That will be pretty punchy for me.
I'll only have about $1,000 in the computer itself with a three year Apple Care Warranty.
It should sell for $500 a year from now if I choose too.
I think it's going to work great.
I'm going to load it up with all of the software just like I was going to do on the Mac Pro.
It's good for three computers in the future so no money lost on the software
I'll probably just keep the Mini indefinitely for a backup even after I upgrade to the newer 2015 Mac Pro later next year.
Thanks -
Putting javascript inside WEB-INF
I could not call a javascript function test() from JSP. my function is defined in .js file places inside WEB-INF/javascript/script.js
and my JSP is inside WEB-INF/jsp/report.jsp. Its says object expected. I have tried all ways but could not access that function from JSP. Both javascript and jsp are inside WEB-INF folder. This is required.
Following is the code...
<html><head><title>Main Menu</title>
<script type="text/javascript" src="../javascript/tabpane.js"></script>
<link type="text/css" rel="StyleSheet" href="../css/tabpane.css" />
</head>
<body><h1>Report types</h1>
<div class="tab-pane" id="tab-pane-1">
<script language="javascript">
test();
</script>I could not call a javascript function test() from
JSP. my function is defined in .js file places inside
WEB-INF/javascript/script.js
and my JSP is inside WEB-INF/jsp/report.jsp. Its says
object expected. I have tried all ways but could not
access that function from JSP. Both javascript and
jsp are inside WEB-INF folder. This is required.
Following is the code...
<html><head><title>Main Menu</title>
<script type="text/javascript"
src="../javascript/tabpane.js"></script>
<link type="text/css" rel="StyleSheet"
href="../css/tabpane.css" />
</head>
<body><h1>Report types</h1>
<div class="tab-pane" id="tab-pane-1">
<script language="javascript">
test();
</script>The script element includes a client-side script into the document. Client-side script is executed by web browser in this case, while WEB-INF is an "protected" area and is not accessible to web browser. So you can not put javascripts, images and css files into WEB-INF directory. -
Where to put data processing routine when acquiring data using DAQmx
I have a program that is aquiring data using the DAQmx Acquire N Samples mechanism with automatic reset and a data handler callback routine. DAQmx acquires N samples (usually 1024) from the board, calls the handler to do something with it, and then resets to get the next batch of data. The program acquires a number of lines of data, say 512 lines of N points each, with one callback call per line. Triggering is done by a hardware trigger at the start of each line of data. So far so good.
The issue is that the time that it can spend in the callback is limited, or else the callback is not finished when the next batch of data is ready to be transferd from the DAQmx buffers and processed. There is a substantial amount of analysis to be done after the entire frame has been acquired, and it ends up taking far longer than the time between lines; so where to put the processing? The data acquisition is started from a control callback callback that exits back to the idle loop after it starts the data acquisition process, so there is no code waiting to execute, to return to, when the data acquisition is finished.
I could try to put the data analysis routine into an idle-time routine and trigger it with a semaphore, or I could put it into a timer control callback with, say, a 10 millisecond repetition rate and poll a flag, setting the flag when all of the data has been acquired. Any suggestions would be appreciated.I would recommend using Thread Safe Queues. Your acquisition callback can place items in the TSQ and then you can process the data in a separate thread. TSQs are nice because they allow you to install a callback function to run for certain events. Most importantly, you can install a callback for the Items in Queue or Queue Size Changed event which will run the callback if a certain number of items are in the queue. This lets you take advantage of multithreading in a simple and safe way using a standard Producer/Consumer architecture. However, you may still run into problems with this architecture if your acquisition thread is running much faster than the consumer thread. You could eventually overflow the queue. In that case, your only options are to either get a faster system, slow down the acquisition or do the data handling post process.
National Instruments
Product Support Engineer
Maybe you are looking for
-
Savage4: DRI installed and enabled, still not working!
My box has Savage4-based ProSavage 8 onboard video hardware, which I am attempting to enable acceleration for. XOrg comes with 2D drivers for this hardware; however, 3D drivers are not included in XOrg or the Arch default kernel (though the kernel is
-
How to send plain text body in HTTP Post method ?
Hi Exeperts, I have a scenario http post - ptoxy. Sender sending the data in http post in plain text body (only field values will be in the body). how should i capture this plain text for receiver to map.. is any udf or xsl code ? please guide me for
-
Problem with layer sets opening
Hi, I have a problem open layer sets. In my script I get layers index and then iterate throught this layers. Here is the script: function getAllLayersByIndex(){ function getNumberLayers(){ var ref = new ActionReference(); ref.put
-
Export SQL query from link or button
I want to list several 'canned' SQL queries on one page as buttons or links; and have the result of selection be an immediate extract/download to excel of the data. How can I best do this? I suppose I could create separate hidden regions with their o
-
I have Iphone 4s with latest version ios . my problem is the phone not showing Airdrop and air.