I have written a small firemonkey mobile app in C++ XE6 using several forms/units which all attempt to read data from a json feed.
I would like to keep the user details in a separate class to pass in the REST request rather than pass them from form to form.
What is the syntax for creating a static class and, other than including a reference to myclass.h, how does one access it's properties please?
Related
When i select Generate Application Module class and click OK, The AMImpl.java class is generated without any code. what might be the reason for this?
It's because all the code is in the base class.
What do you expect to be in the class?
When you define to create the class, you can choose what will be created (all based on the time you create the class).
Then all methods you write will end up in this class and can be exposed to the client.
Use is described here.
Per the docs:
The base classes of the ADF Business Components framework may be
extended to incorporate custom code with all types of components in
the framework and to extend the ADF Business Components framework
behavior.
When used without customization, your business component is completely defined by its XML document and it will be fully functional
without custom Java code or even a Java class file for the component.
If you have no need to extend the built-in functionality of a
component in ADF Business Components, and no need to write any custom
code to handle its built-in events, you can use the component in this
XML-only fashion. However, when you do extend base classes of the ADF
Business Components framework, you can still work with XML documents
in JDeveloper.
Once you have created framework extension classes, any new business component you create can be based on your customized
framework class instead of the base one. And, you can always update
the definitions of existing components to use the new framework
extension class as well.
Best practice is to create your own set of custom framework extension classes so you have hook points for creating common code for your custom ADF BC EOs and VOs
I'm working on a really big project. The aspect I'm currently working on requires that email templates are sent to a user when they're added to a learning course by another user.
The controller that deals with the request, does a bunch of str_replace tasks to find variables in the text (which the user can edit before adding another user to the learning course) and then replaces it with some values in the DB.
I took over this project and I'm not happy with the way half the things are done but time costs dictate I rather just go along with it.
The email is sent using Cake's native email function. It uses a template to capture data and send to the user.
Here's the question:
Should I keep the logic in the controller or do you think it's safe to move it to the element view's .ctp file?
My first instinct is to leave it in the controller as per the usual MVC separation ideals.
Cheers
This is a very important question - what are you using exactly for the email? The old email component or the new CakeEmail class? Which CakePHP core version are you using?
Here are some plausible aproaches here. You can:
Set all those variables, pass them to the view and do all the "replacing" there.
Encapsulate this logic in a component, attach it to your controller(s) and use it.
Just leave it in a private function within the controller and call that function whenever needed. (not really MVC)
I am building an Asp Net website in Visual Studio that uses Razor developed HTML pages. I would like to be able to use some C# from the javascript on one of the web pages (this is not creating a plugin that would be displayed in the browser.) I have tried to create a simple Cs class that has a single method that returns a fixed string to test this. The following code is in the ManagedCsClass.cs file is in the App_Code folder in my project.
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
public class ManagedCsClass
{
public ManagedCsClass()
{
//
// TODO: Add constructor logic here
//
}
public string ReturnText()
{
return "Text from ManagedCsClass";
}
}
What I am not clear on is where to create the object that would be used by the HTML page (in the same .cs file as the class, another .cs file, or from a call from the HTML browser page).
And what code do I need to use in the javascript to reference the object/method?
Thanks for any help or guidance you can provide.
Mark
You are trying to use "ActiveX" com objects, this requires the dll containing that class registered on the client and you will have a lot of security/deploy issues ( the client must trust your object and have the framework installed ). It is not the best way to create a web app today.
I'm trying to develop my first Silverlight navigation application. This application has 2 main pages, "Data", and "Analysis". The Data page is where the user can load in a csv file into a custom datatable object :-), whilst the Analysis page is where the user can analyse the datatable.
How do I expose/share the datatable on the Data page so that the Analysis page can access it?
You can also create some class with public static field in it. All these field would be accessible to all pages. So they can be used as globals. Something like that:
public class DataClass
{
public static DataTable DataTable1;
}
I'm pretty uncomfortable with you defining variables in the app class so that they are globally available and I absolutely can't (frankly) see using the disk as an intermediary.
I explore one way to solve this in this tutorial
In SL4 a cleaner way may be to use the Frame to hold a reference to a business object that can be passed among pages. I'll explore that a bit and comment soon.
Thanks
-Jesse Liberty
Make the database an Application Resource or Application Lifetime Object.
Save it into isolated storage and reload it on the Analysis page.
Well in the end I worked out that you could access the Application class at any point through
App app = (App)Application.Current;
and then define your variables in the App class - simple!
I'm new to WPF and used to ASP.NET. I have a WPF app that will require a login screen. Throught the rest of the app I want to be able to access a "Session" object that will contain some credentials information. How do I store that so that any view in my app can access that object?
You can also use lightweight container to store objects globally in loosely coupled way and retrieve these object using Dependency Injection pattern.
One of implementations of lightweight container is Unity Application Block from Microsoft (http://www.codeplex.com/unity) so you can start there and read more here and here.
The Application object has a Properties property that allows you to store and retrieve application wide objects.
It is better explained here:
How to: Get and Set Application-Scope Properties
There are a few ways to do this.
You can create a static class, perhaps you might call it "Session" which holds the data that you are interested in. Session might have a Dictionary that contains the data that you are interested in.
You can hold the data in the main form, and have the main form pass a data container to each view.
There might be better ways to do this that are more compatible with your design goals if you can provide more details about the implementation and use cases.