How do you declare and call a function?
I wrote the code that's gonna need to be repeated many different times in my program so i need to make a function that i can call with the code inside it. i tried
public class MyFunction
// My code
}This will compile but as soon as i put some code in that manipulates any variable, it won't compile. it will declare a variable though. For example i can say int i; but as soon as i say i++; OH NO 50 million compiler errors. So what is the proper way to declare a function? How do you call it? Please don't just say read this and send me a link, i always find it hard to follow those tutorials.
thanks, lateralus
That's a class, you need a method.
public void myFuntion()
//code goes here
}You can call that method from almost anywhere like this.
myFunction();
Similar Messages
-
Why is the panarama function in my Elements 12 not active? Also, how do you burn and dodge in Elements 12?
It sounds like you aren't in Expert Mode. Click the word Expert at the top of the PSE window to go there.
For burn and dodge, click the Sponge tool and you'll see those tools in the tool options at the bottom of the screen: -
How do you create a user defined functions UDF and passing a value like a ID to GEt a Value.
How do you create a user defined functions UDF and passing a
value like a ID to GEt a Value.
using a query.
are there example.
Thankstons of examples at cflib.org - good place to start, even
though many
udfs there are a bit outdated in their code...
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com -
Receiving calls marked "Private". Who can make and how do you make these calls?
Receiving calls marked "Private". Who can make and how do you make these calls?
Anyone can make them, just dial *67 in front of the # you're calling.
-
Allocate memory and call dll function which writes to the pointer
Hi!
I have a DLL wich has a function like the following example, wich i need to call from labview. In C I need to allocate some memory for the data and of course the struct. I add the pointer and the lengh of the data to the stuct and call the function with the struct. The function itself inserts some values to the stuct and to allocated memory. Has someone a working solution how this can be done with Labview?
typedef struct Thestruct
UINT16 val1;
UINT8 val2;
UINT8 val3;
UINT16 dataLength;
UINT8 *data;
} T_Thestruct;
MY_API Status MY_API_CALL udaReceive(Handle handle, T_Thestruct *args);
I tried in labview (see picture), but I only got values inside the struct as well as the error 1097, the reserved memory inclues the same values as before.
Solved!
Go to Solution.
Attachments:
CallDll.PNG 21 KBTobias_BSH wrote:
OK, I found the soluton to my own Problem. The alignment on the struct must be corrected in Labview. There must be a 2Bytes dummy value between dataLength and the pointer.
And please not that your solution only works in LabVIEW 32 bit. In LabVIEW 64 Bit your DLL has to be 64 bit compiled as well in order to be loadable and the pointer then is a 64 bit integer and is usually aligned to 64 bit addresses too. In this particular case since the pointer is already aligned to a multiple of 64 bit (when the additional 2 alignment bytes are added) you won't have to modify the alignment for the 64 bit case, but you have to define a different cluster with the 64 bit integer for the pointer anyhow.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Re: How do you create and use "common" type classes?
Hi,
You have 2 potential solutions in your case :
1- Sub-class TextNullable class of Framework and add your methods in the
sub-class.
This is the way Domain class work. Only Nullable classes are sub-classable.
This is usefull for Data Dictionary.
The code will be located in any partition that uses or references the supplier
plan.
2- Put your add on code on a specific class and instanciate it in your user
classes (client or server).
You could also use interface for a better conception if needed. The code will
also be in any partition that uses or references the supplier plan where your
add on class is located.
If you don't want that code to be on each partition, you could use libraries :
configure as library the utility plan where is your add-on class.
You can find an example of the second case (using a QuickSort class,
GenericArray add-on) with the "QuickSort & List" sample on my personal site
http://perso.club-internet.fr/dnguyen/
Hope this helps,
Daniel Nguyen
Freelance Forte Consultant
http://perso.club-internet.fr/dnguyen/
Robinson, Richard a écrit:
I'm relatively new to forte and I'd like to know how can you handle utility
type classes that you want to use through out your application? Ideally
what I want is a static class with static methods.
Let's say that I have a StringUtil class that has a bunch of methods for
manipulating strings.
My problem is that we have code that runs on the client and code that runs
on the server. Both areas could use the StringUtil class, but from what I
understand, I have to create StringUtil in a plan and then create a server
object of type StringUtil. The server object will eventually get assigned
to a partition. That's not good since I really want the server object to
physically reside at the server end and at the client end. (Actually, I
don't want a server object, I just want to invoke a static method of a
static class).
Any clues on how to solve this problem would be appreciated.
Also, what is the url at Sage-it that has a summary of all emails that have
been posted to [email protected]? Perhaps this question has been
answered previously.
Thanks in advance
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>Hi Richard,
Your question about "utility classes" brings up a number of issues, all of
which are important to long-term success with Forte.
There is no such thing as a static method (method that is associated with a
class but without an implicit object reference - this/self/me "pointer") in
TOOL, nor is there such thing as a global method (method not associated
with a class at all). This is in contrast to C++, which has both, and
Java, which has static methods, but not global classes. Frequently, Forte
developers will write code like this:
result, num : double;
// get initial value for num....
tmpDoubleData : DoubleData = new;
tmpDoubleData.DoubleValue = num;
result = tmpDoubleData.Sqrt().DoubleValue;
tmpDoubleData = NIL; // send a hint to the garbage collector
in places where a C++ programmer would write:
double result, num;
// get initial value for num....
result = Math::Sqrt(num);
or a Java programmer would write:
double result, num;
// get initial value for num....
result = Math.sqrt(num);
The result of this is that you end up allocating an extra object now and
then. In practice, this is not a big deal memory-wise. If you have a
server that is getting a lot of hits, or if you are doing some intense
processing, then you could pre-allocate and reuse the data object. Note
that optimization has its own issues, so you should start by allocating
only when you need the object.
If you are looking for a StringUtil class, then you will want to use an
instance of TextData or TextNullable. If you are looking to add methods,
you could subclass from TextNullable, and add methods. Note that you will
still have to instantiate an object and call methods on that object.
The next issue you raise is where the object resides. As long as you do
not have an anchored object, you will always have a copy of an object on a
partition. If you do not pass the object in a call to another partition,
the object never leaves. If you pass the object to another partition, then
the other partition will have its own copy of the object. This means that
the client and the server will have their own copies, which is the effect
you are looking for.
Some developers new to Forte will try to get around the lack of global
methods in TOOL by creating a user-visible service object and then calling
methods on it. If you have a general utility, like string handling, this
is a bad idea, since a service object can reside only on a single
partition.
Summary:
* You may find everything you want in TextData.
* Unless you anchor the object, the instance will reside where you
intuitively expect it.
* To patch over the lack of static methods in TOOL, simply allocate an
instance when required.
Feel free to email me if you have more questions on this.
At the bottom of each message that goes through the mailing list server,
the address for the list archive is printed:
http://pinehurst.sageit.com/listarchive/.
Good Luck,
CSB
-----Original Message-----
From: Robinson, Richard
Sent: Tuesday, March 02, 1999 5:44 PM
To: '[email protected]'
Subject: How do you create and use "common" type classes?
I'm relatively new to forte and I'd like to know how can you handle utility
type classes that you want to use through out your application? Ideally
what I want is a static class with static methods.
Let's say that I have a StringUtil class that has a bunch of methods for
manipulating strings.
My problem is that we have code that runs on the client and code that runs
on the server. Both areas could use the StringUtil class, but from what I
understand, I have to create StringUtil in a plan and then create a server
object of type StringUtil. The server object will eventually get assigned
to a partition. That's not good since I really want the server object to
physically reside at the server end and at the client end. (Actually, I
don't want a server object, I just want to invoke a static method of a
static class).
Any clues on how to solve this problem would be appreciated.
Also, what is the url at Sage-it that has a summary of all emails that have
been posted to [email protected]? Perhaps this question has been
answered previously.
Thanks in advance -
How to make next and previous button function
Hello
Can anybody help me with how to achieve next and previous button function such as the one at www.bestbuy.com?
I would appreciate any help or suggestion.
Thank you!if you're not familiar with flash it might be easiest to place your initial "page" in frame 1, the 2nd (or next) page in frame 2, the 3rd/next page in frame 3 etc.
place your previous and next buttons in their own layer that spans the main timeline (which will have as many frames as you have "pages"). give them instance names (say prevBtn and nextBtn).
you can then use the following code placed in frame 1:
var tl:MovieClip=this
prevBtn.onRelease=function(){
tl.prevFrame();
nextBtn.onRelease=function(){
tl.nextFrame(); -
How Do You Place ( and ) Characters in Code?
How Do You Place( and )characters in Code? Example (302). THANKS.
What do you mean?
"(" and ")" are used in expressions much the same way they are used in algebraic expressions. They are also used to enclose a type name to form a cast specifier, to enclose the expression that defines the condition of an if, for, while or switch statement and they are use to enclose the formal argument list in a method declaration and the actual argument list in a method invocation. They can also appear in string constants. I probably left out a couple... -
How do you receive a call on your computer with the new OS X?
How do you receive a call on your computer with the new OS X?
The following quotation is from http://www.apple.com/ios/whats-new/continuity/
The link shows a picture of the Notification. Below it says there is "nothing to set up" but I believe that you need to have FaceTime activated (signed in) on both devices as there is a setting on iPhone/iPad in Settings > FaceTime where you turn "iPhone Cellular Calls" on/off.
Sometimes when your iPhone rings, it’s not where you are. Maybe it’s charging in another room. Or it’s buried in your backpack. But your Mac or iPad is sitting right there. Now you can make and receive phone calls on those devices as long as your iPhone running iOS 8 is on the same Wi-Fi network. Incoming calls show the caller’s name, number, and profile picture. Just click or swipe the notification to answer, ignore, or respond with a quick message. And making a phone call from your iPad or Mac is just as easy. Simply tap or click a phone number in Contacts, Calendar, or Safari. It all works with your existing iPhone number, so there’s nothing to set up. -
Call function and call customer function
Hi
Can anybody let me know what is the difference between CALL FUNCTION AND CALL CUSTOMER- FUNCTION .
i know call customer- function is used while we r working on user exits .
but is their any specific reason of difference ...
ThanksCALL CUSTOMER-FUNCTION function_exit parameter_list.
Effect
This statement can be used in programs delivered by SAP. It includes the function module exit specified in function_exit . The function module exit is a customer exit. In an SAP program, it enables you to call a function module provided by SAP and implemented by the customer.
The indicator function_exit must be a three-digit text field literal. A function module exit is specified by SAP using the transaction SMOD and can be activated using the transaction CMOD in customer systems.
Specifications by SAP
An empty or partly implemented function module must be assigned to the function module exit using the transaction SMOD. The name of the function module consists of EXIT_, the program name, which contains the statement CALL CUSTOMER-FUNCTION, and the three-digit indicator in function_exit. The interface of the function module is completely defined by SAP.
Activation in the customer system
The transaction CMOD enables the customer to implement the source code of the function module within an enhancement project and to activate the function module exit. If the function module exit is not activated, the statement CALL CUSTOMER-FUNCTION is ignored. If the function module is activated, the corresponding function module is called in the same way as the general function module call.
Syntax and meaning of the parameter_list for the assignment of the actual parameters to formal parameters and for the exception handling are the same as in a general function module call. It is not possible to dynamically fill the interface.
CALL FUNCTION func
Syntax
CALL FUNCTION func { parameter_list
| parameter_tables }.
Effect
This statement calls the function module specified in func. The identifier func must be a character-type data object, which contains the name of a function module in uppercase letters during the statement execution. Each function module of an SAP system has a unique name, which is why you need not specify the function group.
Use additions parameter_list or parameter_tables (as of release 6.10) to statically or dynamically assign actual parameters to the formal parameters of the function module and return values to the non-class-based exceptions.
Note
If the name of a function module is specified by a constant or as a literal, the extended syntax check can check the statement.
Exceptions
Catchable Exceptions
CX_SY_DYN_CALL_ILLEGAL_FUNC
Cause: The called function is known but not active.
Runtime Error: CALL_FUNCTION_NOT_ACTIVE
Cause: The called function is unknown.
Runtime Error: CALL_FUNCTION_NOT_FOUND
CX_SY_DYN_CALL_ILLEGAL_TYPE
Cause: The type of the actual parameter does not fulfill the requirements of the function interface.
Runtime Error: CALL_FUNCTION_CONFLICT_GEN_TYP
Cause: The actual parameter does not have the length expected by the function.
Runtime Error: CALL_FUNCTION_CONFLICT_LENG
Cause: The actual parameter does not have the type expected by the function.
Runtime Error: CALL_FUNCTION_CONFLICT_TYPE
Cause: Only those functions can be called in the update task that are intended for it.
Runtime Error: CALL_FUNCTION_NO_VB
Cause: An actual parameter does not fulfill the alignment requirements of the respective formal parameter.
Runtime Error: CALL_FUNCTION_WRONG_ALIGNMENT
CX_SY_DYN_CALL_PARAM_MISSING
Cause: The function expects a parameter, which has not been passed by the caller.
Runtime Error: CALL_FUNCTION_PARM_MISSING
CX_SY_DYN_CALL_PARAM_NOT_FOUND
Cause: The caller has passed a parameter, which is not known to the function.
Runtime Error: CALL_FUNCTION_PARM_UNKNOWN
plz reward points if it helps -
How do you select and move more than one bookmark at a time?
Shift+Click does not select multiple items that are next to one another in a list because the items open in firefox before this happens.Use the bookmarks library. You may use Shift +Click, and Ctrl + Click to create groupings of selected bookmarks to drag and drop.
* one method of opening the bookmarks library is keyboard shortcut <br /> Ctrl+Shift+B (Windows)
*see also [[How to use bookmarks to save and organize your favorite websites]]
*and [[Use bookmark folders to organize your bookmarks]] -
How do you add and remove links to websites in folders on Safari?
How do you add and remove links to websites in folders on Safari?
For clarification, works like a bookmark of website only it is listed in toolbar with "Most Visited", "Latest Headlines", "News", and "Popular". I have done it before but can't find it for the life of me.
Thanks! -
How do you Design and Develop?
How do you Design and Develop?
I know this varies based on alot of things such as knowledge, preference, purpose, resources, etc..but I am curious how different (level of expertise) designers actually prefer or implement their websites. I decided to do this post after two different forums discussions regarding 1.Templates and PHP and 2. Backend Development.
1. How do you generally approach a project?--Wireframe, Freehand (as it comes), PSD template, etc.--Do you have a specific 'methodology' or procedure?
2. What are 2-3 of your main resources / sites / applications etc that you use (and for what?)
Specifically: What do you use (and how) to get up a website? (I know again this depends on a variety of things, but in general..) *also if you would like to comment on your expertise or level maybe helpful.
Do you prefer (Pros/ Cons of:) What advice would you give regarding below?
Your own HTML/CSS/Script based site that you mostly (if not completley) built. (More control and original, but harder / tedious for beginner)
HTML Temlplate (tweak the HTML and CSS)--non framework type (Quick and easy, but usually poor quality, outdated?)--but some can servde as good starting point.
Wordpress (And others like Drupal, Joomla) (Somewhat quick and easy access to tweak a quality WP Theme with ability for alot of features--forms, search, databases, etc (otherwise might have trouble with advanced features w/o good working knowledge og PHP and MYSQL, maybe others?)--but kind of a 'workaround' for real HTML design?
Frameworks types like Foundation, Bootstrap, Skeleton
A combination or hybrid of methods? -- or another method I have overlooked?
Thanks very much for any insight you can offer, hopeully this will lead to a vibrant discussion.-The websites I build are 95% PHP/MySQL. They are heavy on business logic. I sometimes work with designers, SEO "experts" and (rarely) other coders. I almost never work on the content of websites. The clients do that themselves through the CMS I build for them.
I write every line of code myself except for the use of jQuery and a few PHP code classes adapted from others. I can build a complex website in a matter of minutes by reusing the code libraries and patterns I have developed from previous projects.
I don't use a PHP framework because I have developed my own "pseudo-framework" for the particular kinds of sites I build, but I respect the frameworks that are out there. They can teach you excellent coding habits.
In starting the design and logic of a site, the most essential question is: What is the website (or website project) supposed to accomplish? My clients tell me what they want to accomplish, but I usually decide how to get there. This holds for both business logic and design, because design also must serve the business objectives.
My website projects generally take four months to two years to complete. The client usually dedicates one employee to work as a liaison between me and the rest of the company. Because the sites I build are heavy on the business logic, a great deal of time is spent on testing and debugging. I make testing the responsibility of the client so I can't be held liable if, for instance, a terrible accounting mistake is discovered in the code logic.
I like to use Adobe Illustrator for design development because I became an Adobe Illustrator ACE in 2000; however, I can see that Fireworks is probably the better tool. Photoshop is an important secondary tool.
For general site management and code writing I use both Dreamweaver and ZEND Studio; however, I use Dreamweaver less and less.
I now require all my clients to have their websites (and also domain name registrations, since my company is a domain name reseller) hosted on my VPS server. This prevents anyone from stealing code I have worked for years to develop and also establishes a commitment between myself and the client. When you are starting a web development business, you can't demand this kind of commitment from the client. Even a lot of great seasoned developers can't. It depends on your reputation within the specific industry(ies) you service. -
if you've changed your startup options on mac to start in windows, how do you fix and go back to mac. I can't get my mac to switch back to mac, it is like stuck in widows mode, I have tried holding down the options key upon start up and that did not fix it either.
Please help! Thank you so much!The Apple drivers you install in Windows also puts a Startup Drive icon in the Task Bar. Choose that to change the startup disk back OS X.
-
How do you date and time stamp iCal entries? We share an event calendar and need to know when a new event was entered into iCal.
BKBK,
Thank you for your response. That does adequately cover the
client-originated sessions, but still leaves the ability I am
looking for unavailable.
It did serve to definitively answer my most pressing
question, however, with this statement:
Note: ColdFusion cannot create a session if an initiator
application uses a SendGatewayMessage method to start an
interaction with a client, such as an SMS user. In this case, the
sending code must keep track (for example, in a database) of the
messages it sends and their destinations. When a response event
arrives, it can look up the origniatorID to determine whether it
was in response to an outgoing message.
I will play around with the Application scope to see if there
might be a workable solution there.
RLS
Maybe you are looking for
-
How do i stop the startup noise on my iMac, how do i stop the startup noise on my iMac
when my imac starts up there is a sound, not a this mac has a problem noise but it's more like it should happen, can anyone tell me how if pos i can switch this off please thxs j.mck
-
Why no Update yet even though Mavericks full of Finder bugs
In the Finder We have problems with Windows, folders(they stubborn and don't want to move where you move them), and regarding web related operations TEXT operations and Text Edit, you can no longer Copy text and images from a webpage and Pasting
-
Did something change with the video formats in iTunes 10.5?
Good afternoon, Since updating to iTunes 10.5, I've found that I can't sync any videos (whether they be TV Shows, Films or Video Podcasts) to my iPod. I've tried various different methods of trying to fix this but every time I do I get given the erro
-
With several past OSX installations, I could open several web sites and back-up to the previous one. Now, with OSX 10.9 (Matrix), in most cases, each new web site overwrites the previous one. In some instances, a second window in a site will allow
-
MouseEvents and KeyEvents in the same form is not working
Hello! I'm newbee in java althought i've bee programing for a long time in other languages, C, C++ wich i'm proud of. Now i land on java and there are a lot of cuestions (nothing that cant be solved by trying and reading). But today i hitted my head